Informatics1-2018/Lab09
A MathWikiből
(Változatok közti eltérés)
(Új oldal, tartalma: „= Sage = == Server == https://sage.math.bme.hu/ You can use this, or install it on your own from here: http://www.sagemath.org/ == Tasks == === Using variables === …”) |
a |
||
1. sor: | 1. sor: | ||
+ | [[Informatics1-2018/Lab08|Previous]] - [[Informatics1-2018#Labs|Up]] - [[Informatics1-2018/Lab10|Next]] | ||
+ | |||
= Sage = | = Sage = | ||
17. sor: | 19. sor: | ||
=== Sage functions, methods === | === Sage functions, methods === | ||
− | # Is | + | # Is 2018 a prime? (use the ''is_prime()'' function) |
# Were you born on a prime day? (use the D variable!) | # Were you born on a prime day? (use the D variable!) | ||
# Solve the equation D*x^2 + M*x - b*r = 0 using the ''solve(fv, variable)'' function! (x needs to be a symbolic variable!) | # Solve the equation D*x^2 + M*x - b*r = 0 using the ''solve(fv, variable)'' function! (x needs to be a symbolic variable!) | ||
36. sor: | 38. sor: | ||
# Plot next to the previous one (using the ''show'' function) the function x^3-3*x + 6 in red! | # Plot next to the previous one (using the ''show'' function) the function x^3-3*x + 6 in red! | ||
# Plot a circle: ''cirlce((coordinates of the center), radius, optional)''. The "optional" can be: color, ''aspect_ratio=True'' so that the ratio of the x and y axis are kept, otherwise we might get an ellipse. | # Plot a circle: ''cirlce((coordinates of the center), radius, optional)''. The "optional" can be: color, ''aspect_ratio=True'' so that the ratio of the x and y axis are kept, otherwise we might get an ellipse. | ||
+ | |||
+ | [[Informatics1-2018/Lab08|Previous]] - [[Informatics1-2018#Labs|Up]] - [[Informatics1-2018/Lab10|Next]] |
A lap 2018. november 26., 13:29-kori változata
Tartalomjegyzék |
Sage
Server
You can use this, or install it on your own from here: http://www.sagemath.org/
Tasks
Using variables
- Let Y be your year of birth, M the month, and D the day, create these variables.
- How much is Y divided by D? Associate this value with the b variable.
- Let r be the remainder of Y / M.
- What's the difference r - b?
Sage functions, methods
- Is 2018 a prime? (use the is_prime() function)
- Were you born on a prime day? (use the D variable!)
- Solve the equation D*x^2 + M*x - b*r = 0 using the solve(fv, variable) function! (x needs to be a symbolic variable!)
- Solve the equation numerically! Use the find_root(fv == 0, min, max) function, where min and max defines an interval where Sage looks for the solution.
- Solve the above equation symbolically (make D, M, b, r symbolic variables, then use solve)!
- Differentiate the function sin(x)cos(x)x^2.
- Integrate the previous function.
- Calculate the limit of (1 + 3/n)^4n, if n->oo
- Let f be the following function: f = (x+2*y)^3
- Substitute 3 into x; then 4 into x and 2 into y. What's the result? ( use the subs() method of f)
- Expand f! (expand())
- Using the above, calculate the Taylor series of sin(x)cos(x)x^2 up until the 4th member. (you can differentiate and integrate a function f by f.diff(x))
Plotting with Sage (plot)
- Plot a cosine curve from 0 to 4*pi!
- Plot the (x-2)^2 + 3 polynomial from -2 to 4, color it green!
- Plot next to the previous one (using the show function) the function x^3-3*x + 6 in red!
- Plot a circle: cirlce((coordinates of the center), radius, optional). The "optional" can be: color, aspect_ratio=True so that the ratio of the x and y axis are kept, otherwise we might get an ellipse.