Why does Wolfram Alpha give different answers to this algebraic equation depending on how it is entered

calculatorsolution-verificationwolfram alpha

I am trying to solve the equation $Ce^{-\sqrt L t} + De^{\sqrt L t} = Ce^{-\sqrt L (t + 2m\pi)} + De^{\sqrt L (t + 2m\pi)}$ for $L$.

Here Wolfram Alpha returns the solution $m = \frac{in}{\sqrt L}$, which is easily seen to be $L = -\frac{n^2}{m^2}$, but when I add the instruction to solve for $L$, here we see WA drop the $n^2$ and return $L = -\frac{1}{m^2}$. Similarly in the more complicated solution, $n$ is missing on the second WA page.

Why is WA doing this? Is there any way to avoid the misinformation it is returning?

Best Answer

Wolfram Alpha depends on the Wolfram Language in Mathematica and it takes some getting used to the non intuitive way that Mathematica works.

Your example query

$\texttt{C*e^(-sqrt(L)*t)+D*e^(sqrt(L)*t)=}$ $\texttt{C*e^(-sqrt(L)*(t+2*m*pi))+D*e^(sqrt(L)*(t+2*m*pi))}$

to WA was interpreted as the Wolfram Language command

Reduce[C/E^(Sqrt[L]*t) + D*E^(Sqrt[L]*t) ==
 C/E^(Sqrt[L]*(2*m*Pi + t)) + D*E^(Sqrt[L]*(2*m*Pi + t)),
 {C, D, L, m, t}]

This returns essentially five different solutions. The first three are $$ L=0 \tag{1}$$ $$ C=0,\quad D=0 \tag{2}$$ $$ C\ne0,\quad D\ne0,\quad D=C,\quad L=0 \tag{3}$$ The next two depend on an integer $\,n\in\mathbb{Z}\,$ as follows $$ \sqrt{L}\ne0,\quad m=\frac{in}{\sqrt{L}} \tag{4}$$ $$ D\!\ne\!0, C\!\ne\!0, \sqrt{L}\!\ne\!0, t\!=\!-m\pi \!+\! \frac{i\pi n}{\sqrt{L}} \!+\!\frac{\log(\frac CD)}{2\sqrt{L}} \tag{5}$$ Note that for equation $(3)$ the $\,D\ne0\,$ is replaced with $\,C\ne0\,$ in the WA display.

So far so good. Now you appended "$\,\texttt{, solve for L}\,$" to your query and WA interpreted this more literally as

Solve[C/E^(Sqrt[L]*t) + D*E^(Sqrt[L]*t) ==
 C/E^(Sqrt[L]*(2*m*Pi + t)) + D*E^(Sqrt[L]*(2*m*Pi + t)),
 {L}]

Note the replacement of Solve for Reduce and the list of variables is only {L}. The two solutions returned which depend on an integer $\,n\in\mathbb{Z}\,$ are $$ L = -\frac{n^2}{m^2} \tag{6} $$ $$ L = \frac{(2i\pi n+\log(\frac CD))^2}{4(m\pi+t)^2} \tag{7} $$ As you noted, the $\,n^2\,$ is dropped from the equation $(6)$ for some reason. Similarly, the $\,2i\pi n\,$ is dropped in equation $(7)$ for some reason. Probably a bug in the WA result display. The underlying Wolfram Language code returns the correct results, but WA mangles them.

You asked

Why is WA doing this?

It is very hard to answer this because the WA system is proprietary and Wolfram does not give enough information about how to control what WA does interfacing to Mathematica. As I explained, in the first query, WA decided to use Reduce and in the second query, Solve was used. Hard to explain why it does this.

Is there any way to avoid the misinformation it is returning?

Of course, the best way is to use Mathematica's Wolfram Language directly which is possible using the Wolfram Cloud.

Related Question