3
$\begingroup$

I was trying to obtain this result:

integrate e^|x| dx 

The 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.

  • 0
    btw, Wolfram Alpha uses Mathematica as a backe$n$d, you may need to use Mathematica syntax to get more advanced things out of it2010-09-06

2 Answers 2

7

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.

1

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).

  • 0
    Don't worry. Tnx. It's there, I've seen that, the truth is out there.2010-09-04