- #1

- 263

- 0

**[Wolfram Mathematica] -- how scripts work in Mathematica**

Hi. This is not a homework. I just did a script in Octave and I've just finished writing it on Wolfram Mathematica. The problem is that I don't know how to define the function, I don't know how scripts work in Mathematica.

My script should be like this:

Code:

```
Euler[c_,final_,step_,o_,r_,b_]:=
x=ConstantArray[0,{final/step,3}];
For[i=2,i<= final/step,i++,
ReplacePart[x, {i,1}->o*(x[[2,i-1]]-x[[1,i-1]])*step+x[[1,i-1]]]
ReplacePart[x, {i,2}-> step*(r*x[[1,i-1]]-x[[2,i-1]]-x[[1,i-1]]*x[[3,i-1]])+x[[2,i-1]]]
ReplacePart[x, {i,3}-> step*(x[[1,i-1]]*x[[2,i-1]]-b*x[[3,i-1]])+x[[3,i-1]]]
]
```

But that has a wrong syntax. I just want to type Euler and some parameters and receive that large matrix. How is that done in Mathematica?

Thanks!

EDIT: I forgot to write the title! I just typed the Tag, I cannot edit it now, sorry

Last edited: