Jarekkk

439 Reputation

13 Badges

14 years, 159 days

MaplePrimes Activity


These are answers submitted by Jarekkk

I think that sum(x[i](r[i,t]-u[i]))*sum(x[j](r[j,t]-u[j])) = w[t]^2 is OK, since i,j are independent, so you can rewrite it (use i instead of j) as sum(x[i](r[i,t]-u[i]))*sum(x[i](r[i,t]-u[i])) = w[t]^2.

x[1]:=1.5;

for n from 1 to 20 while (Error>DesiredError) do
x[n+1]:=x[n]-(p(x[n])/eval(diff(p(x),x),x=x[n])):
Error:=abs(x[n+1]-x[n]):
end do;

 

Or you can compute the derivative before the loop (to avoid computing it in each cycle):

dp:=diff(p(x),x);

x[1]:=1.5;

for n from 1 to 20 while (Error>DesiredError) do
x[n+1]:=x[n]-(p(x[n])/eval(dp,x=x[n])):
Error:=abs(x[n+1]-x[n]):
end do;

 

It is not undefined for x=y, but I don't know if it's a problem.

Is there a command for diagonalizing of matrices?

I have managed to compute it numerically by

dsolve([diff(N(t), t) = N(t)*(1-(1/1000)*N(t))-piecewise(200 < N(t), 300, N(t) <= 200, (3/2)*N(t)), N(0) = 500], numeric)

 

for particular values. I guess it is not possible to obtain a "general analytical solution".

I'm using Maple 11 and there is even some kind of example in the help:

 

As an example, consider the differential system diff(x(t),t) = f(t,x(t),y(t)), diff(y(t),t) = g(t,x(t),y(t)) for some specific form of f(t,x(t),y(t)), g(t,x(t),y(t)). The procedure and jacobian procedures could be defined as follows:

prc := proc(n,t,v,vp)

vp[1] := f(t,v[1],v[2]);

vp[2] := g(t,v[1],v[2]);

end proc:

jac := proc(t,v,ft,fv)

ft[1] := D[1](f)(t,v[1],v[2]); ft[2] := D[1](g)(t,v[1],v[2]);

fv[1,1] := D[2](f)(t,v[1],v[2]); fv[1,2] := D[3](f)(t,v[1],v[2]);

fv[2,1] := D[2](g)(t,v[1],v[2]); fv[2,2] := D[3](g)(t,v[1],v[2]);

end proc:

 

But as I had written earlier this didn't help me a lot. I would like to see a concrete example.

The most important thing is probably the dsolve call (= dsolve({sys,ic},numeric,method=rosenbrock,jacobian=??)).

I have tried to use an example from Help section but haven't managed to run it so even a simple (but concrete) example

would be great.

 

Regards,

Jarekkk

Thanks for the comment. I know there are several solvers for ODEs in Maple. What more I have used all of them. The goal

I've been searching for is to compare all the solvers and find one which suits best my problem. I don't know if specifying

jacobian matrix would help rosenbrock solver to compute faster but I have to try it. And don't know how.

Jacobian is a constant matrix in my case and I can't find out how to tell Maple's rosenbrock solver that the matrix is jacobian of the system. 

5 6 7 Page 7 of 7