What Else is New in Calculus

Itai Seggev, Senior Kernel Developer, Wolfram Research, Inc.
Devendra Kapadia, Kernel Developer, Wolfram Research, Inc.

Join the Conversation #WolframTechConf

Outline

Elementary Stuff

DifferenceQuotient

Measures

Advanced Stuff

MeijerGReduce

GreenFunction

DEigensystem

DSolve Enhancements

On-Going Stuff

Difference Quotient

DifferenceQuotient[f[x],{x,h}]

DifferenceQuotient[f[x],{x,2,h}]

Computing derivatives

Compute a first derivative

g[x_]:=x^2 Exp[x]

dq1[x_]=DifferenceQuotient[g[x],{x,h}]

Limit[dq1[x],h->0]

Simplify[%==g'[x]]

Compute a second derivative

Using the second difference quotient:

dq2[x_]=DifferenceQuotient[g[x],{x,2,h}]

Limit[dq2[x],h->0]

Simplify[%==g''[x]]

Using the difference quotient of the derivative:

dqp[x_]=DifferenceQuotient[g'[x],{x,h}]

Limit[dqp[x],h->0]

Visualizing differentiation

f[x_]:=10 Exp[-((x^2-x)/4)] Sin[2 x]

g[h_,b_][x_]=f[b]+(DifferenceQuotient[f[x],{x,h}]/.(x->b)) (x-b);

Manipulate[Plot[{f[x],g[h,b][x]},{x,-3,3},PlotRange->12,ImageSize->Medium,Epilog->{AbsolutePointSize[7],Point[{{b,f[b]},{b+h,f[b+h]}}]}],{{b,0},-2,2,Appearance->"Labeled"},{{h,1},-1,1,Appearance->"Labeled"}]

Measures

Had this in version 10.0

ArcLength[{r Cos[t],r Sin[t]},{t,0,2Pi}, Assumptions->r>0]

Added over the course of 10.x

Area[{r Cos[t],r Sin[t]},{t,0,2Pi},{r,0,1}]

Volume[{r Cos[t],r Sin[t], z},{t,0,2Pi},{r,0,1},{z,0,h}]

Added in 11.0

RegionMeasure[{r Cos[t],r Sin[t]},{{t,0,2Pi}},  Assumptions->r>0]

RegionMeasure[{r Cos[t],r Sin[t]},{{t,0,2Pi},{r,0,1}}]

RegionMeasure[{r Cos[t],r Sin[t],z},{{t,0,2Pi},{r,0,1},{z,0,h}}]

The Sine “nut”

Find the area and volume of the following surface of revolution:

ParametricPlot3D[CoordinateTransform["Cylindrical"->"Cartesian",{Sin[z],t,z}]//Evaluate,{z,0,Pi},{t,0,2 Pi},PlotTheme->"Business",ImageSize->Small]

Area[{Sin[z],t,z},{z,0,Pi},{t,0,2 Pi},"Cylindrical"]

Volume[{r Sin[z],t,z},{z,0,Pi},{t,0,2 Pi},{r,0,1},"Cylindrical"]

MeijerGReduce

Expresses special functions in terms of (Inactive) MeijerG

MeijerG represents the set of functions which solve a generalized hypergeometric equation and whose series solution only requires a 1-step recurrence (Beals)

See also MellinTransform, InverseMellinTransform, and MellinConvolve

MeijerGReduce[Sin[x],x]

MeijerGReduce[BesselJ[n,x],x]

MeijerGReduce[Hypergeometric0F1[a,x],x]

Integration on the positive reals

Transform a product into MeijerG and express the in terms of a third one:

IntegrateMeijerG[f_ g_,{z_,0,Infinity}]/;FreeQ[{f,g},MeijerG]:=IntegrateMeijerG[MeijerGReduce[f,z]MeijerGReduce[g,z],{z,0,Infinity}]

IntegrateMeijerG[α_ (InactiveHead[MeijerG])[{a_,b_},{c_,d_},ω_. z_] (InactiveHead[MeijerG])[{e_,f_},{g_,h_},η_.z_],{z_,0,Infinity}]/;FreeQ[{α,ω,η},z]:=α MeijerG[{Join[-c,e],Join[f,d]},{Join[-a,g],Join[h,-b]},η/ω]

Use to evaluate (∫_0^∞)(((z+1))^(-3/2)) (EllipticK[-z])dz:

Plot[(1+z)^(-3/2)EllipticK[-2z],{z,0,10},Filling-> Axis,PlotRange->All]

IntegrateMeijerG[(1+z)^(-3/2)EllipticK[-2z],{z,0,Infinity}]

Compare with Integrate:

Integrate[(1+z)^(-3/2)EllipticK[-2z], {z,0,Infinity}]

FullSimplify[%%==%]

GreenFunction

Computes response to δ-function forcing

Gives solutions to arbitrary forcing functions via convolution

Supports both ODEs and PDEs

RL (resistor-inductor) circuit

gf=GreenFunction[{L i'[t]+R i[t],i[0]==0},i[t],{t,0,∞},s]

v[t_]:=Sin[ω t]

Integrate[v[s] gf,{s,0,t},Assumptions-> t>0]

Plot[%/.{L->2,R->1,ω->5},{t,0,10}]

Inhomogeneous wave equation

Compute and visualize the Green function:

G[{x_,t_},{m_,n_}]=GreenFunction[(∂_({t,2}))u[x,t]-(∂_({x,2}))u[x,t],u[x,t],{x,-∞,∞},t,{m,n}]

Plot3D[G[{x,t},{0,0}],{x,-4,4},{t,0,4},Mesh->None,ExclusionsStyle->Orange]

Animate[Plot[G[{x,t},{0,0}],{x,-4,4},Mesh->None,ExclusionsStyle->Orange],{t,0,4}]

Find the solution to a forced problem using convolution:

h[m_,n_]:=(E^(-n)) Cos[m]

Simplify[Integrate[G[{x,t},{m,n}] h[m,n],{m,-∞,∞},{n,0,∞},Assumptions->t>0&&Im[x]==0]]

Animate[Plot[%,{x,-10,10},PlotRange->(1/2)],{t,0,1}]

Compare with DSolveValue:

DSolveValue[{(∂_({t,2}))u[x,t]-(∂_({x,2}))u[x,t]==h[x,t],u[x,0]==0,Derivative[0,1][u][x,0]==0},u[x,t],{x,t}]

DEigensystem

Computes eigenvalues and eigenfunctions of linear differential operators

DEigensystem[{-Laplacian[u[x],{x}],DirichletCondition[u[x]==0,True]},u[x],{x,0,π},4]

Isotropic harmonic oscillator

Specify the operator:

ℒ=-Laplacian[u[x,y,z],{x,y,z}]+2((x^2)+(y^2)+(z^2))u[x,y,z];

ℬ=DirichletCondition[u[x,y,z]==0,True];

Find and display the first 8 eigenvalues/eigenfunctions:

{vals,funs}=DEigensystem[{ℒ,ℬ},u[x,y,z],{x,y,z}∈FullRegion[3],8];

vals

Table[DensityPlot3D[funs[[i]]//N//Evaluate,{x,y,z}∈Ball[{0,0,0},3],Boxed->False,ColorFunction->Hue,PlotPoints-> 50,Axes->False],{i,8}]

DSolve

Integral equations

Partial differential equations over (simple) regions

Assumptions options

Sturm-Liouville Problems

GreenFunction solver

Particle in a box

System:

eqn=I ℏ D[ψ[x,t],t] == ((-(ℏ^2))/(2m)) D[ψ[x,t],{x,2}];
bcs = {ψ[0,t]==0,ψ[d,t]==0};

DSolve[Join[{eqn},bcs],ψ[x,t],{x,t}]

Stationary/pure state:

sol1=DSolve[Join[{eqn,ψ[x,0]==(Sqrt[(2/d)])Sin[Pi(x/d)]},bcs],ψ[x,t],{x,t}]

ρ1[x_,t_]=Simplify[ComplexExpand[Conjugate[ψ[x,t]]ψ[x,t] /. First[sol1]],d>0]

Integrate[ρ1[x,t],{x,0,d}]

Mixed state:

sol2=DSolve[Join[{eqn,ψ[x,0]==(1/(Sqrt[d]))Sin[Pi(x/d)]+(1/(Sqrt[d]))Sin[2Pi(x/d)]},bcs],ψ[x,t],{x,t}]

ρ2[x_,t_]=Simplify[ComplexExpand[Conjugate[ψ[x,t]]ψ[x,t] /. First[sol2]],d>0]

ρe[x_,t_]=ρ2[x,t]/. {ℏ->1.055*^-34,m->9.109*10^-31,d->10^-9};
Animate[Plot[ρe[x,t],{x,0,10^-9},PerformanceGoal->-"Quality",PlotRange->{0,4*^9},ImageSize->Medium,AxesLabel->{"x (m)", "ρe ((m^(-1)))"}],{t,0,3.66*^-15},SaveDefinitions->True]

Nth Derivatives

Allow symbolic order of derivative

Assumed to be positive integers

D[x,{x,n}]

D[Cos[x],{x,n}]

Table[%,{n,4}]

The Taylor series of Sine

Find the nth derivative:

D[Sin[x],{x,n}]

Compute the nth term in the Taylor series:

(((%/.x->x0)(((x-x0))^n))/(n!))

Sum the series:

Sum[%,{n,0,∞}]

Differentiation rules

Clear[f,g]

prod=D[f[x]g[x],{x,n}]

Table[Activate[prod],{n,3}]//TableForm

chain=(∂_({x,n}))f[g[x]]

Table[Activate[chain],{n,3}]//TableForm

Other

Indexed derivatives

Refreshed documentation

Sum Improvements

Integrate improvements

Position “vector”

The derivative of the position map wrt the j(^th) variable:

D[Inactive[Table][x[k],{k,n}],x[j]]

Find the derivative of the norm:

Simplify[D[Sum[((x[k])^2),{k,1,n}],x[j]],j∈Integers && 1 ≤k≤n]

New sums

ntsums=Inactivate[{(∑_(n=1)^∞)((MoebiusMu[n] (q^n))/(1-(q^n))),(∑_(k=1)^(n-1))DivisorSigma[3,k] DivisorSigma[3,n-k],(∑_(n=1)^∞)((DivisorSigma[k,n])/(n^s)),(∑_(n=1)^∞)((EulerPhi[n])/(n^s)),(∑_(n=1)^∞)((MangoldtLambda[n])/(n^s)),(∑_(n=1)^∞)((MoebiusMu[n])/(n^s)),(∑_(n=1)^∞)((2^(PrimeNu[n]))/(n^s)),(∑_(n=1)^∞)((LiouvilleLambda[n])/(n^s)),(∑_(n=1)^∞)(((MoebiusMu[n])^2)/(n^s))},Sum];

FormulaGallery[forms_List,header_]:=Module[{vals=Activate/@forms},Grid[Prepend[Table[{forms[[l]],"=",vals[[l]]},{l,Length[forms]}],{Item[header,Alignment->Center],,}],Dividers->{{True,False,False,True},All},Alignment->{{Right,Center,Left}},Background->{None,{{LightBlue,None}},({1,#1}->Hue[.6,.4,1]&)/@Range[0]},Spacings->{{4,{},4},1},BaseStyle->{FontFamily->Times,FontSize->24},ItemSize->Full,Frame->All]];

TraditionalForm[Simplify[FormulaGallery[ntsums,"Number-theoretic Sums"]]]