My problem regards solving a differential equation and can be reduced to the problem of finding $f(x)$ such that $\frac{df}{dx}=\frac{dh}{df}$, with $h(f)$ a known function.
I have this list of data, from which I define a function myfun
via Interpolation
and enlarge its domain with Piecewise
in the following way:
mydata={{0.0000255111, 3.48715}, {0.0000497289, 3.48715}, {0.0000760032,
3.68666}, {0.000101685, 4.13102}, {0.000127819,
4.8565}, {0.000160668, 5.89031}, {0.000199871,
7.03839}, {0.000251762, 8.11573}, {0.000510537,
10.1906}, {0.000759276, 10.6694}, {0.00131224,
10.8689}, {0.00205196, 10.8689}, {0.0039503, 10.8689}, {0.00586421,
10.8939}, {0.00936259, 10.9687}, {0.0121416, 11.0684}, {0.0157784,
11.1682}, {0.0214132, 11.7097}, {0.0269805, 12.465}, {0.0329414,
13.1633}, {0.0438442, 14.3354}, {0.0542594, 15.1783}, {0.0848459,
16.9373}, {0.105548, 18.4687}, {0.12379, 20.6365}, {0.132191,
22.4652}, {0.142875, 25.3083}, {0.15004, 27.8604}, {0.159849,
31.6752}, {0.167637, 34.0867}, {0.174909, 36.6097}, {0.180292,
39.116}, {0.187948, 41.5931}, {0.199271, 43.9}, {0.209739,
46.4811}, {0.225458, 48.9749}, {0.249185, 51.8844}, {0.270797,
54.2419}, {0.294283, 56.4441}, {0.320717, 58.4715}, {0.355922,
60.696}, {0.399908, 62.9903}, {0.468012, 65.264}, {0.537837,
67.6701}, {0.651061, 70.2674}, {0.770893, 72.5252}, {0.936818,
74.8075}, {1.12961, 76.9189}, {1.39071, 79.1248}, {1.74812,
80.9415}, {2.24823, 82.6618}, {2.80845, 83.7092}, {3.61942,
84.6744}, {4.4099, 85.2231}, {5.69251, 85.5709}, {7.33036,
85.8964}, {10.4519, 86.1783}, {13.1381, 86.691}, {16.5145,
87.616}, {20.7588, 88.7737}, {26.0938, 90.4665}, {31.4639,
92.2634}, {37.1584, 94.0748}, {44.8055, 96.3118}, {54.0264,
98.3997}, {66.5137, 100.666}, {83.6078, 102.479}, {105.095,
103.924}, {140.871, 105.274}, {176.744, 105.871}, {222.168,
106.231}, {279.265, 106.498}, {351.037, 106.642}, {441.253,
106.639}, {554.656, 106.842}, {697.203, 106.887}, {870.332,
106.902}, {1101.62, 106.932}, {1384.73, 106.932}, {1740.61,
106.932}, {2187.95, 106.932}, {2750.26, 106.932}, {3457.08,
106.932}, {4345.55, 106.932}, {5462.36, 106.932}, {6866.2,
106.932}, {8630.82, 106.932}, {10393.3, 106.932}, {12043.3,
106.932}};
myfun=Interpolation[mydata];
f[x_]:=Piecewise[{{myfun[x], x <= 1000}, {myfun[1000], x > 1000}}];
Now, I want to find a new function T[t]
that satisfies this differential equation, where $f(T)$ is the function f
defined with the list of data.
$$\dfrac{1}{T}\dfrac{dT}{dt}=-\dfrac{1}{1+\frac{1}{3}\frac{T}{f(T)}\frac{df(T)}{dT}}$$
This is what I've done (the initial conditions should be reasonable for the problem I am tackling):
diffeq={T[t]'/T[t]==-1/(1+0.3*T[t]/f[T[t]]*f[T[t]]')};
NDSolve=[diffeq,T[-40]==10^10,T,{t,-40,0}];
My code fails at finding the solution and I suspect that the problem resides in how I write the differential equation. I think that nesting the function T[t]
that I want to find inside another function f[T]
(and also making a derivative of f
) drives Mathematica crazy.
How can I manage this task?
Thank you for your help!
Update, after the answer of Petrini
His method seems to work, but the error one receives is of the type
Power::infy: Infinite expression 1/0 encountered.
I have noticed that the function f
has some serious smoothness problems, a glitch of Interpolation
.
Its shape is like this:
but when you zoom in several intervals, like 10^-3,10^-2
you get this wiggling behaviour, whereas the data show a decreasing one, without oscillating.
The real problem (linked to the previous one I suppose) regards the derivative function, because if I plot f'[x]
I get something that is a complete mess:
Hence, the 1/0 error should rise from here.
So maybe the problem now is more like
How do you get rid of that problematic behaviour of the function and its derivative?