NUMERICAL MATHEMATICS

xacc = 123.123456789123456789

Precision[xacc]

?Precision

Accuracy[xacc]

?Accuracy

N[xacc,9]

N[Pi]

Precision[%]

Precision[1.]

$MachinePrecision

Exp[ N[ 2 Pi I] ]

Chop[%]

0/0

1/0

DirectedInfinity[]




ComplexInfinity

Abs[%]

1/%

Numerical Root Finding

x^5 - x^2 + 17 x + 1 == 0

NSolve[%, x]

f[x_] := 1 + x^2 Sin[x] - Tan[ Log[x^2+1] ]

NSolve[ f[x] == 0, x ] ;

FindRoot[ f[x] == 0, {x,1} ]

Plot[ f[x], {x,-3,3}]

FindRoot[ f[x], {x,1.5}]

Plot[ Sqrt[Abs[x-1]], {x,-2,3} ]

FindRoot[ Sqrt[Abs[x-1]] == 0, {x,0,3},
            AccuracyGoal  -> 6,
            DampingFactor -> 0.5,
            MaxIterations -> 100  ]

Sqrt[Abs[x-1]] /. %

funcs = {y^x-x, y^x Log[y]-1}

FindRoot[ funcs, {x,1}, {y,2} ]

funcs /. %

FindMinimum[ Sin[x^2+y^2], {x,1},{y,1} ]

N[Sqrt[3 Pi/4]]

Numerical Integration

NIntegrate[1/Sqrt[x], {x,0,1}, WorkingPrecision -> 30 ]

Precision[%]

Pade Approximants

ser = Series[ Log[ 1+x], {x,0,12} ]

<< Calculus`Pade`

??Pade

Pade[ Normal[ser], {x,0,6,6} ]

NRoots[ Denominator[%] == 0, x ]