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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

My first Diff Euq. - who can help?

wschrabi-disabl
1-Newbie

My first Diff Euq. - who can help?

Dear experts,
here is my first diff equ trial to solve the diff euq. accoring to the attached paper. Even I have studied the Qs I have no idea who it can be done. Can anyone help me to setup a working sheet?
I can supply measurement data for the fitting.
Basically only the model is wanted, as this two-compartment model can then be used in the fitting sheets from jmG.

I would be very thankful for any comments.
76 REPLIES 76

>I can supply X and Y data from the measurement <.
_________________

Desperately needed !

jmG

dear jmG, here my latest worksheet, where I could copy a final solution of the two-compartment model. But I do not know how I can solve the diff.-equation with MathCAD. I would be very thankful if you could show me how it is done. It might be the same solution, as I copied the formular from ModKine, where the 2-comp. model was implemented (with a y=f(x) formular.)


Moreover I could happily found that the model parameters were the same as in ModKine.





One other question is the correlation coeff. IN Modekine there is one mentened, but I do not know (the book from where it was written will be in my hand mid March) if this corr coeef. is the sam as you explained.

I noticed Tom has already started working on the DE. While cutting/pasting the part of the paper my computer crashed and now it won't even open the saved *.PDF. Whatever: the Mathcad corr(,,) is the Parson 'r'. ModKine is incorrect but can't be traced. Their coefficients are simply an "idiosyncrasy" ... why ? because the formula, i.e: the function does not involve any high accuracy mathematical constant like Pi, therefore the coefficients can't have more than 4 or 5 digits. Can you see my point ? No one is going to beat the PWMinerr that is the standard in our collab community.

The German Mathcad version screws names: I got Poise, Newton, Volt. On more involved work sheets: a pen in the ass(hole). Your work sheet is 104 KB attached. When you copy an image at image resolution of 17 millions colors, that makes a huge size. You should download IrfanView (freeware) and reduce the colors, here the image is reduced to 16 levels and same quality for reading.

Back to download again your *.PDF for the DE.

jmG



A standard type problem, done many times in the collaboratory.

There are a number of ways to solve differential equations in Mathcad, for this one I would use rkadapt. But ...

You need at least guess values for the values you are trying to estimate to get anywhere.

Your variables are t, x1, and x2. Values of some unkown X and Y variables are not helpful -- you need values that relate to the variables in this system.

You need better specification of the initial conditions. You've left them in terms of C1(0) and C2(0), both of which are undefined.
__________________
� � � � Tom Gutman

On 2/23/2009 4:24:06 PM, Tom_Gutman wrote:

>A standard type problem, done

>many times in the

>collaboratory.

>

>There are a number of ways to

>solve differential equations

>in Mathcad, for this one I


Is rkadapt for symbolically solving? What I would like to get is a f(x,....) in symbolically form, that I can use as model function.

>You need at least guess values

>for the values you are trying

>to estimate to get anywhere.

>

>Your variables are t, x1, and

>x2. Values of some unkown X

>and Y variables are not

>helpful -- you need values

>that relate to the variables

>in this system.



Attached in my sheet as X Y - can they be used?

>

>You need better specification

>of the initial conditions.

>You've left them in terms of

>C1(0) and C2(0), both of which

>are undefined.



Can you define some guess values for the intial conditions, until I got the real value? I would be happy if I could see how the DE is wrote correctly in MathCad. Can I use the if statement for the time condition?







>__________________

>� � � � Tom Gutman




On 2/24/2009 2:14:12 AM, wschrabi wrote:
>On 2/23/2009 4:24:06 PM, Tom_Gutman
>wrote:
>A standard type problem,
>done
>many times in
>the
>collaboratory.
>
>There are a
>number of ways to
>solve differential
>equations
>in Mathcad, for this one
>I

Is rkadapt for symbolically solving?
I also tried it in Maple 11, but I also can not interpret the solution. Is that output ok form Maple11?

>What I would like to get is a f(x,....)
>in symbolically form, that I can use as
>model function.

>You need at least
>guess values
>for the values you are
>trying
>to estimate to get
>anywhere.
>
>Your variables are t, x1,
>and
>x2. Values of some unkown X
>and Y
>variables are not
>helpful -- you need
>values
>that relate to the variables
>in
>this system.

Attached in my sheet as X
>Y - can they be used?
>
>You need better
>specification
>of the initial
>conditions.
>You've left them in terms
>of
>C1(0) and C2(0), both of which
>are
>undefined.

Can you define some guess
>values for the intial conditions, until
>I got the real value? I would be happy
>if I could see how the DE is wrote
>correctly in MathCad. Can I use the if
>statement for the time
>condition?



>__________________
>� � �
>� Tom Gutman




Your XY values are just numbers. You have provided no information as to how those numbers relate to your differential equations, and the variables therein. They could be used. In any number of ways. So could a set of random numbers. Without a specification as to what those values are, and how they relate to the variables in your problem, they are meaningless.

As to your Maple result, you appear to have misused Maple. I don't know Maple well enough to know how you should have stated the problem. But from the output it's clear that it decided to treat x2 as a known function, and solve for the unkown functions f and x1 in terms of x2. Nothing at all resembling what you want. For starters, you probably need to define f. At the very least, to tell Maple that f is to be treated as a known function. But then the result is unlikely to be in a closed form, but most likely (if found at all) involving some integrals with f in the integrand. Looking closer, not likely as along with f you've introduced another undefined variable, x. Whatever that is supposed to be.
__________________
� � � � Tom Gutman

rkadapt is a numeric solver. There are no symbolic ODE solvers built into Mathcad, only numeric ones. One can use Mathcad to assist one in what is essentially a manual solution (there is a recent thread doing this). But in general significant differential equations do not have analytic solutions. And, to a large extent, it is a waste of time to try to find such, even when they are possible. Usually numeric solutions are fast and accurate enough for the purposes.

No, I cannot generate guess values. To be useful guess values need to be reasonable. That requires an understanding of the underlying system. I don't know the system involved well enough to have any idea what reasonable values might be. And the paper is if no help, providing very little in the way of values, and many of the values they do present are presented without any units. Who knows what the actual values are.
__________________
� � � � Tom Gutman

Thank you very much Mr Gutman, spending your time to my noviced questions. I will have a meeting with Prof Estelberger in the next week problably - So I will ask him your questions.



Basically the XY are the x= time and y=f(t). I thought that would be enough to solve the ODE.



ModKine has a model function in the form of u(a,b,k21,V,x) (see my pervios worksheet) where D ist the injection DOse and V the compartment Volume. This model describes also a 2-compartment model done in Modkine, with the Modkine system parameters. My goal would be a formular based on the papers model (which describes also a 2-compartment model), so that I can substitute the ModKine formular with the papers model formular.

Could you understand it with my poor english? Do you think that this would be solveable in MathCad. Maple does support solving a ODE symbolically. (Sorry, but so far I know only from studing the quick sheets from Maple - I did not use Maple before. But also Mathematica has DSOLVE - to solve symbolically and NDSOLVE - to solve numerically)

Now I could find a book, where this problem was described. there are 5 models described, where I can now understand, that the diff equ model is not substitute for the two-compartment model (Bi-exp model). I thought I can replace the to models.
Do I understand it correctly when I say: I have one model where I have a function C (see 8:1 in the pdf) and can solve for the sys parameters and that can be fitted. And on the other hand I have a diff equ. system (see 8:9 and 8:10) which can be solved numerically and fitted again. (And so I get the model parameters again from this diff equ model.) Now something is clearer, but I still work on the fitting with the diff equ system.

"Logistic" is a wide and elastic word.
The original "Logistic" is the Verhulst DE,
that Mathcad 11.2a gladly solves symbolic.

I will try to go back on that DE from the paper.

jmG

>>Basically the XY are the x= time and y=f(t). I thought that would be enough to solve the ODE.<<

I think not. The paper shows that f is defined peicewise as two constant segments. That is not what your X and Y show. Nor do your equations involve a variable y.

Yes, the equations are trivial enough to be easily solvable. Although the solution might have to be done piecewise, to match the piecewise definition of f. Integrating over a discontinuity, whether numeric or symbolic, is always risky. Sometimes it works, sometimes it produces errors, which could be large.

The picture you attached shows a double exponential decay. Depending on the values of the various terms, that could be the solution for the paper's ODE with f(t)=0 (taking t=0 to be the time immediately after the introduction of a bolus, assumed to have been introduced instaneously, with no further infusion).

I have no problems with your English. It's your math that is giving me problems.

