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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Solving of ODE with variable parameter

fgörlich
8-Gravel

Solving of ODE with variable parameter

Hi,

I have a new problem. I want to solve a ODE-system with variable parameter. In the picture you see a minimal example.

I want solve the ODE with variable a so that i get 5 different solutions of the ODE-system. Is there a solution without to use a program? AN if I need a program, how looks it.

thanks for helping!

1 ACCEPTED SOLUTION

Accepted Solutions

13 REPLIES 13
-MFra-
21-Topaz II
(To:fgörlich)

Hi Fabian G.

Could we know what's the differential equation or is it top secret?

Werner_E
24-Ruby V
(To:-MFra-)

Why do you think its a secret?

We see the function f and the vector D, So we know which ODE system is to be solved.

Fabian already wrote that its just a very simple minimal system for demonstration purpose and the goal is not to solve THIS system, I guess, but rather find a way ro make the solution dependent from a parameter a.

-MFra-
21-Topaz II
(To:Werner_E)

... evidently I missed something ...

Werner_E
24-Ruby V
(To:-MFra-)

F.M. wrote:

... evidently I missed something ...

no problem

I fear you can't use a range variable for a and plot all resulting functions, but you sure can make the result of Radau dependent of a variable argument a.

Here is a way to do it (I changed the system a little bit to make it more interesting :):

Hey Werner Exinger

first, thanks for the help. Your solution works, but now i have a problem with units. I try to model a chemical kinetic. Here i give a simply form of it.
It is a first order reaction combined with the arrhenius combination to find a solution for the reaction temperatur X_1 and mol X_0. THerefore i solve a material balance and energy balance. With the fuction U(t,X) i want to simulate a cooling failure. That means at a specific time point a, the cooling is stopping (With Cooling U(t,X)=5, with cooling failure U(t,X)=0).

without units it works fine: (i choose some random number to see something) So know i have a cooling failure after 150 and 400.

with units i get this

-MFra-
21-Topaz II
(To:fgörlich)

Hi

there must be an inconsistency in the measurement unit:

example 25317.jpg

assuming that there are 5000m ^ 2, we get:

example 25317-1.jpg

ViktorKorobov
13-Aquamarine
(To:-MFra-)

See a picture:kinetics problem.png

Viktor

Thanks that was the problem. It is great how fast and good the help in this community is.

Thanks for this comment Fabian!

As the Community Manager, this makes my day - as you have seen there is a wealth of knowledge within.

Thank you Fred KohlheppWerner ExingerFrancesco MezzaninoViktor Korobov

Best,

Toby

> Your solution works,

I seems to me that you are using the solution of Fred, who answered first. But mine is quite similar.

Additionally to what FM and Viktor had said it looks like the arguments of your function Ans() should not be unitless but be of dimension time because in U() you compare them with t, which has dimension time.

Furthermore, while I guess its not mandatory, to be on the safe side and for consistency, the "0" in your if-command of function U should get explicitly the same units as U.

And then I think its not a good idea to use the same name U for the constant and the local function U, which uses the constant U.

Note, that FM had dealt with all of the above said in his second picture.

I am still not sure why FM's second pic is not showing the same as your unitless approach. The minus sign which Viktor had pointed you to is missing in both, so the output should be similar.

As I am Prime-less at the moment I can only judge from the pics, so maybe I am missing something.

EDIT: Ah, I guess the difference is because of the 50° C. If you use 50 K instead (or 323.15 instead of 50 in your unitless variant) I guess you will get a similar result. Can't check it though.

If you really need to plot all functions for a set of given parameters with just one command (and in all the same color) you can call the function DGL from my last post with a vector (not a range) as argument and use small routine to separate the various result vectors and create a suitable data structure:

Top Tags