# finding solutions with exponential series expansion

Hi, I couldnt recall how to solve the following for t

0.111t = 1- e^(-0.3t) . (The ans is t=8).

Thank you in advance !! Mich

finding solutions with exponential series expansion

asked **
2018-11-22 16:53:33 -0600
**

Anonymous

Hi, I couldnt recall how to solve the following for t

0.111t = 1- e^(-0.3t) . (The ans is t=8).

Thank you in advance !! Mich

add a comment

2

The steps (and graphs !) of this solution are available in Sagecell

Let's see. We suppose for now that this equation is to solve in reals :

```
var("t", domain="real")
Ex=0.111*t-(1- e^(-0.3*t))
```

We note an "obvious" root :

```
Ex.subs(t=0)
0
```

Is there an explicit solution ?

```
Ex.log_expand().log().solve(t)
[t == 1000/111*(2*e^(3/10*t) - 1)*e^(-3/10*t)]
```

No such luck : this is an implicit solution, no more informative than the original equation. Let's try a numerical solution. What is the shape of the representative curve of this expression ? A curve with a minimum around about 3, null at 0 and about 8, decreasing below 3 and increasing above 3 (see Sagecell). What can we prove ?

The first derivative is

```
Ex.diff(t)
-0.300000000000000*e^(-0.300000000000000*t) + 0.111000000000000
```

An increasing curve, null about 3. Can we prove that ? The second derivative is

```
Ex.diff(t,2)
0.0900000000000000*e^(-0.300000000000000*t)
```

Yay ! This is strictly positive for all reals. Therefore, the zero we "see" on the first derivative at about 3 is the only one, and is

```
Ex.diff(t).solve(t)
[t == 10*log(1/37*100^(1/3)*37^(2/3))]
Ex.diff(t).solve(t)[0].rhs().n()
3.31417424447956
```

Now we have *proven* that Ex is decreasing before this zero and increasing after that. At the minimum, it is :

```
Ex.subs(t==Ex.diff(t).solve(t)[0].rhs()).n()
-0.262126658862769
```

Since it is negative at this point and not upward bound (exercise for the reader : *prove it !*), it has two roots, one (0) being already known. The graphs suggest that Ex is positive for t=10. Let's try to find a numerical solution :

```
Ex.find_root(0.1,10,t)
8.25101463236195
```

which is the sought answer.

Left to the reader : what are the *complex* roots (if any...) ? Fair warning : this one is *much* harder than the real case (bound to problems open since the XIXth century, and still not solved...).

**EDIT :** It turns out that Sympy can give us the non-trivial real root in symbolic form :

```
sage: import sympy
sage: sympy.solve(Ex, t)
[10*LambertW(-100*exp(-100/37)/37)/3 + 1000/111,
10*LambertW(-100*exp(-100/37)/37, -1)/3 + 1000/111]
```

The numerical values are as expected :

```
sage: [s.n() for s in sympy.solve(Ex, t)]
[8.25101463236202, 0.e-123]
```

This function is known to Sage, but the conversion is incorrect (loses the second argument)

```
sage: [s._sage_() for s in sympy.solve(Ex, t)]
[10/3*lambert_w(-100/37*e^(-100/37)) + 1000/111,
10/3*lambert_w(-100/37*e^(-100/37)) + 1000/111]
```

This is now Trac#26752

1

The value `8`

is not a solution, but there is a solution
whose approximate solution is 8.2510146...

Here are some ways to work on solving this equation.

Define `t`

as a symbolic variable in the symbolic ring,
and call `eq`

the equation.

```
sage: t = SR.var('t')
sage: eq = 0.111*t == 1-exp(-0.3*t)
```

Try to solve with `solve`

: unfortunately, Sage returns an
equation which is equivalent to the equation we started with.

```
sage: solve(eq, t)
[t == 1000/111*(e^(3/10*t) - 1)*e^(-3/10*t)]
```

Use `find_root`

to find an approximate solution between 5 and 10.

```
sage: eq.find_root(5, 10)
8.251014632362164
```

or

```
sage: find_root(eq, 5, 10)
8.251014632362164
```

The computation above is done using floating-point computations and it is not clear which digits are exact.

For a computation using arbitrary precision, use the `mpmath`

library:
define a function equal to the difference of the left-hand side and
the right-hand side of `eq`

and use `mpmath.findroot`

to look for a
root near 8:

```
sage: import mpmath
sage: mpmath.findroot(lambda t: 1 - exp(-0.3*t) - 0.111*t, 8)
mpf('8.2510146323620207')
```

See the answer by @Emmanuel Charpentier for how to use SymPy to get an exact solution in symbolic form. It is likely Giac or FriCAS could do it too.

Neither Fricas nor Giac can solve this symbolically :

```
sage: giac("solve(111*t/1000-(1-exp(-3*t/10)),t)")
list[-6.76523232004e-14,8.25101463236]
sage: fricas("solve(111*t/1000-(1-exp(-3*t/10)),t)")
[]
```

Mathematica gives an answer subsuming Sympy's and asserting the existence of an infinity of (complex) solutions :

```
sage: mathematica("Reduce[111*t/1000==1-Exp[-3*t/10],t]")
(Element[C[1], Integers] &&
t == 1000/111 + (10*ProductLog[C[1], -100/(37*E^(100/37))])/3) || t == 0
```

(Reformatted from Mathematica's help) :

```
ProductLog][z]
gives the principal solution for w in z == w e^w.
ProductLog[k,z]
gives the k^th solution.
```

From Sage's `lambert_w?`

:

This function satisfies the equation

```
z = W_n(z) e^{W_n(z)}
```

Same difference...

Asked: **
2018-11-22 16:53:33 -0600
**

Seen: **66 times**

Last updated: **Nov 23 '18**

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.