Message Boards Message Boards

Changing free variable for a Function that results from NDsolve

Posted 3 years ago

Hi There I'm trying to use Inverse function result from NDSolve, the inverse works, but when i'm trying to re-define the free variable as function of another variable(time) in order to solve a new ODE, and im' getting some errors. im not sure i change variable the right way Thx Ezra

Attachments:
POSTED BY: Ezra Kohavi
7 Replies
Posted 3 years ago

understood and thank you for your time and affort Ezra

POSTED BY: Ezra Kohavi
Anonymous User
Anonymous User
Posted 3 years ago

" in the end - many more things must be checked still I feel". my concern is that this problem is not well suited to NDSolve except with deeper knowledge of method used and actual error. you asked about only use of Inverse and whether NDSolve would accept a symbolic inverse or would demand a real inverse.

tenenbaum, p. 562, series solutions to nonlinear ODE of order greater than one - this method requires that the usable convergence interval, I: |x-x0| < min(r, r/((n+2)M)) be found and respected

POSTED BY: Anonymous User
Posted 3 years ago

Please disregard the previous file i send u. I noticed that i was doing something wrong, the ODE equation took the time as the series expansion of of the inverse and should be h. Also my new boundary condition was too large. But what i can see that there still an issue solving the secondry ODE with time

Attachments:
POSTED BY: Ezra Kohavi
Posted 3 years ago

Thank you again for all the help. I went back and revised the initial condition to something that might work and use your latest code. Also be aware that I'm looking for only a Real solution. The problem with this solution is that the Series expansion works on smooth function, but this is a warm-up problem to a more difficult problem where the S(x) inverse is extremely stiff, and steep. I attached the revised file with a "better" more physical boundary condition with your modification. Please let me know if you have other ideas for a stiff one? It seems to me that that problem of using a function results from NDSolve to solve a secondary ODE equation should be used by others.

Attachments:
POSTED BY: Ezra Kohavi
Anonymous User
Anonymous User
Posted 3 years ago

I've found a problem however when checking my work: I cannot get

RR = InverseFunction[(Normal[Series[S1[x], {x, 0, 5}]] /. x -> #) &]

To "Inverse again back to S1" (not at the moment) - and I suspect that it may mean RR is "not usable". I found the below to be more believable...

RR = InverseSeries[Series[S1[x], {x, 0, 5}]];
(* the above re-inverses back to S1 in a "same plot" manner *)
G[t_] := g'[t] - ((Normal[RR] //. x -> #) &[t])/6 + 2*g[t]^2
NDSolve:  At t == 1.1`, step size is effectively zero; singularity or stiff ?
InterpolatingFunction[ . , Domain{{1.1, 1.1}}, scalar ]

I'm sorry I didn't check my steps more thoroughly the first time (i checked them but too briefly). But in the end - many more things must be checked still I feel, before the answer is usable (such as stiffness NDSolve mentioned).

POSTED BY: Anonymous User
Anonymous User
Anonymous User
Posted 3 years ago

NDSolve::ndnum: Encountered non-numerical value for a derivative at t == 1.`.

Problem 1. This will not work. See Help, Scope, example 1 (v. 12.1) S1=InterpolatingFunction[...] S1[0]=scalar InverseFunction[S1]

Fix 1: RR = InverseFunction[(S1[#]) &]

Problem 2: InverseFunction does not find an inverse. Therefore you cannot use it in NDSolve. You might alter S1 strategically so that InverseFunction can find an inverse. For this you need to expand S1 into a series.

Problem 3: RR does not contain h, so h on the left cannot be replaced with the right. RRnew = RR /. h -> Function[t, g[t]]

Problem 4: NDSolve won't solve unless function a[t] is less nebulous.

In[88]:= eqn = 0 == g'[t] - a[t] g[t]^2
Out[88]= 0 == -a[t] g[t]^2 + Derivative[1][g][t]
In[89]:= NDSolve[{eqn, g[1] == 0.1}, {g[t]}, {t, 1, 10}]
During evaluation of In[89]:= NDSolve::underdet: There are more dependent variables, {a[t],g[t]}, than equations, so the system is underdetermined.

A proposed solution (noting I am unfamiliar with the meaning behind the equations and do not state solutions are not lost):

RR = InverseFunction[(Normal[Series[S1[x], {x, 0, 5}]] /. x -> #) &]
(* note RR[domain] has infinity at R[1], is Complex valued *)
ComplexListPlot[Table[RR[x], {x, 1, 10}]]
(* (i assume) a diagonal line with +slope in complex plane *)
G[t_] := g'[t] - (RR[t])/6 + 2*g[t]^2
eqn = 0 == G[t]
sol=NDSolveValue[{G[t] == 0, g[.99] == 0.099}, g, {t, 1.1, 10}]
InterpolatingFunction[...]
ComplexListPlot[Table[sol[x], {x, 1.1, 10}]]
(* a short diagonal rise over [.03,.05] and a horizontal run *)
(* axis is roughly: Interval [.03,.1] + Interval [-10^(-17),-10^(-16)] i *)
POSTED BY: Anonymous User
Posted 3 years ago

Thank you, it is working. Should I be worried about this msg that I got when I run the new code? Inverse functions are being used. Values may be lost for multivalued inverses. Ezra

POSTED BY: Ezra Kohavi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract