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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

SYMBOLIC Differential Equation and System of Differential Equation

Cornel
19-Tanzanite

SYMBOLIC Differential Equation and System of Differential Equation

Hello,

 

There is a function that can solve SYMBOLICALLY a differential equation and a system of differential equations automatically in Mathcad?

 

Or at least, how can I solve SYMBOLICALLY a differential equation or a system of differential equations (automatically) in Mathcad? But without using manually Laplace Transform for each term or Odesolve(-numeric/graphic), but rather something automatically...if exist...

 

Thank you.

44 REPLIES 44
Werner_E
25-Diamond I
(To:Werner_E)

Maybe my reply was done too fast.

It looks like your sheet is working OK despite of the errors noted.

I attach a pdf print of your file after recalculation and after separating the overlapping regions.

Nice work, indeed!

LucMeekes
23-Emerald III
(To:Werner_E)

Ha, that's nice. Thanks for checking.

Now on to, task 2:

I have one implementation in Mathcad 11 that allows:

LucMeekes_1-1600200304455.png

And on the other LODE it returns:

LucMeekes_3-1600200998962.png

So I guess it's done.

Well, almost... I'd like to make sure that the coefficients of the derivatives don't contain the independent variable. Because if they do, you get the wrong answer. Prof. Birkeland's polynome does not account for that, and I'm certain it's not easy to implement support for it..

Example:

LucMeekes_4-1600201181959.png

this is not the solution.

 

In the attached file is a routine GetODEparts, with some examples next to it.

Please check if it runs in Mathcad 15. These are the expected results:

LucMeekes_5-1600201431255.pngLucMeekes_6-1600201440193.png

Thanks,

Luc

Werner_E
25-Diamond I
(To:LucMeekes)

Looks good, here's the pdf

LucMeekes
23-Emerald III
(To:Werner_E)

Thanks!

Does not look good, unfortunately. The result on Page3 does not meet my expectations.

The P1 and P5 values are OK.

The result for F1 should be just sin(x) and should NOT include any (derivative of) y_(x).

Similarly for F5, it should only be exp(tau).

Apparently MuPad, when requested to provide the coefficients for y_(t_), includes the derivatives of y_(t) with the other stuff that's not dependent of y_(t_). Maple doesn't do that:

LucMeekes_0-1600277196415.png

(Where -1 is the coefficient of u(x), and -sin(x) is everything independent of u(x))

Though I must say, I can't blame MuPad for doing that. It may be the correct answer.

But it does mean that it's going to be harder to filter the particular function out of the LODE expression.

Does Mathcad 15 provide for a symbolic lhs() function (That takes the left-hand-segment of an expression, everything that is to the left of := or =  ) and the rhs() function (or symbolic keyword)? If that's the case, it may be possible to supply the LODE as:

LucMeekes_1-1600277471755.png

and do:

LucMeekes_0-1600290619167.png

 

If not, the differential equation solver function will (need to) require that the particular function is supplied as a separate argument (as it does in Prof. Birkeland's function).

 

Luc

 

Werner_E
25-Diamond I
(To:LucMeekes)

I see the problem and I fear that Mathacd does not provide a LHS or RHS function/operator (similar to numer() and denom()). I would have needed them quite a couple of times when trying to automate the manipulations of an equation.

And you are correct about the working of the coeffs keyword and I, too, think that is correct from a math point of view. On the other hand - its wrong if u(x)=exp(f(x)), for example 🙂
Its not possible to give a correct result without knowing u(x), in fact.

LucMeekes
23-Emerald III
(To:Werner_E)

Now I wonder if this works.

 

Please check attached.

 

Luc

Werner_E
25-Diamond I
(To:LucMeekes)

Clever!

Seems to work OK.
Here's the pdf

LucMeekes
23-Emerald III
(To:Werner_E)

Hello @Werner_E ,

can you please convert the two files to (Mathcad 15) .xmcd files, check if the functions still work, and then attach them in a reply?

 

Thanks!
Luc

 

The final result is posted here:https://community.ptc.com/t5/PTC-Mathcad/Solving-Ordinary-Differential-Equations-symbolically/m-p/689336#M192090

Werner_E
25-Diamond I
(To:LucMeekes)

Fine work! Sure something to keep in ones toolbox.

Find attached the two files converted to MC15 *.xmcd and also the pdf print of the example file.
I had to vertically separate the regions in the LM_... file so they won't overlap.

 

LucMeekes
23-Emerald III
(To:Cornel)

It's done:

LucMeekes_0-1601242519464.png

LucMeekes_1-1601242538317.png

Now neat it up and transport to Mathcad 15.

 

Luc

LucMeekes
23-Emerald III
(To:LucMeekes)

@Werner_E 

Can you check if this works in Mathcad 15 with similar results to Mathcad 11 (pdf attached).

If it does work, please save both files as .xmcd.

 

Thanks
Luc

 

Werner_E
25-Diamond I
(To:LucMeekes)

Unfortunately ODE systems don't work. The error message is an less helpful "pattern match exception".

 

LucMeekes
23-Emerald III
(To:Werner_E)

Hmm, now it becomes tapping in the dark.

 

Please try the attached.

 

Luc

Werner_E
25-Diamond I
(To:LucMeekes)

Sorry! Same error again.

LucMeekes
23-Emerald III
(To:Werner_E)

Installed a trial of Mathcad 15 and found out that, where this is posible in Mathcad 11:

LucMeekes_0-1602694622719.png

Mathcad 15 is more restrictive:

LucMeekes_2-1602694787367.pngLucMeekes_3-1602694816566.pngLucMeekes_4-1602694851303.png

The issues are resolved now, and the result is posted in https://community.ptc.com/t5/forums/replypage/board-id/PTCMathcad/message-id/192090.

 

Luc

Announcements

Top Tags