What’s New in Calculus and Algebra

Devendra Kapadia, Wolfram Research, Inc.

(RowDefault[, (Spacer1), , (Spacer1), ])  #WolframTechConf

Plan for the Talk

I will discuss new developments related to the following areas:

Polynomial Algebra

Calculus

Engineering Applications

Linear Algebra

Documentation

Online Courses

Fast Polynomial Algebra

There are dramatic speed-ups for integral polynomial operations in 13.2.

They directly affect the following functions:

Polynomial Functions

PolynomialGCD

Factor

FactorSquareFree

Resultant

Discriminant

Linear Algebra

LinearSolve

RowReduce

Inverse

NullSpace

MatrixRank

Det

MatrixPower

Polynomial Algebra-Example

The following example illustrates the speed-ups in 13.2.

Define a random polynomial function:

rpoly[n_]:=RandomInteger[{-2^10,2^10},{n+1}].x^Range[0,n]

Generate a 10x10 matrix with polynomial entries of degree 100:

SeedRandom[1234];

m=Table[rpoly[100],{10},{10}];

Compute the determinant of this matrix in 13.2:

(ans132=Det[m]);//AbsoluteTiming

LeafCount[ans132]

Compare with the results in 13.1:

(ans131=Det[m]);//AbsoluteTiming

LeafCount[ans131]

This strategy has been used to generate large benchmarks in 13.2.

Polynomial Algebra - Benchmarks

The following benchmark plots illustrate the speed-ups in 13.2:

The improvements are based on a use of the FLINT library.

A Recap of Fractional Calculus

We added support for Fractional Calculus operations in 13.1.

The two main functions in this area are FractionalD and CaputoD.

FractionalD

FractionalD computes the Riemann-Liouville derivative of a function:

(Subscript[, 0])(Subscript[D, x]^α)f(x)=(1/(Γ(n-α)))((d^n)/(d(x^n)))(∫_0^x)(((x-τ))^(n-α-1))f(τ)dτ where n=max(0,(Ceiling[α])).

For example, compute the half-derivative of (x^2):

FractionalD[(x^2),{x,(1/2)}]

Verify the result:

FractionalD[FractionalD[(x^2),{x,(1/2)}],{x,(1/2)}]

CaputoD

CaputoD computes the Caputo derivative of a function:

(^C)(Subscript[, 0])(Subscript[D, x]^α)f(x)=(^RL)(Subscript[, 0])(Subscript[D, x]^α)f(x)-(∑_(k=0)^(⌈α⌉-1))((x^(k-α))/(Γ(k-α+1)))(f^((k)))(0).

CaputoD interacts well with LaplaceTransform.

Hence, it is useful for solving fractional DEs:

DSolveValue[{CaputoD[y[x],{x,21/10}]+10 y[x]==0,y[0]==1,y'[0]==0,y''[0]==0},y[x],x]

Plot the solution:

Plot[ %,{x,0,10}]

Numerical Fractional Derivatives

NFractionalD is the numerical analog of FractionalD in 13.2.

NCaputoD is the numerical analog of CaputoD in 13.2.

The following example illustrates the new functionality:

FractionalD[Sin[x],{x,1/2}]//FullSimplify

%/.x->0.3

Obtain the same result using NFractionalD:

NFractionalD[Sin[x],{x,1/2},0.3]

Plot the derivative:

Plot[NFractionalD[Sin[x],{x,1/2},t],{t,0,30},PlotStyle->Red]

Verify the result using NIntegrate:

With[{alpha=1/2},NIntegrate[Evaluate[(((∂^(Ceiling[alpha]))(z sin(t) (((z-t))^((Ceiling[alpha])-alpha-1))/. t->u z))/(∂(z^(Ceiling[alpha]))))]/. z->0.3,{u,0,1}]/(Gamma[(Ceiling[alpha])-alpha])]

Asymptotics for Fractional DEs

AsymptoticDSolveValue includes methods for solving linear FDEs in 13.2.

For example,

B={{0,1},{-1,0}};
a=16/17;
ic={-3,5};

AsymptoticDSolveValue[{CaputoD[x[t],{t,a}]==B.x[t],x[0]==ic},x∈Vectors[2],{t,0,20}]

Plot[%,{t,0,7},PlotRange->{-5,6}]

Support has also been added for linear FDEs with polynomial coefficients.

Power Series Representations

Asymptotic can now compute power series representations for functions.

For example:

Asymptotic[(1/(1-z)),{z,0,∞}]//TraditionalForm

Compute the radius of convergence for the power series:

Asymptotic[(1/(1-z)),{z,0,∞},GenerateConditions->True]

The new feature relies on using SeriesCoefficient and SumConvergence.

Power Series Examples

Represent Sin as a power series:

Asymptotic[Sin[z],{z,0,∞}]//TraditionalForm

Compute the exponential generating function for the Bernoulli numbers:

Asymptotic[(z/((E^z)-1)),{z,0,∞}]

ExponentialGeneratingFunction[BernoulliB[n],n,z]

Compute the power series for an algebraic function:

Asymptotic[(((((1-(Sqrt[1-4 z])))^2) (z^2))/(4 (Sqrt[1-4 z]))),{z,0,∞},GenerateConditions->True]

ComplexPlot[(((((1-(Sqrt[1-4 z])))^2) (z^2))/(4 (Sqrt[1-4 z]))),{z,-1/3-I/3,1/3+I/3}]

We plan to make similar improvements in AsymptoticDSolveValue.

Inverse Laplace Transforms

A Famous Benchmark

Oberhettinger and Badii is a well-known table of Laplace transforms.

13.2 covers all the inverse transforms in this important benchmark.

Example

Here is an example that is done by table lookup:

f[s_]:=((Gamma[s])/(((5/2))^s))BesselJ[1/2+s,5]

Plot the frequency-domain function:

ComplexPlot[f[s],{s,-3-2I,3+2I}]

Compute the inverse Laplace transform:

InverseLaplaceTransform[f[s],s,t]//Timing

Verify the result using a numerical check:

%[[2]]/.t->2.4

InverseLaplaceTransform[f[s],s,2.4]

Inhomogenous Linear ODEs

Motivation

Linear ODEs with constant coefficients are very important in applications.

The inhomogeneous terms in such ODEs represents “forcing functions”.

DSolve returns simpler solutions for this class of  equations in Version 13.2.

Example

This ODE returns a useful solution in Version 13.2:

DSolveValue[4y'''[x]+2y'[x]+y[x]==((x^3)+2x-1)  (E^(3x)) Sin[2x],y[x],x]

Here is the solution from Version 13.1:

DSolveValue[4y'''[x]+2y'[x]+y[x]==((x^3)+2x-1)  (E^(3x)) Sin[2x] ,y[x],x]

These improvements will be appreciated by many users.

Electric Circuits

The study of electric circuits is a basic theme for electrical engineering.

We are working on solving a popular textbook for this topic.

The main tools that we use are Mathematica and System Modeler.

The project is expected to generate around 800 examples of DC circuits.

An Analog Computer

Design an analog computer circuit to solve the differential equation:

(((d^2) (Subscript[v, o]))/(d (t^2)))+ 3((d(Subscript[v, o]))/(dt))+2(Subscript[v, o])=4 Cos[10 t]

subject to (Subscript[v, o])[0]=2, (Subscript[v, o])'[0]=0.

The problem can be solved in two ways:

Using System Modeler

Design the circuit and import it into a notebook:

mo = Import[FileNameJoin[{NotebookDirectory[],"\\Models\\Figure_6_41.mo"}],"MO"];

mo["Diagram"]

Run the simulation:

sim=SystemModelSimulate[mo, 10];

From there get the output signal:

output=sim["vo.v"]

Plot the output:

Plot[output[t],{t,0,10}, AxesLabel->{"t (s)","vo (V)"}]

Using Mathematica

Solve the problem using DSolveValue:

sol=DSolveValue[{vo''[t]+3  vo'[t]+2vo[t]== 4 Cos[10 t],vo'[0]==0, vo[0]==2},vo[t],t]

Plot[sol,{t,0,10}, AxesLabel->{"t (s)","vo (V)"}]

New Structured Matrices

Version 13.2 includes VandermondeMatrix and CauchyMatrix.

They are designed for efficient storage and computation.

For example, define a Vandermonde matrix of order 3:

v=VandermondeMatrix[{(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3])}]

Also define a Cauchy matrix of order 3:

c=CauchyMatrix[{(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3])},{(Subscript[y, 1]),(Subscript[y, 2]),(Subscript[y, 3])}]

Display the matrices:

{v//MatrixForm,c//MatrixForm}

Compute the determinant of v:

Det[v]

Examine its properties:

v["Nodes"]

v["StructuredAlgorithms"]

These matrices are very useful for solving interpolation problems.

Rational Interpolation

CauchyMatrix can be used to perform rational interpolation.

For example, choose a set of points in the complex plane:

pts={-1,-I,0,I,2};

Prescribe the values of the interpolating function at these points:

vals={0,(1/2)-(I/2),1,(1/2)+(I/2),-1};

Prescribe the poles of the interpolating function:

poles=Exp[2π I Range[0,4]/5.];

Construct the required Cauchy matrix:

cm=CauchyMatrix[pts,-poles]

Find the coefficients in the expansion of the rational function:

rcoef=LinearSolve[cm,vals];

Construct the rational function:

(ratInt[z_]=Total[rcoef/(z-poles)])//TraditionalForm

Plot the rational function :

ComplexPlot3D[ratInt[z],{z,-2-2I,2+2I},]

Plot the rational function along with the points:

ComplexPlot[ratInt[z],{z,-3-3I,3+3I},]

Check that the interpolation conditions are all specified:

(ratInt/@pts)-vals//Chop

Documentation

Application examples have been added to ~100 special function pages.

There is also a new tutorial on Fractional Calculus.

Finally, the tutorial on symbolic ODE solving has been updated.

Online Courses

A Wolfram U course on Elementary Algebra will be released soon.

Courses on Probability and Statistics are planned for early 2023.

Thank you!