Skip to main content
1-Visitor
March 23, 2022
Question

Multiple ODE's in MathCad

  • March 23, 2022
  • 5 replies
  • 6477 views

Hi guys,

 

I have a question..

I modelled a 4th oder ODE in MathCad which works smoothly..

But when I tried to upgrade the script into (a system of ODE’s) 3 or 4 ODE’s, I couldn’t get it well working.

 

Note that I checked the boundary/matching conditions and they are correct. So something else could be wrong.

 

I’ve included the file in the mail.  

 

Would you like to help me here?

 

Thanks in advance!

 

5 replies

24-Ruby IV
March 25, 2022

The Odesolse finction cannot work with a boundary problem.

For this there are others tools. The Shot method for example (a programming). Or the bvalfit etc function.

  

 

1-Visitor
April 8, 2022

Dear Valery,

Could you help me with an example?

I'm not sure how the bvalfit works..

Thnx in advance

24-Ruby III
April 17, 2022
19-Tanzanite
April 28, 2022

Attached is an attempt using the shooting method.  I've split it into two sections; one from x = 0 to x = s1, and one from x = s1 to x = L, matching the specified boundary conditions at x = s1.

Unfortunately, it doesn't get one of the final boundary conditions correct (that for W``(L)).

Alan

 

 

 

1-Visitor
April 29, 2022

Dear Alan,

I would like to thank you very much for your help, at least I'm a step further now.

 

 

1-Visitor
May 11, 2022

Hallo Alan and everyone,

 

Firstly, thank u Alan and eveyone who gave his time for this.

 

Idon't know how to work with guesses and I don't even understand it.

But also a question, I thought I know the exact values for the boundary/matching conditions, so why do we need guess values?

Maybe I lack the experience here, but previously I used to program similar models in Maple but here (in MathCad) it does'nt work..

 

Any Idea?

 

Thanks in advance

 

25-Diamond I
May 11, 2022

This solution might not be satisfactory as it does not use a solver for a differential equation, but at least its a solution.

 

You are asking for two polynomials of fourth order which are zero at 0 and s1 resp. s1 and L, have their second derivative at 0 resp. L to zero and have matching first and second derivatives at the joint position s1.

Actually this means 10 conditions for 10 variables (the coefficients of the polynomials) which you can either solve using the symbolic solver or using a numeric solve block. Of course, as we know the fourth derivative of both functions being q/EI we could set the coefficient of x^4 in both functions to q/(24 EI). But I decided to let Mathcad do the job 😉

Here is what Mathcad came up with

Werner_E_0-1652295973509.png

As you can see, the necessary conditions are met (apart from minor numerical inaccuracies):

Werner_E_2-1652296192498.png

 

i still have no idea how to get odesolve to come up with this solution, though.

 

MC15 sheet attached

25-Diamond I
May 11, 2022

So here is a method which uses odesolve - unfortunately still not the "natural" way.

First we use a separate solve block with "odesolve" for U and for W and turn it into a function of the value d2 of the second derivative at x=s1.

Werner_E_0-1652300534267.png

 

The only condition not met when we calculate the functions using the same value for d2 is that we also want the first derivatives at s1 to match.

So we define a function to calculate the difference of the first derivatives at s1 for any value of d2

Werner_E_1-1652300621417.png

and use it in a solve block with "find" to iterate the values of d2 until we arrive at a value where the first derivatives are equal.

Werner_E_2-1652300674465.png

Werner_E_3-1652300697082.png

Wish it would work in one go basically the way you had set it up, but it looks like Mathcad isn't capable enough to do so. However, I would be happy to be proven wrong.

Mathcad15 worksheet attached

 

1-Visitor
May 16, 2022

Hi mate,

 

How wonderful is this update..

Thanks so much for your time and efforts 

I'll check it and let u know.

ME_10255445_1-1652698980886.jpeg

 

Thx,

 Mohamed 

23-Emerald IV
May 20, 2022

With reference to https://community.ptc.com/t5/Mathcad/Toolbox-Solving-Ordinary-Differential-Equations-symbolically/m-p/689336#M192090

Your system of 2 ODE's can be solved as follows:

LucMeekes_0-1653059279080.png

LucMeekes_1-1653059293827.png

LucMeekes_2-1653059303554.png

LucMeekes_3-1653059311780.png

LucMeekes_4-1653059321816.png

LucMeekes_5-1653059331906.png

LucMeekes_6-1653059356880.png

Note that the value of d2 is:

LucMeekes_7-1653059409742.png

which corresponds to what @Werner_E found.

 

If you want to run this in Mathcad 15, be sure to take the proper LODEsolve reference file,

you need to replace the LODEsolve.mcd with LODEsolve.xmcd

 

Success!
Luc

 

23-Emerald IV
May 20, 2022

Oh, and in case you wonder if it can be done with three sections...

Hoping/assuming I have set the proper initial/boundary conditions, here goes:

LucMeekes_0-1653062112084.pngLucMeekes_1-1653062119103.pngLucMeekes_2-1653062131381.png

LucMeekes_3-1653062139326.png

LucMeekes_4-1653062165664.png

LucMeekes_5-1653062189827.png

LucMeekes_6-1653062217272.png

And in case you're wondering about d2 and d3... they are 0.1 each. That is respectively:

LucMeekes_7-1653062337284.png

 

The Mathcad 11 file is attached again.

Success!
Luc

 

 

1-Visitor
June 7, 2022

Dear Luc,

 

Thank you very much for this amazing effort. I appreciate it 

 

Just one issue.. when I download your files, they don't run (calculate). That graph above doesn't plot any outcome! 

I see the screenshot you included, so I know it should work but maybe it has to do with the version I'm working with (MathCad 15)..

 

Any idea how I can get out of this dilemma?

 

Thanks in advance 🙂 

 

23-Emerald IV
June 7, 2022

Yes. How about pressing the [F9] key every now and then, to calculate the sheet up to the point where it's being displayed. Or press [Ctl-F9] to calculate the entire sheet...

I generally have Autocalculation switched OFF in my files. That way I can edit the expressions without being hampered by Mathcad trying to calculate every change I make, and slowing down my editing.

 

Success!
Luc