Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #15869 > unrolled thread
| Started by | Isabella Blengini <isableng@gmail.com> |
|---|---|
| First post | 2011-01-30 00:43 +0000 |
| Last post | 2011-01-31 08:23 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
loops in mathematica Isabella Blengini <isableng@gmail.com> - 2011-01-30 00:43 +0000
Re: loops in mathematica David Bailey <dave@removedbailey.co.uk> - 2011-01-31 08:23 +0000
| From | Isabella Blengini <isableng@gmail.com> |
|---|---|
| Date | 2011-01-30 00:43 +0000 |
| Subject | loops in mathematica |
| Message-ID | <ii2c7c$r9o$1@smc.vnet.net> |
I have a problem with a loop that I would like to write in Mathematica.
I have a function sigma that changes with i.
and I have a function alpha that changes with sigma.
Imagining that i goes from 1 to 100, in another system I would write something like:
sigma=zeros(100,1);
alpha=zeros(100,1);
for i=1:100;
sigma(i,1)=some function of i;
end
for i=1:100;
alpha(i,1)=some function of sigma(i,1);
end
and I would get 2 vectors (100,1).
Please let me know if you can help me
MANY THAnks,
isabella
[toc] | [next] | [standalone]
| From | David Bailey <dave@removedbailey.co.uk> |
|---|---|
| Date | 2011-01-31 08:23 +0000 |
| Message-ID | <ii5rit$fii$1@smc.vnet.net> |
| In reply to | #15869 |
On 30/01/2011 00:43, Isabella Blengini wrote: > I have a problem with a loop that I would like to write in Mathematica. > > I have a function sigma that changes with i. > and I have a function alpha that changes with sigma. > > Imagining that i goes from 1 to 100, in another system I would write something like: > > sigma=zeros(100,1); > > alpha=zeros(100,1); > > > > > > for i=1:100; > > sigma(i,1)=some function of i; > > end > > > for i=1:100; > > alpha(i,1)=some function of sigma(i,1); > > end > > > and I would get 2 vectors (100,1). > > > Please let me know if you can help me > > > MANY THAnks, > > isabella If you press F1 (to bring up the help system), type in loop, and press return, you will see links to a number of looping functions. Each one will have examples that can be cut and pasted into your notebook and altered to suit your needs! Table will also do what you require without using a loop, and you might want to look up Map as well. David Bailey http://www.dbaileyconsultancy.co.uk
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web