Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.4K Views
|
1 Reply
|
1 Total Like
View groups...
Share
Share this post:

How to fill Table with with for sentence?

Posted 6 years ago
Attachments:
POSTED BY: Urban Gramc
Posted 6 years ago

Can you adapt this

n=3;
rx=Table[Sum[If[j<i,1,1/2]*I*Sin[Subscript[\[Phi],j]],{j,1,i}],{i,1,n}];
ry=Table[Sum[If[j<i,1,1/2]*I*Cos[Subscript[\[Phi],j]],{j,1,i}],{i,1,n}];

and then rx has the value

{(I/2)*Sin[Subscript[\[Phi], 1]],
 I*Sin[Subscript[\[Phi], 1]] + (I/2)*Sin[Subscript[\[Phi], 2]], 
 I*Sin[Subscript[\[Phi], 1]] + I*Sin[Subscript[\[Phi], 2]] + (I/2)*Sin[Subscript[\[Phi], 3]]}

and ry is similar with Cos

If you only wish to use For then

n=3;
rx=Table[0,{n}];
For[i=1,i<=n,i++,
  For[j=1,j<=i,j++,
    rx[[i]]=rx[[i]]+If[j<i,1,1/2]*I*Sin[Subscript[\[Phi],j]]
  ]
];

will give you the same values for rx and similar code with Cos will give you the same values for ry

POSTED BY: Bill Nelson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard