Absolute Value

Author

Eric W. Weisstein
March 12, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/SpecialFunctions/AbsoluteValue.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/AbsoluteValue.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Plots

<<Utilities`Plot`

Abs

Real Line V5

Plot[Abs[x],{x,-2,2},
AspectRatio->Automatic,PlotStyle->Red,
AxesLabel->TraditionalForm/@{x,Abs[x]}]

Real Line V6

g1=Plot[Abs[x],{x,-2,2},PlotStyle->Red,AxesLabel->{x,Abs[x]}]

Complex Plane V5

ComplexPlot3D[Abs[z],{z,-2,2},ComplexPlotLabel->HoldForm[Abs[z]]]//Timing

ComplexContourPlot[Abs[z],{z,-5,5},ComplexPlotLabel->HoldForm[Abs[z]]]//Timing

Complex Plane V6

g2=ComplexPlot3D[Abs[z],{z,-2,2},ComplexPlotLabel->HoldForm[Abs[z]],PlotPoints->10,ImageSize->Automatic]

ComplexContourPlot[Abs[z],{z,-5,5},ComplexPlotLabel->HoldForm[Abs[z]],MaxRecursion->2,PlotPoints->20]

Grid[{{g1},{g2}}]

(Sqrt[(z^2)])

ComplexPlot3D[Sqrt[z^2],{z,-5,5},ComplexPlotLabel->HoldForm[Sqrt[z^2]]]

ComplexContourPlot[Sqrt[z^2],{z,-5,5},Contours->50,ComplexPlotLabel->HoldForm[Sqrt[z^2]]]

((Sqrt[z])

ComplexPlot3D[Sqrt[z^2],{z,-5,5},ComplexPlotLabel->HoldForm[Sqrt[z^2]]]

ComplexContourPlot[Sqrt[z^2],{z,-5,5},Contours->50,ComplexPlotLabel->HoldForm[Sqrt[z^2]]]

Derivative

D[Abs[x],x]

PiecewiseExpand[Abs[x]]

PiecewiseExpand[Abs[x],x∈Reals]

D[%,x]

PiecewiseExpand[Abs'[x],x∈Reals]

...all correct behaviors...

Integral

Integrate[Abs[x],x]

Integrate[PiecewiseExpand[Abs[x],x∈Reals],x]

Simplification

FullSimplify[Abs[x],x>0]

FullSimplify[Abs[x],x==0]

FullSimplify[Abs[x],x<0]

LeafCount/@{Abs[x],-x}

FullSimplify[Abs[x],x<0,ComplexityFunction->(-LeafCount[#]&)]

(∫_0^1)(∫_0^1)((|x-y|)^n)dydx, n>0

Plot3D[Abs[x-y],{x,0,1},{y,0,1},
PlotPoints->30]

v4.2

Integrate[Abs[x-y]^n,{x,0,1},{y,0,1}]

Integrate[Abs[x-y]^n,{x,0,1},{y,0,1},Assumptions->n>0]

v5.0

Integrate[Abs[x-y]^n,{x,0,1},{y,0,1},Assumptions->{n>0&&n∈Integers}]//InputForm

1/Factor[Simplify[3+Sum[k,{k,3,n+3}] /. n->(n-2)]]

Table[(2/((1+n) (2+n))),{n,10}]

Table[Integrate[Abs[x-y]^n,{x,0,1},{y,0,1}]-2/(n+1)/(n+2),{n,15}]

NIntegrate[Abs[x-y]^(1/2),{x,0,1},{y,0,1}]

With[{n=1/2.},(2/((1+n) (2+n)))]

NIntegrate[Abs[x-y]^(3/2),{x,0,1},{y,0,1}]

With[{n=3/2.},(2/((1+n) (2+n)))]

NIntegrate[Abs[x-y]^(1/8),{x,0,1},{y,0,1}]

With[{n=1/8.},(2/((1+n) (2+n)))]

(∫_0^1)(∫_0^1)((|x-y|)^n)dydx, n<0

Plot3D[1/Abs[x-y],{x,0,1},{y,0,1},
PlotPoints->50,Mesh->False]

v4.2.1

Table[Integrate[Abs[x-y]^n,{x,0,1},{y,0,1}],{n,-5,5}]

Integrate[Abs[x-y]^n,{x,0,1},{y,0,1}]

v5.0.1

Integrate[Abs[x-y]^n,{x,0,1},{y,0,1}]

Table[Integrate[Abs[x-y]^n,{x,0,1},{y,0,1}],{n,-5,5}]

v6

Integrate[Abs[x-y]^n,{x,0,1},{y,0,1}]

Table[Integrate[Abs[x-y]^n,{x,0,1},{y,0,1}],{n,-5,5}]