Comment on Lecture # 1 (Monday)
Comment on Lecture # 1 (Monday)
Consider the properties of the Plus function. This is allowed:
In[]:=
{1,2,3}+{4,5,6}
Out[]=
{5,7,9}
In[]:=
{1,2,3}+"hello"
Out[]=
{1+hello,2+hello,3+hello}
Commutativity of addition is the main property.
In[]:=
{1,2,3}+{4,5,6}=={4,5,6}+{1,2,3}
Out[]=
True
In[]:=
{1,2,3}+"hello"=="hello"+{1,2,3}
Out[]=
True
Question: If the above are allowed,
why not allow this: {1,2,3}+{4,5} ?
Question: If the above are allowed,
why not allow this: ?
why not allow this:
{1,2,3}+{4,5}
In[]:=
{1, 2, 3} + {4, 5}
Out[]=
{4,5}+{1,2,3}
Answer: Because commutative property of addition would be lost.
Answer: Because commutative property of addition would be lost.
Indeed, on the one hand we would have (I’m using the equal sign loosely below):
{1,2,3}+{4,5}={1+{4,5},2+{4,5},3+{4,5}}
In[]:=
{1+{4,5},2+{4,5},3+{4,5}}
Out[]=
{{5,6},{6,7},{7,8}}
On the other hand, we would have
{4,5}+{1,2,3}={4+{1,2,3},5+{1,2,3}}
In[]:=
{4+{1,2,3},5+{1,2,3}}
Out[]=
{{5,6,7},{6,7,8}}
Obviously,
{{5,6},{6,7},{7,8}}!={{5,6,7},{6,7,8}}
