On Thu, 2007-01-25 at 06:12 -0500, Dan Solomon wrote:
> I don't understand your comment. Don't I have x as a 3-vector?
No, you don't. x[1], x[2], x[3] have no relation to the variable x.
x and x[1] are considered different variables in Maxima.
For instance, try this;
x[1]: 3;
x: 5;
x[1];
x;
You have a similar problem with the initial conditions: you
defined init[1], init[2] and init[3]. That's OK. But when you write
"init", it will not refer to the three array elements you defined
but to an unknown variable init, independent from init[1], init[2]
and init[3]. That's the way Maxima works. Therefore, the initial
conditions must be given as [init[1], init[2], init[3]].
If you really wanted init to be a list, you could give it an
initial value [] (empty list) and append numbers to it. Read the
documentation about lists and arrays.
The first argument given to rk must be a list of expressions. You first
tried with a 3x1 matrix dxdtau. It won't work. You then tried
[dxdtau[1],dxdtau[2],dxdtau[3]]
this is not a list of expressions either. Please notice that since
dxdtau is a matrix, dxdtau[1] is the first row of that matrix; namely,
it is a list itself.
[dxdtau[1],dxdtau[2],dxdtau[3]] is a list of lists.
You should try with:
[dxdtau[1][1], dxdtau[2][1], dxdtau[3][1]]
which will give you a list with the three elements in the matrix.
I hope this helps.
Regards,
Jaime
> Do I need to change x[1], x[2], x[3] to x, y, z, and then do rk
> (dxdt, [x,y,z], init, [t,0,1,.1])?
>