The DpwSmooth Package

User Guide

Author: Stephan Trenn
Version: 1.0
Date: 10.05.2010

Introduction

This package allows (symbolic) calculations with piecewise-smooth distributions as introduced in (Trenn 2009) see also (Trenn 2009, PhD-Thesis). The documentation gives an explanation how to work with piecewise-smooth distribution in Mathematica however a detailed mathematical explanation of piecewise-smooth distributions is out of scope of this documentation (I assume, that everyone who is interested in this Mathematica package for piecewise-smooth distributions is so because he or she read my papers about piecewise-smooth distributions, this might not be true sometime in the future and I'll be happy to include more mathematical background here as well).

Initialization and basic properties

Loading the package

You first have to load the package in order to use it, this can be done in different ways. Here we assume the package file DpwSmooth.m is in the same folder as this documation file. This documention also works, when the file DpwSmooth.m is located in the local Application folder of Mathematica. To check whether Mathematica finds the package just run this documentation via the menu item Evaluation -> Evaluate Notebook.

SetDirectory[NotebookDirectory[]]
<<DpwSmooth`

Creating piecewise-smooth distributions

Basic piecewise-smooth distributions

The basic constructors of piecewise-smooth distributions are as follows

The zero piecewise-smooth distribution (i.e. the neutral element with respect to addition)

ZeroD

The constant one piecewise-smooth distribution (Subscript[𝟙, 𝔻]) (which is the neutral element with respect to multiplication)

OneD

Dirac impulse at a certain time point (Subscript[δ, t])

DiracImpulseAt[t]

For convinience the Dirac impulse at zero (Subscript[δ, 0])is abbriviated as

DiracImpulse

Regular distributions induced by smooth functions

For any smooth function f  given by t|->f(t) the induced regular distribution (Subscript[f, 𝔻]) can  be created by

SubD[f]

or

SubD[t|->f[t]]

Note that

ZeroD == SubD[t|->0]

OneD==SubD[t|->1]

Smoothness of f is not checked by the constructor SubD, although some calculations will work others may not give the correct result, when f is not smooth. To create regular distributions induced by piecewise-smooth function use SubD together with the restriction to intervals explained later.

Addtion and scalar multiplication

Piecewise-smooth distributions can be added and multiplied with scalars in the standard Mathematica notation

0.5 OneD + 1/2 OneD

Regular and impulsive part

Each piecewise-smooth distribution can uniquely be decomposed into its regular and impulsive part:

RegularPart[OneD+DiracImpulse]
ImpulsivePart[OneD+DiracImpulse]

Note that for any piecewise-smooth distribution

d == RegularPart[d]+ImpulsivePart[d]

Relationship to standard Mathematica definitions

Mathematica provides a simple support for calculating with the piecewisely defined functions and Dirac impulse in form of Piecewise[...] and DiracDelta[...], however the support is only rudimentary, for example the multiplication of a smooth function with a Dirac impulse is not simplified. It is possible to obtain the Mathematica representation of a piecewise-smooth distribution by applying the two functions RegularPartAsPiecewise and ImpulsivePartAsDiracDelta (for the definition of Restrict see the next chapter):

RegularPartAsPiecewise[Restrict[OneD,Interval[{0,1}]]+DiracImpulse][t]

ImpulsivePartAsDiracDelta[Restrict[OneD,Interval[{0,1}]]+DiracImpulse][t]

Restriction of piecewise-smooth distributions

An important difference between general distributions and piecewise-smooth distribution is the possibility to define a restriction of the latter to intervals. Restrictions are used by the Restrict[D,I] function, where D is any piecewise-smooth distribution and I is a Mathematica Interval.

Restrict[OneD,Interval[{0,1}]]

For convinience, Restrict also works for functions as the first argument (internally Restrict[f,I] is just mapped to Restrict[SubD[f],I], note that f must be in the Form Function[...], i.e. Exp, Sin, ... or simular build-in functions do not work directly - they only work together with SubD). The build-in Mathematica Interval also allows for the union of several interval, this is reflected in Restrict.

Restrict[t|->t^2+Exp[t],Interval[{0,1},{2,Infinity}]]

For regular distribution it is not important whether the intervals considered are open or closed (or combinations thereof), however for restricting Dirac impulses this is important. Therefore Restrict has two additional options IntervalContainsLeft and IntervalContainsRight. The default values are IntervalContainsLeft -> True and IntervalContainsRight -> False.

Restrict[DiracImpulse,Interval[{0,Infinity}]]
Restrict[DiracImpulse,Interval[{0,Infinity}],IntervalContainsLeft->False]

Derivatives and Integrals

Piecewise-smooth distributions are closed under differentiations, i.e. the (distributional) derivative of a piecewise-smooth distribution is again a piecewise-smooth distribution

Restrict[SubD[Sin],Interval[{0,Pi},{3/2Pi,Infinity}]]'
Restrict[SubD[Sin],Interval[{0,Pi},{3/2Pi,Infinity}]]''
Restrict[SubD[Sin],Interval[{0,Pi},{3/2Pi,Infinity}]]'''

Integrals are not implemented yet, but will be in the near future.

Multiplication of piecewise-smooth distributions

An surprising property of piecewise-smooth distributions is the possibility to multiply them. This is not possible for general distributions. One price to pay is the that multiplication is not commutative anymore

Restrict[OneD,Interval[{0,Infinity}]]**DiracImpulse
DiracImpulse**Restrict[OneD,Interval[{0,Infinity}]]

Otherwise the multiplication for piecewise-smooth distributions fulfills all other properties of a multipliaction, like transitivity and distributivity with respect to addition. Also the multiplication rule for the derivative holds, i.e.

(d1**d2)'==d1'**d2+ d1**d2'

An important feature of the mutliplication of piecewise-smooth distributions is that the product between any Dirac impulses is zero

DiracImpulseAt[t]**DiracImpulseAt[s]

In particular,

DiracImpulse ** DiracImpulse

Plotting piecewise-smooth distributions

For illustrative purposes you can plot a piecewise-smooth distribution with DpwSmoothPlot[D,I], where I is an Interval

DpwSmoothPlot[Restrict[SubD[Sin]+1/2SubD[Cos],Interval[{0,Pi},{3/2Pi,Infinity}]]''',Interval[{-1,2Pi}]]

Dirac impulses of different order are displayed as arrows with different width (the higher the order the thicker) and different colors. You can add add most standard Plot-options to change the appearance of the regular part. There are no options for the illustration of the Dirac impulses yet.

DpwSmoothPlot[Restrict[SubD[Sin]+1/2SubD[Cos],Interval[{0,Pi},{3/2Pi,Infinity}]]''',Interval[{-1,2Pi}],PlotStyle->Thick,ColorFunction->(Red&)]