Maxima linear system of 6 differential equations question



wuko at onet.eu wrote:
> Hello !
>
> I have a question regarding those equations I have previously been asking about. I have to solve linear system of 6 differential equations:
> http://www.flickr.com/photos/16897263 at N04/1800786518/
> http://www.flickr.com/photos/16897263 at N04/1799946697/
>
> Can anyone tell me if I am doing it right ?
>
> First I define known variables:
> h[1] : 15;
> h[2] : 310;
> r : 2.15;
> J[b] : 45;
> Q[1] : 208;
> Q[2] : 100;
> T[m] : 335;
> J[m] : 20;
> l : 12.9;
> g : 9.8665;
> d : 3.80;
> E : 90;
> q : 120;
>
> Then I put separately each of the differential functions:
> f1 : -((E*%pi*d^2*r^2*g)/((h[2]+h[1])*4*(Q[1]+q*l)*r^2))*(fi[1]-fi[3])-((Q[1]+q*(h[2]+h[1]-r*fi[1]))*r*g)/((Q[1]+q*l)*r^2);
> f2 : -((E*%pi*d^2*r^2*g)/(h[1]*4*(Q[2]+q*l)*r^2))*(fi[2]-fi[3])+((Q[2]+q*(h[1]-r*fi[2]))*r*g)/((Q[2]+q*l)*r^2);
> f3 : -((E*%pi*d^2)/((h[2]+h[1])*4*(J[m]+J[b])))*r^2*(fi[3]-fi[1])-((E*%pi*d^2)/(h[1]*4*(J[m]+J[b])))*r^2*(fi[3]-fi[2])+T[m]/(J[m]+J[b]);
> f4 : Omega[1];
> f5 : Omega[2];
> f6 : Omega[3];
>
> Now, I load the dynamics package:
> load("dynamics");
>
> And then I can go with Runge Kutta method rk:
> lnr: rk([f1,f2,f3,f4,f5,f6],[Omega[1],Omega[2],Omega[3],fi[1],fi[2],fi[3]],[0,0,0,0,0,0],[t,1,2,0.1]);
>
> Is it a proper sequence to solve these kind of equations ? because sometimes I get weird results. Do I have to define the functions, so that the d*Omega[1]/dt is not the part of equation ? As seen on the Maxima's examples ? I mean that original equation no. 1 would look like this in Maxima:
> f1 : ((Q[1]+q*l*r^2)/g)*diff(Omega[1],t)+((E*%pi*d^2)/((h[2]+h[1])*4))*(fi[1]-fi[3])*r^2 = -([Q[1]+q*((h[2]+h[1])-r*fi[1])])*r;
>
> But after reading those examples I have changed it to this form:
> f1 : -((E*%pi*d^2*r^2*g)/((h[2]+h[1])*4*(Q[1]+q*l)*r^2))*(fi[1]-fi[3])-((Q[1]+q*(h[2]+h[1]-r*fi[1]))*r*g)/((Q[1]+q*l)*r^2);
>
> So d*Omega[1]/dt is on the left side of equation (and it's not written in Maxima) and the rest is on the right. Regarding equations no. 2-6 - I've changed them the same way.
>
> Oh, one more thing:
> why I get sometimes results like this:
> [1,0,0,0,0,0,0],[2,0.0=0.0=(0.0=0.0)=(0.0=0.0=(0.0=0.0))=-405.2814=0.0... etc. where those = signs come from ?
>
> Best regards,
> Damian.
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
> .
>
>   
It is hard to read your equations.  Why don't you try to write them in 
the standard form

xdot = f(x)   

where x and xdot are 6 dimensional vectors  and f(x) is  a function from 
R^6 to R^6.

I am attaching a file "RK_1.mac" which I wrote a few months ago.  This 
implements a simple 4th order Runge-Kutta routine which is apparently 
faster than that in the dynamics package.

I also included an example applying it to the Lorenz differential 
equations. 

HTH,
 -sen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RK_1.mac
Type: image/x-pict
Size: 2057 bytes
Desc: not available
Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20071103/d3d1df2a/attachment.bin