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
Hi all,
I've a question regarding the use of the ODESOLVE function.
In the attached file, I solve a ODE with the ODESOLVE function. It did work before, but now I changed 2 paramterers:
How it was, and when ODESOLVE did work.
How it is now. I've changed all the formulaes which include PB(rb,HL) too. But now ODESOLVE isn't able to solve the system. What could be the problem?
Thank you lots for your help in advance!
I don't know why Odesolve can't find a solution to your new setup. All I can guess is that you've modified the formulae such that an unsolvable or highly unstable situation is created. Some remarks:
- You define at the top:
Then what do all these constants 9.81 in the formulae? And did you know that g (by itself) is a predefined constant in Prime?
Ah, the predefined g has units, and you work without units. You can define your variable g.rav := g/SIUnitsOf(g).
- Did you realise that with the new definition of the P.B() function your DeltaP() function becomes:
There are other simplifications possible. In some occasions you take the root of an expression, and later square it...
- You have an error in the first formula under "Formulas".
You use MW.H20, while you had defined MW.H2O. There's a difference between 0 (zero) and O (capital o).
Fortunately it doesn't matter, because this formula is not a definition, but an equation.
-You define D.H(T), but it is not a function of T (the variable T does not appear on the right hand side of := ).
Is that intentional? Same for D.C(T).
- In your calculation of v.B0, you use a formula where I think you should use the v.B() function that you defined before.
v.B0:=v.B(r.B0) = 0.277 You arrive at 0.239, because there's an extra division by 2 in your formula, that doesn't exist in the definition of the v.B() function.
- Finally you arrive at a certain function F(). Note that it is different from the right-hand-side of the differential equation you have just above "Solving the system". Other than that, if you plot that function for the middle value of your proposed range for H.L, with
you get:
If you plot it over the proposed range for H.L with the first value of r.B, you get:
Now both sorts of behaviour of such a function are not going to make Odesolve happy.
Success!
Luc
Sorry!
Why your calculation without units? Must be so! More easy for understanting ans debuging!
I can answer that question. There are two reasons:
Luc
1. g:=gm with lable units. But g is one unit too - unit of accelation. Or one constant. g=kg/1000 and g=9.8 m/s^2
2. Show please an example! if one formula can not use units - it is not quit correct formula! Me must correct it for units. One empirical formula for example!