IAC, the XY data (once it is determined how they relate to the model variables) are not involved for solving the ODE. They are for curve fitting. The general curve fitting (parameter estimation) is that you have a function f(t;p) (usage here unrelated to the paper's definitions) where t is an independent variable and p is a set of parameters. Then you have a set of observations, ti, yi, where one should have yi=f(ti;p), and one looks for the values of p that makes this as close (in some sense) to true as possible.

This is what minerr does (when properly formulated). As far as minerr is concerned it matters not how f is defined, as long as it can be calculated at all of the reference points for any values of the parameters. It can be defined with an explicit algebraic expression, it can be defined by a system of ODEs. Other than the time for a solution, it makes no difference to the process.
__________________
� � � � Tom Gutman

Thanks a lot for your advice, Mr Gutman. I need some time to study your comment. Moreover I could rea that f(t)= Dose_injection - when assumed as constant than I can DSOLVE the ODE with Maple. Here the output. I think that is the solution of a general form. Of cource now I have to study how I can enter the ICs.(initial conditions)

Yep. That looks like a solution in a general form. I'm a bit surprised that the expression for x1 is so simple. Of course the expression for x2 would be much more usable if some common terms (like the exponentials) were collected and factored out.
__________________
� � � � Tom Gutman

Thanks a lot, now I could manage to include the ICs. Here the output. Moreover I could paste the Maple symbolic results in to the MathCad sheet.

On 2/25/2009 5:15:07 AM, wschrabi wrote:
>Thanks a lot, now I could
>manage to include the ICs.
>Here the output. Moreover I
>could paste the Maple symbolic
>results in to the MathCad
>sheet.
______________________________

Your IC x1(0) is incorrect.

The RemToDo is between Marletts, no way to escape. In order to go to the next step Minerr, we need the X2 data set, D, Tau, p. Those pieces of information, no collab can invent. They belong to the lab experiments. As son as provided, maybe < one hr modular express. It could be the DE system will show discontinuity because of the 'if', presumably the SSE model gets rid of such an annoyance. The ModKine coding didn't ring a bell.

That's the project as it stands, waiting for your input.

jmG

thanks a lot, just now my meeting with Prof Estelberger has finished and I am full and enlighted with new info. First D/Tau is the Dose in mg (f.e. 2500/ 1 min) Tau is the time of the injection duration f.e. 1 min. p is 0 because after the injection no pump is used nowadays and so no constant level of dosing input is available.

I have attached one other more delighting paper, where you can see the appendix, where the diff equ is symbolically solved and used for a more mechanistic model, where you have model parameter that have some meaning in the real life.



The fitting is done based on Eq.23 and Ea.24 (see the paper) and from that the k-parameters are calculated.

One other info for you. The Monte Carlo simulation was done in Inusoft, because to determine the +- Tolerance of the real life parameters. This +- Tolerances (or Error bar) is for the real life model as the observed y(t) are not 100% safe. y1(t1) could be different than y2(t1) in the next measurement of the patient. That debend on the heart and lung and other physiological factos. With that Monte Carlo simulation there are generated artifical y(t) to calcutlate the +- Tolerance. I hope I could repeat it correctly, after my meeting. It makes sense.
The X2 Dataset can not be measured as that the intracellulare concentration (within the cells in the body)

So we do only a fitting of X1(t).

COngratulation, your Worksheet looks really perfectly.I see now, how numerically DE-sovling can be done by MathCad.

>The X2 Dataset can not be measured as that the intracellulare concentration (within the cells in the body)<<br> ______________________

Don't understand:

In one of the previous graph, there were the blue trace and the data. And X1 depends upon X2, it is a system ... X2 data is a MUST ! OK, I can extract it but lot of work because the *.PDF graph is too messy, then must be done by hand, but why ? Too many things are not understood and assumed and too many "papers". If those papers had be written by a Mathcader, it would be neat/clear/simple/traceable in few pages. No single paper exist, they are papers of papers. The average "paper of papers" were about 100 in 1990. How many today ?


jmG

... further, what is Tau ? can't be 1 as you say . It relates to the domain but it can be anything. Shall I assume it is D/173 ?
Up until now, things haven't moved 1 mm.

jmG

... don't you have that Estlb *.PDF instead of a binder copy scanned version, not too bad but hard to read. All those things are so messy ! I can see why you are pretending the X2 data set is not needed, you don't have. But that paper and the other ones aren't the same from recollection. Can you re-post the paper where the two traces exist: the red and the blue. It will be the one I will capture and determine the X2 data.

The problem is that all threads contain something to look at it in all sorts of search and relations, and now we are at near 40. I can see Engineers don't work like doctors. You guys have no working methods, just bits and pieces of what I call "poisons". I can understand volume, time... but why is it necessary to carry from top to bottom and suddenly here is a function. There are lot and lot of missing links in that Da Vinci code.

jmG



Can you

>re-post the paper where the

>two traces exist: the red and

>the blue. It will be the one I

>will capture and determine the

>X2 data.

The paper where you can see the red and the blue data is the output from the Inusoft prg. The red funtion is not measured is calculated by the obtained model. But in the blue curve you can see the observed data points with the calculated plotted function.

Tau is the time how long the injection does take. Its unit is minutes. And D is the dose and D[mg] / injetion time [min]. At time Tau the x1(t) does not increase but only decrease accoring the e funtion.

jmG, X2 is not able to measure, it the mass transfer between the cells in the body. ONly the mass transfer x1 can be checked by the concentration of the injection in the blood.

Here are the Equs which have used to the solved DE. Prof said it was done via Eigenwert problem and you have x1(t)=f(lambda,...) where lambda is a direkt funktion from the k-values. The fitting is done on Equ 23 and Equ 24 and then the k-values are calculated. Can you follow me?

I mean in other words: Make a MinErr(N1,N2,lambda1,lambda2) to the XY data (= x1(t)) and then you have 4 unknown and 4 Equs. From that you can calculated V1 k12,k21,k01. V2=V1*(k21/k12)

But how can that be done in MathCAD? To solve a Equ.-System with 4 unknown?

Here is the MathCad Worksheet. Would you be so kind, and could you add the solving of the 4 unknown?

Will read your comments a little bit later. I tried to solve the eq sys to get the k-s from N1 N2 la1 l2. I tried it in Maple, but got []. I do know that I have 4 equs but only 3 unkown vars. But what is done wrong? Here the Maple PDF. Can this done in MathCAD too? If yes, how?

On 2/25/2009 2:01:38 PM, wschrabi wrote:
>jmG, X2 is not able to
>measure, it the mass transfer
>between the cells in the body.
>ONly the mass transfer x1 can
>be checked by the
>concentration of the injection
>in the blood.
_______________________________

No problem, I have assumed few things and now done manually. The next step Minerr is to come,

jmG

Thanks a lot, but please check my new worksheet in my last post(one previos)
Thanks

On 2/25/2009 4:30:20 PM, wschrabi wrote:
>Thanks a lot, but please check
>my new worksheet in my last
>post(one previos)
>Thanks
____________________________

No idea what you want me to check. You must admit the following: some model functions can't be minerred by no CAS, no maths. They are not commonly found except in my library. The model function that pertains to the project does Minerr with a large range of approximate values, this model is robust. It only takes a bit of experience to master it. For instance the 1rst block can take as initials ... 0.1, 1, 0, 1 and you will get the fit. The 2nd block can take ... 1, 1, -0.1, -0.1 and you get the fit. You might not always get the exact same coefficients at full numerical accuracy, but is not needed as the data set is only 4 digits, so 5 digit figures in the coefficients is plenty in that project, and it is recommended the user truncates some of them.
Generally, because the PWMinerr you are using is so powerful and robust it is not needed to TOL, CTOL otherwise than the default 0.001.
Another aspect is about the exp models: they are "reflexive" (not reflective), it means the coefficients might switch tail to end and still get the fit.

Next to meditate: this model fits this data set and as such will fit a family of data set of different experiment but of same physico-chemical nature. Attach data set of 'n' number of columns and you will get back a complete set of fitting coefficients.

The most important point you must accept is that a data set is a data set and the fitting model is a fitting model . The fitting model is a scalar transformation and the fitting coefficients belong to the model. They have no relationship with the data set except if one finds such a relationship. The model is in the scalar domain, the data set is in the measurement domain.

If you have some safe procedure to collect the relevant DE parameters, then run the DE Minerr, then crate a data set from it, then Minerr for the fitting coefficients.

Nothing in the web about InuSoft, ModKine. Proprietary software, probably not traceable except by peoples versed in decoding. For that kind of project, Mathcad is foolproof and traceable to sources.

Please, feel free to ask + questions.

jmG
Top Tags