Skip to main content
10-Marble
March 2, 2014
Solved

Solving an ODE with nested functions

  • March 2, 2014
  • 1 reply
  • 4834 views

Attached is my MathCad Prime 3 worksheet. The ODE solve block is not producing an answer can someone look at this example and explain to me why or how? Maybe I have not specified h(t) correctly but all plots seem OK!

Thanking you in advance,

Mark

Best answer by Werner_E

Mark, I never bothered to look at your sheet at a whole or to consider what you trying to calculate and how. I just looked at an odesolve block which didn't work or an integral which supposedly yields wrong units and attempted to find the reason for it in terms of math and Mathcad. In both cases in some way the cause was wrong usage of units. Being able to use units in calculations is a great plus of Mathcad and doing so can show us pretty soon in the calculation steps that we have an error. Thats the reason I was suspicious and doubted the correctness of the used formulas when we began to mess aoround adding units here and there just to make the whole calculation work in Mathcad on an abstract level.

As a first step the math model of the problem to be solved has to be correct, then we can try to use Mathcad as a tool to deal with the math. Only adding units and using different variables just because this makes Mathcads unit consistency check happy simply made me a bad feeling and was the only reasons I doubted the results. So I suggested to go back to the beginning and check the math model again for plausibilty.

1 reply

25-Diamond I
March 2, 2014

1) Q is used as a function of length in that solve block, but Q is not a function but a constant with unit L/sec.

2) You have to write depth:=odesolve(... instead of depth(t):=...

10-Marble
March 2, 2014

Werner;

Thanks Werner, if only I had your math ability. I realised that it is not Q but rather Qout that I am interested in. Q as you say is a previously defined constant. But Qout is actually also a function of Ht,t and V or the nested function Qout(Ht(t),V) but if you multiply the Ht(t),V you get units of s^3 or if you include t then units are s^4, which is not correct. Qout as you say should be in units L/s. Somehow I think I must relate Ht(t) and Q directly but I thought this is what the ODE was attempting to do but its seems not to be the case. The solve block dosen't like Qout(Ht(t),V) or for that matter Qout(Ht(t)). Maybe I have just lost the plot here as I am a bit tied today. Also I don't understand why just the depth variable is depth also a funtion of t i.e. not depth(t) but have have changed it as recommended but still no joy?

King regards, Mark

25-Diamond I
March 2, 2014

Also I don't understand why just the depth variable is depth also a funtion of t i.e. not depth(t)

Thats the syntax of "odesolve()", look it up in the help and expamples.

When you use this function later in the plot or elsewhere, ocourse you have to add the argument. writing ht(t) or Ht(5s)= or whatever.