Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168731
Image: ubuntu2004

Basic examples of Sage

Multiplying Two Numbers

245365768\displaystyle 24536*5768

24536*5768

Evaluating Sine

sinπ2\displaystyle \sin \frac {\pi}2

sin(pi/2)

Evaluating Natural Logarithm

ln2\displaystyle \ln 2

log(2)

Finding a Numerical Approximation to Natural Logarithm

ln2\displaystyle \ln 2

n(log(2))

Finding a Limit

limx0sinxx\displaystyle \lim_{x \to 0} \frac {\sin x}x

limit(sin(x)/x, x=0)

Evaluating a Sum

15n2+1\displaystyle \sum_1^5 \sqrt{n^2 +1}

sum(sqrt(n^2 +1) for n in [1..5])

Finding a Numerical Approximation to a Sum

15n2+1\displaystyle \sum_1^5 \sqrt{n^2 +1}

n(sum(sqrt(n^2 +1) for n in [1..5]))

Finding the Derivative of a Function of One Variable

ddx[sin(x2+6x2)]\displaystyle \frac d{dx} [\sin (x^2 + 6x - 2)]

diff(sin(x^2 + 6*x - 2), x)

Finding the Indefinite Integral of a Function of One Variable

lnxdx\displaystyle \int \ln x\, dx

integral(ln(x), x)

Finding the Definite Integral of a Function of One Variable

35lnxdx\displaystyle \int_3^5 \ln x\, dx

integral(ln(x), x, 3, 5)

Finding a Numerical Approximation to a Definite Integral of a Function of One Variable

35lnxdx\displaystyle \int_3^5 \ln x\, dx

n(integral(ln(x), x, 3, 5))

Plotting the Graph of a Function of One Variable

f(x)=4x6x23+2\displaystyle f(x) = 4x - 6x^{\frac 23} + 2

x = var('x') plot(4*x - 6*((x^2)^(1/3)) + 2, (x,-5,5))

Plotting the Graphs of Two Functions of One Variable

The graph of f(x)=x2\displaystyle f(x) = x^2 is in blue.

The graph of g(x)=cosx\displaystyle g(x) = - \cos x is in red.

x = var('x') P = plot(x^2, (x,-5,5)) Q = plot(-cos(x), (x,-5,5), color='red') P + Q