Sage Quick Reference: Calculus William Stein Sage Version 3.4 Http

Sage Quick Reference: Calculus William Stein Sage Version 3.4 Http

Sage Quick Reference: Calculus William Stein Simplifying and expanding Integrals Sage Version 3.4 Below f must be symbolic (so not a Python function): f(x)dx = integral(f,x) = f.integrate(x) http://wiki.sagemath.org/quickref Simplify: f.simplify_exp(), f.simplify_full(), integral(x*cos(x^2), x) GNU Free Document License, extend for your own use ! f.simplify_log(), f.simplify_radical(), b f(x)dx = integral(f,x,a,b) f.simplify_rational(), f.simplify_trig() a integral(x*cos(x^2), x, 0, sqrt(pi)) ! Expand: f.expand(), f.expand_rational() b Builtin constants and functions f(x)dx numerical_integral(f(x),a,b)[0] a ≈ numerical_integral(x*cos(x^2),0,1)[0] Constants: π = pi e = e i = I = i Equations ! = oo = infinity NaN=NaN log(2) =log2 assume(...): use if integration asks a question ∞ Relations: f = g: f == g, f = g: f != g, φ = golden_ratio γ = euler_gamma f g: f <= g, f & g: f >= g, assume(x>0) 0.915 catalan 2.685 khinchin f <≤ g: f < g, f >≥ g: f > g ≈ ≈ 0.660 twinprime 0.261 merten 1.902 brun Taylor and partial fraction expansion ≈ ≈ ≈ Solve f = g: solve(f == g, x), and Approximate: pi.n(digits=18) = 3.14159265358979324 solve([f == 0, g == 0], x,y) Taylor polynomial, deg n about a: n Builtin functions: sin cos tan sec csc cot sinh taylor(f,x,a,n) c0 + c1(x a) + + cn(x a) solve([x^2+y^2==1, (x-1)^2+y^2==1],x,y) ≈ − · · · − cosh tanh sech csch coth log ln exp ... Solutions: taylor(sqrt(x+1), x, 0, 5) S = solve(x^2+x+1==0, x, solution_dict=True) Partial fraction: Defining symbolic expressions S[0]["x"] S[1]["x"] are the solutions (x^2/(x+1)^3).partial_fraction() Create symbolic variables: Exact roots: (x^3+2*x+1).roots(x) var("t u theta") or var("t,u,theta") Real roots: (x^3+2*x+1).roots(x,ring=RR) Numerical roots and optimization Use * for multiplication and ^ for exponentiation: Complex roots: (x^3+2*x+1).roots(x,ring=CC) Numerical root: f.find_root(a, b, x) 5 2x + √2 = 2*x^5 + sqrt(2) (x^2 - 2).find_root(1,2,x) Typeset: show(2*theta^5 + sqrt(2)) 2θ5 + √2 Maximize: find (m, x ) with f(x ) = m maximal −→ 0 0 Factorization f.find_maximum_on_interval(a, b, x) Symbolic functions Factored form: (x^3-y^3).factor() Minimize: find (m, x0) with f(x0) = m minimal Symbolic function (can integrate, differentiate, etc.): List of (factor, exponent) pairs: f.find_minimum_on_interval(a, b, x) f(a,b,theta) = a + b*theta^2 (x^3-y^3).factor_list() Minimization: minimize(f, start point) Also, a “formal” function of theta: minimize(x^2+x*y^3+(1-z)^2-1, [1,1,1]) f = function(’f’,theta) Limits lim f(x) = limit(f(x), x=a) Multivariable calculus Piecewise symbolic functions: x a → Piecewise([[(0,pi/2),sin(x)],[(pi/2,pi),x^2+1]]) limit(sin(x)/x, x=0) Gradient: f.gradient() or f.gradient(vars) (x^2+y^2).gradient([x,y]) lim f(x) = limit(f(x), x=a, dir=’plus’) x a+ → Hessian: f.hessian() limit(1/x, x=0, dir=’plus’) (x^2+y^2).hessian() lim f(x) = limit(f(x), x=a, dir=’minus’) Jacobian matrix: jacobian(f, vars) x a → − limit(1/x, x=0, dir=’minus’) jacobian(x^2 - 2*x*y, (x,y)) Summing infinite series Python functions Derivatives Defining: d (f(x)) = diff(f(x),x) = f.diff(x) dx ∞ 1 π2 def f(a, b, theta=1): ∂ (f(x, y)) = diff(f(x,y),x) = ∂x n2 6 n=1 c = a + b*theta^2 diff = differentiate = derivative " return c diff(x*y + sin(x^2) + e^(-x), x) Not yet implemented, but you can use Maxima: Inline functions: s = ’sum (1/n^2,n,1,inf), simpsum’ SR(sage.calculus.calculus.maxima(s)) π2/6 f = lambda a, b, theta = 1: a + b*theta^2 −→.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    1 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us