I was trying to obtain this result:
integrate e^|x| dxThe result is
$$ \int e^{|x|} dx = \frac12 e^{-x} \left( (e^x-1)^2 \operatorname{sgn}(x) -2e^x +e^{2x} - 1 \right) \color{gray}{\,+ \text{constant}} $$
which is fine but I would like to see the 2 part solution for $x>0$ and $x<0$, I know you can see that because just after before the final output I can see it but then it switches to the one line solution above. Is there a way to see the other solution?
If it's not ok to ask about a tool used in mathematics I'm sorry. You can close it.
$\endgroup$ 32 Answers
$\begingroup$Apparently, giving the input
Integrate[Exp[Piecewise[{{x, x > 0}}, -x]],x]
to WolframAlpha returns a piecewise result, which may be what you're expecting.
$\endgroup$ $\begingroup$You can use the following to get the two cases:
Assuming[t>0, integrate e^|x| dx from x=0 to t]
Assuming[t<0, integrate e^|x| dx from x=0 to t]Or, if you don't care about choosing the constant of integration such that the two pieces fit together, simply:
Assuming[x>0, integrate e^|x| dx]
Assuming[x<0, integrate e^|x| dx](although then it's so easy that I don't see why you would need Wolfram Alpha).
$\endgroup$ 6