Mathematica 9 is now available
Student Support Forum
Student Support Forum > General > > "Help with creating matrix from another matrix"

Post Reply:
Email Address:

Please send email when my message is replied to.

Url (optional):
Message: view original message?
Attachment (optional):
Please answer this:1+5 =

Original Message (ID '428941') By Bill Simpson:
You do not need to be sorry with me for your grammar. Your use of English is much better than my use of almost any other language except mathematics and Mathematica and a dozen other computer languages. If you could provide a function or equation that calculates the value of C[[x,y]] from A and B for all x and y and which assumes A[[p,q]] and B[[r,s]] will be zero when outside matrix A or B then perhaps we could translate that function into Mathematica. Perhaps you can use this to write your own code. In[1]:= v={{1,2,3},{4,5,6}}; myPart[m_,i_,j_]:=If[i>Length[m]||j>Length[First[m]],0,m[[i,j]]]; Print[v[[2,3]]]; Print[v[[2,4]]]; Print[myPart[v,2,3]]; Print[myPart[v,2,4]]; From In[1]:= 6 From In[1]:= Part::partw: Part 4 of {4, 5, 6} does not exist. {{1,2,3},{4,5,6}}[[2,4]] From In[1]:= 6 From In[1]:= 0 myPart[A,x,y]==A[[x,y]] when x,y are inside A and myPart[A,x,y]==0 when x or y are outside A. myPart[C,x,y]=4 does not allow you to assign 4 to a part of C, only to obtain values from C.