Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Help with creating matrix from another matrix' topicStudent Support Forum > General > Archives > "Help with creating matrix from another matrix"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
03/24/13 11:53pm

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.

URL: ,

Subject (listing for 'Help with creating matrix from another matrix')
Author Date Posted
Help with creating matrix from another matrix Anton Siswo 03/24/13 01:15am
Re: Help with creating matrix from another matrix Bill Simpson 03/24/13 11:53pm
Re: Re: Help with creating matrix from another ... Anton Siswo 03/25/13 11:35am
Re: Re: Re: Help with creating matrix from anot... Bill Simpson 03/25/13 7:32pm
Re: Re: Re: Help with creating matrix from anot... Bill Simpson 03/25/13 10:20pm
Re: Re: Re: Re: Help with creating matrix from ... Anton Siswo 03/31/13 7:22pm
Re: Re: Re: Re: Re: Help with creating matrix f... Bill Simpson 04/01/13 00:06am
Re: Re: Re: Re: Re: Re: Help with creating matr... Anton Siswo 04/01/13 5:52pm
Re: Re: Re: Re: Re: Help with creating matrix f... Bill Simpson 04/01/13 10:44am
Re: Re: Re: Re: Re: Re: Help with creating matr... Anton Siswo 04/08/13 04:52am
Re: Re: Re: Re: Re: Re: Re: Help with creating ... Bill Simpson 04/09/13 8:35pm
Re: Re: Re: Re: Re: Re: Re: Re: Help with creat... Anton Siswo 04/11/13 10:58am
Re: Re: Re: Re: Re: Re: Re: Help with creating ... Bill Simpson 04/09/13 9:54pm
Re: Re: Re: Re: Re: Re: Re: Re: Help with creat... Anton Siswo 04/10/13 9:41pm
Re: Re: Re: Re: Re: Re: Re: Re: Re: Help with c... Bill Simpson 04/12/13 00:35am
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Help wi... Anton Siswo 04/16/13 07:19am
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Hel... Bill Simpson 04/16/13 7:48pm
Re: Help with creating matrix from another matrix Anton Siswo 03/26/13 11:29pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic