cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

System of ODE's

JohnRudnicki
15-Moonstone

System of ODE's

I am trying to solve a system of ode's that have gotten increasingly complex as I have added various effects. Everything was working ok until I made the last change (in attached worksheet, addition of the last term - in parentheses - in the expression for dp in the solve block). Now the worksheet does not even get past the solve block to the ode's. I dont get an error message. It just keeps calculating although I have left it for 30 minutes or so. The addition does not seem that complicated: the system is still linear for dv, etc.

Did I do something wrong? Any advice?

11 REPLIES 11

Hi,

the initialization of the independent variables and the values of some constants, are missing. It must be done before the "Given" instruction. Furthermore, as a rule when using "Odesolve", you should write explicitly the derivatives of the unknown functions  or also using the " ' " .

initialization.jpg

Werner_E
25-Diamond I
(To:-MFra-)


@-MFra- wrote:

Hi,

the initialization of the independent variables and the values of some constants, are missing. It must be done before the "Given" instruction. Furthermore, as a rule when using "Odesolve", you should write explicitly the derivatives of the unknown functions  or also using the " ' " .

 


He is evaluating the solve block symbolically (which may be the cause for the troubles) and so he does not need any guess values or values for the other variables. After all he needs a symbolic expression in variables for D(t,y)!

And then - unless I'm blind - he is not using a solve block with "odesolve". He uses the commandline solvers to do this job.

 

-MFra-
21-Topaz II
(To:Werner_E)

It seems to me that he is looking for a numerical solution, otherwise why does he define some values like a, b etc.? Regarding "Odesolve", mine is a general advice and not related to the specific problem although, it seems to me, there are differentials like dτ, dθ, etc. and, therefore, the user has somehow transformed the  pde into equations for differentials.

Werner_E
25-Diamond I
(To:-MFra-)

Can you show how to solve his system with a solve block using odesolve?

-MFra-
21-Topaz II
(To:Werner_E)

Perhaps it would be more suitable "Pdesolve" rather than "Odesolve" if he would write the corresponding differential equations; in that case who could not try to solve them? And, anyway, it does not seem to me that the user is looking for a symbolic solution! Let's see what he says.

Werner_E
25-Diamond I
(To:-MFra-)


@-MFra- wrote:

 And, anyway, it does not seem to me that the user is looking for a symbolic solution!

He is not looking for a symbolic solution of the DE system, but he is looking for a symbolic solution for D() which is then used to calculate the Jacobi matrix and needed as argument for "Radau".

 

In the attached worksheet I deleted the clearing of the variables for symbolic use to speed up the solve block as mentioned above and as the Jacobi matrix(more correct, the function J which returns the Jacobi matrix) is an optional argument of "Radau", I omitted J and got the results shown in the attached picture (I am unable to embed pictures as of a stupid limit).

Not sure if the result is what John expects - we'll have to wait until he replies.

 

BTW, I don't think that PDESolve is necessary as it seems we deal with ODEs only. But I am to lazy to look up and find out all the ODEs  from that sheet to give odesolve a try.
Also it may have a reason why John used Radau and not a solve block with odesolve.

 

 

 

-MFra-
21-Topaz II
(To:Werner_E)

I stopped at the first hitch, I did not even look at the rest of the worksheet.

Thanks for all the discussion. Sorry for the slow reply, but I got caught up in some other things.

I am definitely solving ode's. I started out using odesolve in an earlier version of the calculation and was having some problems with the calculation failing. Maybe I gave up on odesolve too soon, but I went to the command line solvers because they seemed to be more flexible. The solve block is only to get the derivatives in the right form for the command line solvers. Because I was worried about the spikes in the solutions (the equations are very stiff) I tested various solvers and Radau with the Jacobian seemed most robust. I do not remember whether I ever tested it without the Jacobian but I thought (without any good reason) that it would be better with the Jacobian than without and I had no trouble until this point. 

 

In any case, your calculation without the Jacobian looks like what I am expecting so maybe I do not need it  after all.

I am not sure but if you don't provide the Jacobian I guess the algorithm replaces it by some numerical methods and providing the Jacobian sure is a good idea in case of instable numerics.

I wasn't sure if the spikes were numerical artefacts which could be overcome by providing the Jacobian or if they are supposed to be there.

Yes, spikes are supposed to be there (represent earthquakes modeled as sudden slip of a block after slow build-up of force in an attached spring). In earlier versions, MathCad computed the Jacobian in a reasonable amount of time and I kept using it. I should go back and check whether including it makes a significant difference. I hope not, since it seems to take forever in the current version. 

 

As always, thanks for your help.

The calculations sure runs beyond the solve block.

Its the Jacobi calculation which seems to run "endless".

You may speed up the solve block if you delete the commands for clearung the variables mu0 to Lamda for symbolic calculations. As far as I see there is no need to clear those variables.

 

Announcements

Top Tags