Universität Leipzig, winter term 2020
Author: Jürgen Vollmer (2020)
lizence: Creative Commons Attribution-ShareAlike 4.0 International CC BY-SA 4.0
Sage is an OpenSource Project that implements a broach range of computer-based mathematics and computer algebra in a Jupyter notebook.
Documentation and information on the installation of Sage can be found at https://sagemath.org
A very nice introduction to working with Sage is given in the book Paul Zimmermann, u.a.: "Computational Mathematics with SageMath"
# declare variable that will be used
x = var("x")
derivative( sin(x), x )
remark: type and execute 'derivative( exp(2*x), x, 3 )' into the empty field below in order to see why I added the show statement
D3 = derivative( exp(2*x), x, 3 )
show(D3)
remark: type and execute 'range(4)' into the empty field below if you do not know what is doing
[ derivative( sin(x), x, k) for k in range(4) ]
the text in between the triple quotes """ ... """ is a comment that describes what the function is doing
in the present case this is so obvious that you won't need it, but for more complex functions it is extremely important, because it helps you recall what happened here when you need the function again after a few weeks
for more complex functions you should therefore also choose a name that is clearly describing the purpose of the function
def f (x) :
"""
argument: x
result: the function returns the value x^4 - x^2
"""
return x^4 - x^2
show([ derivative( f(x), x, k) for k in range(6) ])
## or: store the derivaties in the array 'diffs_of_f'
diffs_of_f = [ derivative( f(x), x, k) for k in range(6) ]
## and request the third derivative by stating
diffs_of_f[3]