- #1
Anna Kaladze
- 35
- 0
Hi,
I have the following simple code in Mathematica:
a=1;
step=0.5;
b=2;
y=a^2-5
-4
What I need to do, is make Mathematica calculate the value of y each time for a different value of "a" ranging from the initial value of 1 to "b"(=2) in "step" increment (=0.5), and remember previous values of y in constructing a final array of y. That is, the answer would be y={-4, -2.75,-1}. It would be great to avoid using Table commands or tampering with the individual lines much. Just plain simple multiple iterations which would “nicely” lead to the y array of 3 numbers.
Any help is appreciated.
Thanks a lot.
Anna.
I have the following simple code in Mathematica:
a=1;
step=0.5;
b=2;
y=a^2-5
-4
What I need to do, is make Mathematica calculate the value of y each time for a different value of "a" ranging from the initial value of 1 to "b"(=2) in "step" increment (=0.5), and remember previous values of y in constructing a final array of y. That is, the answer would be y={-4, -2.75,-1}. It would be great to avoid using Table commands or tampering with the individual lines much. Just plain simple multiple iterations which would “nicely” lead to the y array of 3 numbers.
Any help is appreciated.
Thanks a lot.
Anna.