Re: Modulus / Absolute Value

*To*: mathgroup at smc.vnet.net*Subject*: [mg90075] Re: Modulus / Absolute Value*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>*Date*: Sat, 28 Jun 2008 05:51:19 -0400 (EDT)*Organization*: The Open University, Milton Keynes, UK*References*: <g42f1s$nv6$1@smc.vnet.net>

Felipe Mannshardt wrote: > i have been searching the way to tell Mathematica to use Modulus / Absolute Value. I have been unable to find. > > LATEX > \left(\int_0^{\frac{\pi }{2}} f[x] \, dx+\int_{\frac{\pi }{2}}^{\pi } f[x] \, dx\right)+\int_0^{\pi } g[x] \, dx > /LATEX > I should be subtracting the upper Integral from the lower Integral, > but since i could not find a way to tell Mathematica to use Modulus /Absolute Value. I had to add the upper to the lower . . . > > my functions are, f and g > > LATEX > f[\text{x$\_$}]\text{:=}\text{Sin}[2*x]g[\text{x$\_$}]\text{:=}x^2-(\pi *x) > /LATEX > So, can some1 help me out with this one? How to use Modulus/Absolute Value (German, Betrag) with Mathematica. My understanding is that you want to do a piecewise integration. Knowing that: 1) the absolute value is called *Abs[]* in Mathematica 2) Mathematica does not handle very well piecewise integration 3) fortunately Maxim Rytin's package does manage it very well the way to go is to get and familiarize yourself with this package. For instance, PiecewiseIntegrate[Abs[f[x]] + g[x], {x, 0, Pi}] 1/6 (12 - \[Pi]^3) See "Integration of Piecewise Functions with Applications" at http://library.wolfram.com/infocenter/MathSource/5117/ "The notebook contains the implementation of four functions PiecewiseIntegrate, PiecewiseSum, NPiecewiseIntegrate, NPiecewiseSum. They are intended for working with piecewise continuous functions, and also generalized functions in the case of PiecewiseIntegrate. They support all the standard Mathematica piecewise functions such as UnitStep, Abs, Max, as well as Floor and other arithmetic piecewise functions. PiecewiseIntegrate supports the multidimensional DiracDelta function and its derivatives. The arguments of the piecewise functions can be non-algebraic and contain symbolic parameters." Regards, -- Jean-Marc