# Finding roots of a function with a varying parameter

So I'm brand new to Mathematica, and basically what I want to do is find the roots of a function at varying time intervals.

The function I'm using is:

a[t_] = -(E^(((0.057 m t)/(m + 0.013)))/(10^5 1.66)) + m - 10


Where t is a range of values from 0 to 500 with an interval of 10. I want to find the values at which the function is zero at each individual time step.

How can I do this?

I've been playing with the program but it keeps giving me an error such as,

FindRoot::nveq: The number of equations does not match the number of variables in FindRoot[%==0,{m,0}]. >>

• Please, add any relevant code, but keep it simple, e.g. a minimum (non)working example – Sektor Feb 19 '15 at 21:49
• Reduce[Rationalize@-(E^(((0.057 m t)/(m + 0.013)))/(10^5 1.66)) + m - 10 == 0] /. C -> 0 – Dr. belisarius Feb 19 '15 at 22:02

r = Reduce[Rationalize@-(E^(((0.057 m t)/(m + 0.013)))/(10^5 1.66)) + m - 10 == 0]
/. C -> 0 // ToRules


Then you can either look at the rotated inverse plot:

Plot[t /. r, {m, 1, 100}] Or if you want to spend some time, ask Mathematica to compute it:

f[m_] := Evaluate[t /. r]
Plot[InverseFunction[f][m], {m, 11, 100}] • Hey there, thanks for the response. I was able to get it to work. I'm a little confused as to why you had to go through the reduce and rationalize steps. Is this one of the limitations of Mathematica or is it just the easiest way you've found to do this? – Zach Feb 20 '15 at 0:16
Clear[t, f, m]
pts = Table[t, {t, 0, 500, 10}];
sol = {#, m /. First@NSolve[-(E^(((0.057 m #)/(m + 0.013)))/(10^5 1.66))
+ m - 10 == 0, m, Reals]} & /@ pts;
Grid[Join[{{"t", "solution"}}, sol], Frame -> All] You are basically trying to solve an implicit equation for m[t]:

eqn = -(E^(((0.057 m[t] t)/(m[t] + 0.013)))/(10^5 1.66)) + m[t] - 10 == 0;


One possible approach is to cast this as an ODE and to use NDSolveValue. To do this we need an ODE:

D[eqn, t] //TeXForm


$$m'(t)-\left(6.0241\times 10^{-6}\right) e^{\frac{0.057 t m(t)}{m(t)+0.013}} \left(-\frac{0.057 t m'(t) m(t)}{(m(t)+0.013)^2}+\frac{0.057 m(t)}{m(t)+0.013}+\frac{0.057 t m'(t)}{m(t)+0.013}\right)=0$$

and an initial condition:

m == 10;


sol = NDSolveValue[{D[eqn, t], m == 10}, m, {t, 0, 500}];


Visualization:

Plot[sol[t], {t, 0, 100}] Or tabular form:

TableForm[
Table[{t, sol[t]}, {t, 0, 200, 10}],
`
$$\begin{array}{cc} \text{t} & \text{solution} \\ 0 & 10. \\ 10 & 10. \\ 20 & 10. \\ 30 & 10. \\ 40 & 10.0001 \\ 50 & 10.0001 \\ 60 & 10.0002 \\ 70 & 10.0003 \\ 80 & 10.0006 \\ 90 & 10.001 \\ 100 & 10.0018 \\ 110 & 10.0032 \\ 120 & 10.0056 \\ 130 & 10.0099 \\ 140 & 10.0174 \\ 150 & 10.0308 \\ 160 & 10.0544 \\ 170 & 10.0961 \\ 180 & 10.1698 \\ 190 & 10.3002 \\ 200 & 10.5306 \\ \end{array}$$