Page 50
var('a,b')
# We declare to the program that symbols 'a' and 'b' are variables.
(3*a*(2*b+4)+3*b*(2*a+5)).expand() # Multiplication has to be written explicitly.
var('a,b')
# We declare to the program that symbols 'a' and 'b' are variables.
show((3*a*(2*b+4)+3*b*(2*a+5)).expand()) # Better notation
Page 56
show((6661029375).factor())
Page 59
gcd(gcd(135,2520),300)
lcm(lcm(135,2520),300)
Page 123
var('m,n,k')
show(((6*m^3*n^3*k+4*m^2*n^4)/(2*m^3*n^3)).simplify_full())
Page 154
solve((1+2*(4-x))/2-(2-x)/3==(6-2*x)/4+5/2,x) # The sign for equality in the equation is written as ==!
Page 161
var('R,R1,R2')
show(solve(1/R==1/R1+1/R2,R2))
Page 170
var('y')
solve([-3*x+5*y==8,x+7*y==6],x,y)
Page 171
var('s1,s2,t,v1,v2,d')
show(solve([s1==v1*t,s2==v2*t,d==s1+s2],s1,s2,t))
Page 222
Rational(0.25), (2/3).n(), Rational(2/3.n()), (Rational(0.25)).n()
Page 260
print(pi.n()) # We calculate number pi to SageMath default precision.
print(pi.n(digits = 50)) # We calculate number pi to 50 significant digits.
print(round(pi,5)) # We round number pi to the fifth decimal.
Page 281
var('t')
plot(10*t-5*t^2,(t,0,3), ymin = 0, aspect_ratio=1)
# First input in the command is the function we are plotting,
# second input tells us the interval on which we plot it,
# the remaining two inputs are optional,
#- the first sets the lower limit to value plotting,
# since we are not interested in negative heights,
#- the second says that the same units are on both axes.
Page283
plot(x^3-x,(x,-2,2),ymin = -2, ymax=2, aspect_ratio = 1)
Page 284
var('y')
implicit_plot(x^2+y^2==1, (x,-2,2),(y,-2,2), aspect_ratio = 1, axes = true,frame = false)
# The first two inputs tell the software which equation we are plotting
# and in which area of the plane.
# Other inputs are optional – the last two define
# that we will get a coordinate system with axes and not frames,
# which is default for the command implicit_plot.
Page 285
var('y')
implicit_plot((x^2+y^2)^2==4*(x^2-y^2), (x,-2.5,2.5),(y,-1,1), aspect_ratio = 1, gridlines = 'minor')+implicit_plot(x^2+y^2==1, (x,-2.5,2.5),(y,-1,1), axes = true,frame = false, color = 'red')