Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Re: System of ODE's

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-10-2019
07:04 PM

02-10-2019
07:04 PM

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?

Labels:

11 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-11-2019
05:10 AM

02-11-2019
05:10 AM

Re: System of ODE's

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 " ' " .

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-11-2019
06:50 AM

02-11-2019
06:50 AM

Re: System of ODE's

@-MF- 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.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-11-2019
07:05 AM

02-11-2019
07:05 AM

Re: System of ODE's

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-11-2019
07:09 AM

02-11-2019
07:09 AM

Re: System of ODE's

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-11-2019
07:19 AM

02-11-2019
07:19 AM

Re: System of ODE's

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-11-2019
08:53 AM

02-11-2019
08:53 AM

Re: System of ODE's

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-11-2019
10:18 AM

02-11-2019
10:18 AM

Re: System of ODE's

@-MF- 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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-11-2019
11:47 AM

02-11-2019
11:47 AM

Re: System of ODE's

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-11-2019
04:44 PM

02-11-2019
04:44 PM

Re: System of ODE's

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.

Top Tags