5

I am interested in simplifying expressions involving HeavisideTheta. A simple example could be:

HeavisideTheta[1 + x - x^2 + x^3]

The best I can achieve is with

FullSimplify[HeavisideTheta[1 + x - x^2 + x^3]//FunctionExpand]

but that only outputs this:

HeavisideTheta[x - Root[1 + #1 - #1^2 + #1^3 &, 1]]

Now, I know mathematica can solve the given polynomial:

In[2]:=  Solve[-1 - 2 x - x^2 + 2 x^3 + x^4 == 0]
Out[2]:= {x -> 1/2 (-1 - I Sqrt[-5 + 4 Sqrt[2]])}, {x -> 
1/2 (-1 + I Sqrt[-5 + 4 Sqrt[2]])}, {x -> 
1/2 (-1 - Sqrt[5 + 4 Sqrt[2]])}, {x -> 
1/2 (-1 + Sqrt[5 + 4 Sqrt[2]])}}

But how do I make it give me an appropriately simplified expression for the simplified HeavisideTheta?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
SarthakC
  • 195
  • 7

2 Answers2

5

As Apple alludes to in a comment, ToRadicals converts Root objects to radicals, when the roots can be expressed in terms of radicals:

ToRadicals[FunctionExpand[
  HeavisideTheta[1 + x - x^2 + x^3]]]
(* HeavisideTheta[ 1/3 (-1 + 2/(-17 + 3 Sqrt[33])^(1/3) - (-17 + 3 Sqrt[33])^(1/3)) + x] *)

It well known that not all root can be expressed in terms of radicals, so in some cases the Root objects are the best option:

ToRadicals@FunctionExpand[HeavisideTheta[x^5 - 4 x^3 + x - 3]]
(*
  HeavisideTheta[x - Root[-3 + #1 - 4 #1^3 + #1^5 &, 1]] - 
   HeavisideTheta[x - Root[-3 + #1 - 4 #1^3 + #1^5 &, 2]] + 
   HeavisideTheta[x - Root[-3 + #1 - 4 #1^3 + #1^5 &, 3]]
*)

Refs.:

Acus
  • 3,669
  • 14
  • 21
0

Ok, there's got to be a better way, but for the time being you could use the following.

First define a function f (for lack of a better name) that transforms the argument:

f[expr_] := {1, -1}.List @@ Solve[0 == expr][[1, 1]]

f[1 + x - x^2 + x^3]

1/3 (-1 + 2/(-17 + 3 Sqrt[33])^(1/3) - (-17 + 3 Sqrt[33])^(1/3)) + x

Then, you commute the function heads, so that f acts on the argument only (@ is understood as function composition):

f /: f@g[x_] := g@f[x]

What you end up with is:

g = HeavisideTheta;

g[1 + x - x^2 + x^3]//f

HeavisideTheta[ 1/3 (-1 + 2/(-17 + 3 Sqrt[33])^(1/3) - (-17 + 3 Sqrt[33])^(1/3)) + x]

Kris
  • 543
  • 2
  • 10
  • I am on Mathematica 10.1.0.0. I directly copied and executed your code. I get the same output for f[1 + x - x^2 + x^3], but having added the second definition using TagSetDelayed, f /: f@g[x_] := g@f[x] I don't get your result. Rather I get HeavisideTheta[1 + x - x^2 + x^3] – Jack LaVigne Jul 31 '15 at 13:14