14.11.1.5 Numerical Calculations

We find the $ x$ such that $ e^x - 3x = 0$ .

sage: e = mathematica('Exp[x] - 3x == 0')
sage: e.FindRoot(['x', 2])
{x -> 1.512134551657842}

Note that this agrees with what the PARI interpreter gp produces:

sage: gp('solve(x=1,2,exp(x)-3*x)')
1.512134551657842473896739678              # 32-bit
1.5121345516578424738967396780720387046    # 64-bit

Next we find the minimimum of a polynomial using the two different ways of accessing Mathematica:

sage: mathematica('FindMinimum[x^3 - 6x^2 + 11x - 5, {x,3}]')
{0.6150998205402516, {x -> 2.5773502699629733}}
sage: f = mathematica('x^3 - 6x^2 + 11x - 5')
sage: f.FindMinimum(['x', 3])
{0.6150998205402516, {x -> 2.5773502699629733}}

See About this document... for information on suggesting changes.