Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question
    
Well, you can derive it yourself; $\mathrm{sgn}(x)$ is expressible as a piecewise function. –  J. M. Sep 3 '10 at 20:10
    
I cannot see what you are asking here... «The other solution» is the same as the solution you have. –  Mariano Suárez-Alvarez Sep 6 '10 at 15:07
    
btw, Wolfram Alpha uses Mathematica as a backend, you may need to use Mathematica syntax to get more advanced things out of it –  Yaroslav Bulatov Sep 6 '10 at 16:35

2 Answers 2

up vote 6 down vote accepted
+50

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.

share|improve this answer

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

share|improve this answer
    
I'm playing with the tool :D I was testing something "complicated" from the point of view of the tool, not the math, to see how flexible it is. –  dierre Sep 4 '10 at 8:06
    
BTW nice workaround but since I see the solution I want just before it switches on the one line solution, I would like to see the 2part solution without giving it a restraint on the variable. –  dierre Sep 4 '10 at 8:11
    
What do you mean by "seeing the solution"? For me, Alpha just spits out the answer that you quoted in the question. (No "switching" going on.) –  Hans Lundmark Sep 4 '10 at 9:44
    
There's a tiny moment, it's a one second switch. Clear your cache, maybe that's the problem. Or try with integrate e^-|x| dx which has a slower process. –  dierre Sep 4 '10 at 9:59
    
Nope, didn't make any difference. Well, never mind... –  Hans Lundmark Sep 4 '10 at 12:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.