Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168703
Image: ubuntu2004
Solve the equations in Sage Veikko Keränen -2009 Rovaniemi University of Applied Sciences veikko.keranen@ramk.fi Edited by Shijing Zhang iamshijingzhang@gmail.com
For example there is a linear polynomial, we can calculate the equation like this
solve(x^2+x-12==0,x)
[x == 3, x == -4]
solve(x^4-2*x^2+1==0,x)
[x == -1, x == 1]
Also there is another way to solve like this
x=var('x')
eqn=10*x==1000
eqn.show()
10 \, x = 1000
\newcommand{\Bold}[1]{\mathbf{#1}}\hbox{}
eqn1=eqn.multiply_both_sides(1/10)
eqn1.show()
x = 100
\newcommand{\Bold}[1]{\mathbf{#1}}\hbox{}
If there are more than one variable, please do like this
x,y=var('x,y')
solve([x+y==6, x-y==4],x,y)
\newcommand{\Bold}[1]{\mathbf{#1}}\left[\left[x = 5, y = 1\right]\right]
solve([x+y==10, x-y==3],x,y)
\newcommand{\Bold}[1]{\mathbf{#1}}\left[\left[x = \left(\frac{13}{2}\right), y = \left(\frac{7}{2}\right)\right]\right]
solve(2^x==6,x)
\newcommand{\Bold}[1]{\mathbf{#1}}\left[x = \frac{\log\left(6\right)}{\log\left(2\right)}\right]
Differential equation
diff(x^2,x)
\newcommand{\Bold}[1]{\mathbf{#1}}2 \, x
diff(x^3,x)
\newcommand{\Bold}[1]{\mathbf{#1}}3 \, x^{2}
diff(sin(2*x),x)
\newcommand{\Bold}[1]{\mathbf{#1}}2 \, \cos\left(2 \, x\right)
Limit value
var('x')
\newcommand{\Bold}[1]{\mathbf{#1}}x
f=(x**2+x-6)/(x-2)
f.show()
\frac{{(x^{2} + x - 6)}}{{(x - 2)}}
\newcommand{\Bold}[1]{\mathbf{#1}}\hbox{}
f.limit(x=2)
\newcommand{\Bold}[1]{\mathbf{#1}}5
f=(sqrt(x+2)-3)/(x-7)
f.show()
\frac{{(\sqrt{x + 2} - 3)}}{{(x - 7)}}
\newcommand{\Bold}[1]{\mathbf{#1}}\hbox{}
f.limit(x=7)
\newcommand{\Bold}[1]{\mathbf{#1}}\frac{1}{6}
f.numerator()
\newcommand{\Bold}[1]{\mathbf{#1}}\sqrt{x + 2} - 3
fn=f.numerator()*(sqrt(x+2)+3)
fn.show()
{(\sqrt{x + 2} - 3)} {(\sqrt{x + 2} + 3)}
\newcommand{\Bold}[1]{\mathbf{#1}}\hbox{}
fn.expand().show()
x - 7
\newcommand{\Bold}[1]{\mathbf{#1}}\hbox{}
f.denominator()
\newcommand{\Bold}[1]{\mathbf{#1}}x - 7