What’s New in Calculus & Algebra

Adam Strzebonski and Devendra Kapadia, 
Wolfram Research, Inc.

Join the Conversation #WolframTechConf

Root Objects

New display format of Root objects shows their approximate values.

Root[#^5-2#+3&,1]

With the new default option settings Cubics->Automatic and Quartics->Automatic Solve does not use Cardano formulas for polynomials with numeric coefficients.

rts=Solve[x^4+2 x^3+3x^2+4x+5==0,x]

To get solutions in terms of radicals use Cubics->True and Quartics->True.

rads=Solve[x^4+2 x^3+3x^2+4x+5==0,x,Quartics->True]

Motivation for the change: Root object representation is better for further computation.

N[rts,100000];//Timing

N[rads,100000];//Timing

rpoly[n_]:=Sum[RandomInteger[{-100,100}] x^i,{i,0,n}]
SeedRandom[1234];mat=Table[rpoly[3],{5},{5}];

Inverse/@(mat/.rts);//Timing

Inverse/@(mat/.rads);//Timing

Equation and Inequality Solvers

Structure Recognition

Triangular polynomial systems with finitely many solutions

The new method recognizes systems that consist of a triangular set of polynomial equations and an arbitrary additional condition. It generates real or complex solutions directly, without Resultant/GroebnerBasis computations, and is optimized for fast generation of large sets of nested Root objects, caching various intermediate results. It is used in Solve, Reduce, FindInstance, and NSolve.

rpoly[n_,k_]:=Module[{iters,e,ee},
ee=Times@@(x[#]^e[#]&/@Range[n]);
iters=Table[{e[i],0,k-Sum[e[j],{j,i-1}]},{i,n}];
Sum[RandomInteger[{-100,100}] ee,Evaluate[Sequence@@iters]]]
rtsyst[dd_]:=And@@Table[rpoly[i,dd[[i]]]==0,{i,Length[dd]}]

This takes 289 seconds in Mathematica 11.3.

SeedRandom[1234];
s5=rtsyst[{7,7,7,7,7}];
v5={x[1],x[2],x[3],x[4],x[5]};
c5=Sin[x[1]+x[2]]Exp[x[3]+x[4]]≤x[5];
Solve[s5&&c5,v5,Reals]//Timing

This does not finish in 68 hours in Mathematica 11.3.

SeedRandom[1234];
s4=rtsyst[{7,7,7,7}];
v4={x[1],x[2],x[3],x[4]};
c4=Norm[v4]≤3;
Solve[s4&&c4,v4]//Length//Timing

Block-diagonal systems

The new method recognizes systems that can be split into several independent subsystems that involve disjoint groups of variables.

eqns[n_]:=Join@@Table[{x[i]^2==y[i]+1,y[i]^2==x[i]+1},{i,n}]
vars[n_]:=Join@@Table[{x[i],y[i]},{i,n}]

This takes 2061 seconds in Mathematica 11.3.

Solve[eqns[10],vars[10]]//Length//Timing

If the number of solutions is too large to enumerate Mathematica gives a message an returns one solution.

Solve[eqns[1000],vars[1000]]//Timing

Vector and Matrix Inequalities

Equation and inequality solvers and optimization functions now accept vector, tensor, and array variables and can handle vector and matrix inequality conditions.

This system contains a component-wise vector inequality.

Solve[{x,-(x^2)}\[VectorLess]y&&y∈Vectors[2]&&Norm[y]==1&&((IndexedDefault[y, 1])^2)+(x^2)==1,y]

Here we solve for a positive definite matrix.

Reduce[A(Underscript[\[VectorGreater], (SemidefiniteConeList[2])])0&&A∈Matrices[2],A]

This finds a 2x2x2 array of positive integers that satisifes a positive definitness condition.

FindInstance[(IndexedDefault[x, 1])(Underscript[\[VectorLess], (SemidefiniteConeList[2])])(IndexedDefault[x, 2])&&x∈Arrays[{2,2,2},(PositiveIntegers)],x]

Optimization problem with a matrix variable.

Minimize[{Norm[x,"Frobenius"],Det[x]==1&&0(Underscript[\[VectorLess], (SemidefiniteConeList[2])])x&&x∈Matrices[2,(Reals)]},x]

Lazard’s Projection

The Cylindrical Algebraic Decomposition (CAD) algorithm is used to solve systems of polynomial equations and inequalities over the reals. The algorithm uses a projection operator to eliminate variables. In 1994 Lazard proposed a projection operator that produces substantially less projection polynomials, however his proof of validity of the operator contained a gap. In a recent (2016) paper McCallum, Parusinski, and Paunescu present a version of the CAD algorithm using Lazard’s projection operator with a compete proof of correctness. Mathematica 12 implements this version and uses it when the automatic method choice heuristic expects it to be the fastest method.

This takes 111 seconds in Mathematica 11.3.

CylindricalDecomposition[a (x^2)+b (y^2)≥(Sqrt[2])c x&&c (x^2)+b (y^2)≤(Sqrt[3]) a y,{a,b,c,x,y}]//Timing

Asymptotic Solve

For a bivariate equation (y^5)-x y+(x^2)==0 Solve gives global algebraic solutions for y as a function of x.

Solve[(y^5)-x y+(x^2)==0,y]

One can use Series to investigate the local behaviour of the solutions, but due to complicated branch cut structure of Root objects there is no guaranteed correspondence between Root functions and series.

Series[y/.%[[1]],{x,0,3}]

AsymptoticSolve gives local asymptotic solutions of the original equation.

AsymptoticSolve[(y^5)-x y+(x^2)==0,y,{x,0,3}]

AsymptoticSolve works for some equations for which we cannot compute global algebraic solutions.

AsymptoticSolve[(E^y)-Sin[y]Cos[x y]-x-1==0,{y,0},{x,0,3}]

{a1,a2}=y/.%;
f=(E^y)-Sin[y]Cos[x y]-x-1;
e1[x_]:=y/.FindRoot[f,{y,a1}]
e2[x_]:=y/.FindRoot[f,{y,a2}]

Plot[{a1,a2,e1[x],e2[x]},{x,0,0.3},PlotStyle->{Dashed,Dashed,DotDashed,DotDashed}]

Asymptotic Calculus

Discrete Asymptotic Solvers

In Version 11.3, we introduced AsymptoticDSolveValue and AsymptoticIntegrate.

Version 12 includes two new solvers for discrete asymptotics:

AsymptoticRSolveValue - difference equations

AsymptoticSum - indefinite and definite sums

Sequence Estimation

Estimate the (300^(th )) term of the following sequence:

seq={1,2,6,42,618,15018,533418,25935018,1651637418,133333531818};

Guess the difference equation satisfied by the sequence:

FindSequenceFunction[seq]

Obtain an asymptotic approximation for the difference equation:

AsymptoticRSolveValue[{(((1+n))^2) y[n]+(-2-2 n-(n^2)) y[1+n]+y[2+n]==0,y[0]==0,y[1]==1.},y[n],{n,∞,1}]

Obtain an asymptotic approximation for the corresponding sum:

AsymptoticSum[((k!)^2),{k,0.,n-1},{n,∞,1}]

Compare the approximate and actual values:

%/.{n-> 300.}

Sum[((k!)^2), {k, 0., 299}]

Special Functions

Documentation

Around 2000 Scope examples have been added to 100 pages for special functions in Version 12.0.

They include visualization, function properties, etc. based on the Functions website and WL functions.

Here are some polar plots from the ref page for Sin:

Work on the remaining 150 reference pages for special functions is in progress.

The updated pages should be useful for learning about Hypergeometric2F1 and other functions.

Heun Functions

The Heun functions are generalizations of hypergeometric functions:

HeunG[1,α β,α,β,γ,δ,z]

The Heun differential equation has four regular singular points at z = 0, 1, a, Infinity:

AsymptoticDSolveValue[{u''[z]+((γ/z)+(δ/(z-1))+((1+α+β-γ-δ)/(z-a)))u'[z]+((α β z-q)/(z(z-1)(z-a)))u[z]==0},u[z],{z,0,1}]

Here are plots of the five Heun functions (the remaining five functions are their derivatives).

These functions can be used to solve problems in quantum mechanics, the theory of black holes, etc.

Differential Equations

Arbitrary Constants

The constants returned by DSolveValue and other functions now display as subscripts:

dsol=DSolveValue[y''[x]+y[x]==0,y[x],x]

Plot[Evaluate[{dsol/. {(C[1])->0,(C[2])->1},dsol/. {(C[1])->1,(C[2])->0}}],{x,0,4 π},Filling->Axis]

Nonlinear ODEs

Nonlinear ODEs such as the following now return simple closed form solutions:

sol=DSolveValue[{y'[x]==(Sqrt[2-2 Log[((y[x])^2)]]) y[x],y[0]==1},y[x],x]

This example also has an equilibrium solution:

esol=DSolveValue[{y'[x]==(Sqrt[2-2 Log[((y[x])^2)]]) y[x],y[1/Sqrt[2]]==Sqrt[E]},y[x],x]

The complete solution is shown below:

Plot[Piecewise[{{sol,x<(1/(Sqrt[2]))}},esol],{x,-1,3},Filling->Axis,FillingStyle->Green]

Inactive Integrals

Construct a linear fourth-order ODE with the Bessel equation as a right factor:

rightfactor=(x^2) y''[x]+x y'[x]+(x^2) y[x];

leftfactor=(∂_({x,2}))#1-#1&;

eqn=Together[leftfactor[rightfactor]]

The general solution in Version 12 includes Inactive integrals:

(sol=DSolve[eqn==0, y,x])//Timing

Verify the solution:

eqn/.sol[[1]]//FullSimplify

Symbolic Integration

Constants of Integration

Generate the constant of integration for an indefinite integral:

Integrate[(x^2),x,GeneratedParameters->C]

This also works for multiple indefinite integrals:

Integrate[(x^2),x,x,y,y,y,y,z,GeneratedParameters->C]

Simplify[(∂_(x,x,y,y,y,y,z))%]

Constants can also be generated for Sum and other functions.

Indefinite Integrals

Indefinite integrals such as the following can be evaluated in Version 12:

∫(Sqrt[(Sqrt[2])+(Sqrt[x])+(Sqrt[2+2 (Sqrt[2]) (Sqrt[x])+2 x])])\[DifferentialD]x

Examples such as the following now return optimal answers:

∫((2 x-(y^2)+2 (Sqrt[-2 x+(y^2)])+y (Sqrt[-2 x+(y^2)]))/((2+x+2 y) (2 x-(y^2))))\[DifferentialD]x

Documentation

The reference page for Integrate is being thoroughly updated at present.

The new examples will include line integrals, surface and volume integrals, applications to probabilty, etc.

Online Education

Interactive Calculus

The Wolfram U Interactive Calculus course based on AP Calculus AB went live in September 2018.

The course includes lessons, problem sessions, quizzes, and a sample final exam.

Future Plans

We are working on benchmarking and improved documentation for basic Linear Algebra functions.

These improvements will form the basis for a Linear Algebra course in the near future,

Conclusion

Version 12 includes a rich set of features for Calculus and Algebra.

We plan to continue making such improvements for users at all levels in the near future.

Thank you!

Initialization

<<"C:\\Users\\dkapadia\\Desktop\\WTC2018WhatsNewCalcAlg\\LayLinearAlgebra.zip"