when I type Integrate[Sign[x], x] to Mathematica, the answer is ∫Sign[x] dx so nothing new. When I type the same to Wolfram Alpha, I get a solved integral: http://www.wolframalpha.com/input/?i=Integrate%5BSign%5Bx%5D%2C+x%5D

Someone Any idea what to do otherwise? Would be really thankful for help!

  • $\begingroup$ Try Integrate[Sign[x], {x, a, b}] $\endgroup$ – Dr. belisarius Dec 15 '15 at 19:39
  • 2
    $\begingroup$ Or Integrate[Sign[x], x, Assumptions -> Element[x, Reals]] $\endgroup$ – Dr. belisarius Dec 15 '15 at 19:40
  • $\begingroup$ Hey Belisarius, thanks a lot for your comment! But both of it, dont return a proper integral. Integrate[Sign[x], {x, a, b}] returns ConditionalExpression[-Abs[a] + Abs[b], Re[a] < b && a == Re[a]] and Integrate[Sign[x], x, Assumptions -> Element[x, Reals]] returns a small table: -x x<=0 x True any other ideas? $\endgroup$ – Phawi Dec 15 '15 at 19:46
  • 1
    $\begingroup$ The result is correct and equivalent to the alpha result, though in a somewhat different form. ( Mathematica omits the "plus a constant" for the indefinite form, is that the issue? ) $\endgroup$ – george2079 Dec 15 '15 at 20:10
  • $\begingroup$ Hi George, yes thats the problem. Do you know, how I can change the indefinite form , in the how you call it "plus a constant form"? PS: Sorry for my english, I try my best $\endgroup$ – Phawi Dec 15 '15 at 20:13

As belisarius said in the comments, you need to assume x is a real variable:

res = Integrate[Sign[x], x, Assumptions -> Element[x, Reals]]
Piecewise[{{-x, x <= 0}}, x]

To get the result Alpha gets, we need to actually make use of an internal function that expresses piecewise function in terms of UnitStep.

Simplify[Simplify`PWToUnitStep[res] /. UnitStep[f_] :> (Sign[f] + 1)/2]
x Sign[x]

I think the real take away from your question though should really be the first part of this answer, i.e. you need to assume x is real to integrate this function.

  • $\begingroup$ ok after playing around with your solution for more than an hour I have still problems with it, but I will continue trying and Reading… Hopefully I will get a way to understand it. Thanks a lot for your support! =) $\endgroup$ – Phawi Dec 15 '15 at 23:01
  • $\begingroup$ @Phawi What seems to be the issue? Does the code not work if you copy, paste, and run it? $\endgroup$ – Chip Hurst Dec 16 '15 at 0:08
  • $\begingroup$ its working fine, but I have problems to abstract the solution. For Example I want to integrate Sign[Sin[2 \[Pi] x] Using your way: Simplify[SimplifyPWToUnitStep[ Integrate[Sign[Sin[2 [Pi] x]], x, Assumptions -> Element[x, Reals]]] /.` Result is x Sign[Sin[2 \[Pi] x]] So, now I try to verificative this, by using the defined integral function: Integrate[Sign[Sin[2 \[Pi] x]], {x, 0, 1.5}] returns 0.5 (correct) Now I try getting same result while using the in defined integral: 1.5* Sign[Sin[2 \[Pi]*1.5]]-0* Sign[Sin[2 \[Pi]*0]] returns 1.5, what is wrong $\endgroup$ – Phawi Dec 16 '15 at 14:03
  • $\begingroup$ Look at the plot here: res = Integrate[Sign[Sin[2 \[Pi] x]], x, Assumptions -> x \[Element] Reals]; Plot[res, {x, 0, 3/2}] There are jump discontinuities, and the Fundamental Theorem of Calculus requires the antiderivative to be continuous. This means you need to add a piecewise constant to your function to make it continuous before you can use FToC. Here's a great link explaining what I'm talking about. $\endgroup$ – Chip Hurst Dec 16 '15 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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