Message Boards Message Boards

0
|
6164 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Assign a value to a symbolic matrix?

Posted 9 years ago

Hi guys, I am quite new to mathematica. I have a simple problem, and I would like to share it with you. suppose that I have the below matrix:

f[x_] := ( {{x*5, x^2}, {x, x - 1}  } )

now I want to assign a symbolic value to an element of the above matrix by the command below:

f[x][[2 , 2]] := x

but unfortunately mathematica says :"f[x] in the part assignment is not a symbol." what can I do to solve this problem, thanks a lot

POSTED BY: Mohsen Rezaee
Posted 9 years ago

I'm not sure what the problem was. It works for me in 10.3.

In[1]:= $Version

Out[1]= "10.3.0 for Microsoft Windows (64-bit) (October 9, 2015)"

In[2]:= f[x_] := {{x*5, x^2}, {x, x - 1}}

In[3]:= f[x]

Out[3]= {{5 x, x^2}, {x, -1 + x}}

In[4]:= f[x][[2, 2]]

Out[4]= -1 + x

In[5]:= f[3]

Out[5]= {{15, 9}, {3, 2}}

In[6]:= f[3][[2, 2]]

Out[6]= 2
POSTED BY: David Keith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract