𝕊𝕥𝕣𝕖𝕟𝕘𝕥𝕙𝕖𝕟𝕚𝕟𝕘 Mathematica throughWolfram|Alpha

Michael Trott

Wolfram|Alpha

Mathematica ⟹ WolframIAlpha

• WolframAlpha is written in Mathematica
• WolframAlpha makes extensive use of Mathematica’s algorithms

WolframIAlpha ⟹ Mathematica

• Wolfram|Alpha can be accessed from within Mathematica
• Wolfram|Alpha knows many things useful in mathematical and scientific calculations
   (data + formulas)

Accessing Wolfram|Alpha

Three methods to use Wolfram|Alpha

1) through website (mainly for visual inspection)

representations of π

2) through Esc==Esc  (mainly for visual inspection)

3) through WolframAlpha[] (very useful for programmatic use)

WolframAlpha["representations of π"]

Extracting individual pods

List available pods

WolframAlpha["representations of π", "PodIDs"]

An individual result

WolframAlpha["representations of π",{{"AlternativeRepresentations:MathematicalFunctionIdentityData",3},"Content"}]

Mathematica form of results

WolframAlpha["representations of π","MathematicaForms", 
                          IncludePods -> {"AlternativeRepresentations:MathematicalFunctionIdentityData"}]

Ten neat Wolfram|Alpha features I don’t want to talk about

More plotting functions

1) Eigenvalue plots of parametrized matrices

WolframAlpha["eigenvalues {{1, t, 2, 5}, {-t, 1-t, t^2, t + 4}, {t - t^3, 2, t, 2}, {t^2, t, -1, -t^2}}",
                            IncludePods->"EigenvaluePlot",AppearanceElements->{"Pods"}]

2) Plots of Riemann surfaces

w(z)=log(1-log(z+1))

Show[ToExpression[WolframAlpha["Log[1-Log[1+z]]",{{"RiemannSurface",1},"Content"}][[1]]], ImageSize -> 600]

WolframAlpha["branch points ln(1-ln(1+z))",{{"BranchPoints:MathematicalFunctionIdentityData",1},"FormulaData"}][[1, 2]]

3) Tetraview plots

w(z)=(z^3)

WolframAlpha["w = z^3",IncludePods->"Tetraview",AppearanceElements->{"Pods"}]

Equation solving

4) Solve Fredholm integral equations of the second kind

f(x)+x==(∫_0^1)f(y) sin(x+y)\[DifferentialD]y

WolframAlpha["f[x]+x==Integrate[f[y] Sin[x+ y],{y,0,1}]",{{"SolutionAsAFredholmIntegralEquation",1},"Content"}]

5) Solve functional equations

f(x)=f(1-x)
f(x)=f(1/x)

WolframAlpha["f(x)=f(1-x)",{{"SolutionAsAFunctionalEquation",1},"Content"}]

WolframAlpha["f(x)=f(1/x)",{{"SolutionAsAFunctionalEquation",1},"Content"}]

More calculus functions

6) Carry out Frechet derivatives

(δ/(δf(y)))(∫_a^b)g(f(x),f'(x))\[DifferentialD]x

WolframAlpha["Frechet derivative of Integrate[g[f[x], f'[x]], {x, a, b}] wrt f[y]",{{"Result",1},"Content"}]

7) Additional special functions

Uehling potential (arxiv:1110.3433)

WolframAlpha["Uehling potential",{{"Result",1},"Content"}]

Minkowski ? function

WolframAlpha["Minkowski question mark function(11/111)",{{"Result",1},"Content"}]

Units, unit conversions, and physical quantities

8) Dimensional analysis

G. I Taylor (1951) Trinity test yield approximation

WolframAlpha["pressure, mass density, energy, time, length",{{"DimensionlessCombinations",2},"Content"}]

Having fun exploring

9) Finding anthropological coincidences(?)

The importance of the number 42

WolframAlpha["meaning of life?",{{"Result",1},"Content"}]

With[{q = "round(log3(diameter of the observable universe / diameter of earth))?"},
 Column[{WolframAlpha[q,IncludePods->"Input",AppearanceElements->{"Pods"}],
              WolframAlpha[q,{{"Result",1},"Content"}]}]]

WolframAlpha["(mass of bottom quark in MeV/c^2)/(10^2 MeV/c^2)"]

WolframAlpha["ceiling(log_8((size of universe)/(Bohr radius)))"]

With[{q ="-log_11( vitamin C in a trillion of brats / dietary fiber in a cubic light year of sauerkraut)"},
Column[{WolframAlpha[q,{{"Input",1},"Content"}],WolframAlpha[q,{{"Result",1},"Content"}]}, 
Dividers->All]]

SI base unit coincidence

With[{q = "speed of light  * elementary charge * Boltzmann constant / Planck constant"},
 Column[{WolframAlpha[q,{{"Input",1},"Content"}],  WolframAlpha[q,{{"Result",1},"Content"}]}, 
Dividers->All]]

10) Quantify common mathematical idealizations

assume a spherical cow …

With[{q = "radius of a sphere with the volume of a human"},
Column[{WolframAlpha[q,{{"Input",1},"Content"}] , WolframAlpha[q,{{"Result",1},"Content"}]}, 
Dividers->All]]

Letting Wolfram|Alpha entertain you

Use randomly selected parts of Wolfram|Alpha results as inputs for Wolfram|Alpha:

makeWASlideShow[startQuery_, n_] := 
Module[{counter = 0, allPlainTexts, newQuery, newPlainTexts, usedPlainTexts, newQueryList}, 
allPlainTexts = {}; usedPlainTexts = {}; newQuery = startQuery;
    While[counter < n && newQuery =!= $Failed,
          currentWASlide = WolframAlpha[newQuery];
          newPlainTexts = WolframAlpha[newQuery, "PodPlaintext"]; 
          AppendTo[usedPlainTexts, newQuery];
          allPlainTexts = Union[Join[allPlainTexts, newPlainTexts]];
          counter++;
          newQueryList =  Select[RandomSample[newPlainTexts],(WolframAlpha[#, "PodPlaintext"] =!= {})&, 1];
          newQuery = If[newQueryList =!= {}, newQueryList[[1]],
                        If[# === {}, $Failed, 
                             If[# === {}, $Failed, #[[1]]]& @ 
                                  Select[RandomSample[#], (WolframAlpha[#, "PodPlaintext"] =!= {})&, 1]]&[        
                                                                 Complement[allPlainTexts, usedPlainTexts]]]
        ] 
      ]

Print[Framed[Dynamic[currentWASlide]]];
makeWASlideShow["population France", 1];

Three things I do want to talk about

1) Use physics formulas

2) Use function representations

3) Identify real numbers

1) Use physics formulas

Electric potential of a charged disk

Obtaining closed form solutions for many physics problems, especially multivariate ones, can be hard

chargedDiskPotentialData = WolframAlpha["charged disk","MathematicaForms", IncludePods->"PropertiesPod:PhysicalSystems"]

Φ = (chargedDiskPotentialData[[2, 1, 1, 1]] [[1]] //. chargedDiskPotentialData[[2, 1, 1, 2]]) //. 
    {Q -> 1, (Subscript[ϵ, 0]) -> 1, R-> 1, x^2 + y^2 -> r^2}

ContourPlot[Evaluate[Φ], {r, -2, 2}, {z, -2, 2}, Exclusions -> {}, Contours -> 20,
                        ColorFunction -> (ColorData["RedBlueTones"][1-#]&),
                         Epilog -> {Thickness[0.006], Line[{{-1, 0},{ 1, 0}}]}]

Show[{Graphics3D[{Black, Opacity[0.8], EdgeForm[],Polygon[Table[{Cos[φ], Sin[φ],0}, {φ, 0, 2Pi, 2Pi/240}]]}],
ContourPlot3D[Evaluate[Φ /. r -> Sqrt[x^2+y^2]], {x, -2, 2},  {y, -2, 2},{z, -2, 2}, Contours -> 3,
                             ContourStyle  -> {Blue, Yellow, Red }, RegionFunction -> (Not[#1>0&&#2<0]&),
                              MaxRecursion ->1, Mesh -> False, Axes -> False]}]

Exercise: Find periodic orbits in the field of a charged disk 
                 (E. Tresaco et al Celest. Mech. Dyn. Astron.111 ( 2011))

Magnetic field of a rectangular bar magnet

Large, verified result

rules =   WolframAlpha["rectangular bar magnet","MathematicaForms", IncludePods->{"PropertiesPod:PhysicalSystems",2}][[2, 1, 1, 2]]

BOutside =-D[(ψ //. rules)/(Subscript[M, 0]), {{x, y, z}}]

LeafCount[BOutside]

What is the maximal field strength?

Plot[Evaluate[Norm[N[BOutside /.{a->2,b->2,c->2}/. {x -> 0, y -> 1+ε, z-> 1+ε}, 20]]],
{ε, -1, 1}]

Series[BOutside /.{a->2,b->2,c->2}/. {x -> 0, y -> 1+ε, z-> 1+ε}, {ε, 0, 0}, Assumptions -> ε>0]//Quiet//FullSimplify

Absolute size

Norm[BOutside /.{a->2,b->2,c->2}/. {x -> 0, y -> 1+ε, z-> 1+ε}/.ε -> 10.^-6]

2) Use function representations

Mathematica: limits, derivatives, integrals ⟹ evaluated results (functions, expressions)

Wolfram|Alpha: (functions, expressions)  ⟹ unevaluatedlimits, derivatives, integrals

Wolfram|Alpha knows series, product, limit, integral, continued fraction representations of many functions

WolframAlpha["continued fraction representation arccos(x)",{{"ContinuedFractionRepresentations:MathematicalFunctionIdentityData",1},"Content"}]

WolframAlpha["product representation jacobi sn",{{"ProductRepresentations:MathematicalFunctionIdentityData",1},"Content"}]

Use limit representations

pseudo-differential operator (from arxiv:1105.5978)

ln((∂_x))ln(x)=?

WolframAlpha["limit representations lnx",{{"LimitRepresentations:MathematicalFunctionIdentityData",2},"Content"}]

⟹   ln((∂_x))ln(x)==(lim_(ϵ->0)) (((((((∂/(∂x))))^(Subscript[ϵ, 1]))-1)/(Subscript[ϵ, 1])))((lim_((Subscript[ϵ, 2])->0)) (((x^(Subscript[ϵ, 2]))-1)/(Subscript[ϵ, 2])))

WolframAlpha["noninteger derivative z^a",{{"FractionalDerivatives:MathematicalFunctionIdentityData",2},"Content"}]

Limit[(1/(ϵ1))(((((Gamma[ϵ2+1])/(Gamma[ϵ2-ϵ1+1]))(x^(ϵ2-ϵ1))-((Gamma[1])/(Gamma[-ϵ1+1]))(x^(-ϵ1)) -((x^(ϵ2))-1))/(ϵ2))), ϵ2->0]

Limit[%, ϵ1->0]

ln((∂_x))ln(x)=(1/6) ((π^2)-6 log(x) (log(x)+ℽ))

Use integral representations—Exercise

another pseudo-differential operator  (from arxiv:1009.5313)

Show:

((∂_x))!sin(x)=(((E^(I x)) (Gamma[I])+(E^(-I x)) (Gamma[-I]))/2)

Hint :

WolframAlpha["integral representations n!",{{"IntegralRepresentations:MathematicalFunctionIdentityData",2},"Content"}]

Use integral representations to find new sums

sum =(∑_(n=1)^∞)(((((-1))^n) BesselJ[1,n])/n)

NSum[(((((-1))^n) BesselJ[1,n])/n),{n,1,∞},
PrecisionGoal->12,VerifyConvergence->False,
Method -> "EulerMaclaurin", WorkingPrecision -> 20]

General approach: use integral or series representations for functions and exchange integration/summation order

intreps = WolframAlpha["integral representations J1(n)", "MathematicaForms"]//
Select[#, FreeQ[#, _Condition, ∞]&]&

(#[[1, 2]]& /@ (intreps    /. Integrate -> Hold[Integrate]))

integrandsAndRanges = {# /. Hold[Integrate][body_,_]:> body,
  # /. (_. Hold[Integrate][_,iter_]):> iter}& /@
(#[[1, 2]]& /@ (intreps    /. Integrate -> Hold[Integrate]))

{(∑_(n=1)^∞)(((((-1))^n) #1)/n),#2}&@@@ integrandsAndRanges

(∫_0^1)-((Sqrt[1-(t^2)])/π)\[DifferentialD]t

(∑_(n=1)^∞)(((((-1))^n) )/n)(BesselJ[1, n])==-(1/4)

Exercises:

Show:

(∑_(n=1)^∞)(1/(2^n)) (LegendreP[n, (1/2)])==(2/(Sqrt[3]))-1

(∑_(n=1)^∞)(((Subscript[H, n])(1))/((2^n) n!))==((E^3)^(1/4))-1

3) Identify real numbers

American Mathematical Monthly Problem 11592:
Evaluate the limit of -ln(n)+(∑_(k=1)^∞)(tan^(-1))((1/k))   as n->∞.

Limit[(∑_(k=1)^n)ArcTan[(1/k)]-Log[n],n->∞]

Grid[Table[With[{n=(10^ne)},
{((HoldForm[10])^ne),Quiet[NSum[ArcTan[(1/k)],{k,1,n},PrecisionGoal->12,WorkingPrecision->20]]-Log[n]}],{ne,20}],Dividers->Center]

WolframAlpha["0.301640320468"]

WolframAlpha["argument Gamma[z]",{{"ComplexCharacteristics:MathematicalFunctionIdentityData",6},"Content"}]