Informatics1-2017/Practice10

A MathWikiből
(Változatok közti eltérés)
(Tasks)
 
(egy szerkesztő 4 közbeeső változata nincs mutatva)
42. sor: 42. sor:
 
Now write '''V.''' and press '''TAB'''. Now we can see all the possible operations with '''V'''. Writing a questionmark at the end of a command gives a detailed description of the command. For example:
 
Now write '''V.''' and press '''TAB'''. Now we can see all the possible operations with '''V'''. Writing a questionmark at the end of a command gives a detailed description of the command. For example:
 
<python>
 
<python>
V.bases?
+
V.basis?
 
</python>
 
</python>
 
Try it:
 
Try it:
 
<python>
 
<python>
V.bases()
+
V.basis()
 
</python>
 
</python>
  
54. sor: 54. sor:
 
* Login with the username and password provided.
 
* Login with the username and password provided.
  
* Jobb fent a '''Settings''' menüben változtassuk meg a jelszavunkat (lehetõleg ne az legyen, mint a leibniz-es password).
+
* Top right '''Settings''' change your password.
  
* Ha újra bejelentkeztünk akkor bal fent a '''New Worksheet''' linkkel tudunk új munkamenetet indítani.
+
* After logging in again with the new password, you can open a new notebook with '''New Worksheet'''.
* Ezt el is kell neveznünk, legyen mondjuk '''Gyak10'''
+
* Name it something like '''Practical10'''
  
=== Első próbálkozások ===
+
=== Introduction ===
  
* A cellákba írhatunk sage parancsokat, akár többet is. Próbáljuk is ki:
+
* You can write any sage command in the cells, even multiple ones, for example:
 
<python>
 
<python>
 
A = Matrix([[1, 1], [1, 0]])
 
A = Matrix([[1, 1], [1, 0]])
 
B = Matrix([[-2, 0], [-1, 1]])
 
B = Matrix([[-2, 0], [-1, 1]])
 
</python>
 
</python>
* '''SHIFT + ENTER'''-el tudjuk lefuttatni a parancsokat. Ekkor sorban futnak le egymás után az egy cellában levõ parancsok.
+
* Run the commands with '''SHIFT + ENTER'''. The commands run one after the other.
* Próbáljuk ki, hogy egy új cellába beírjuk, hogy '''A''' vagy '''B''' és lefuttatjuk. Majd próbáljuk ki az '''A*B'''-t.
+
* Try writing just '''A''' or '''B''' in a cell and run it. Then try '''A*B'''.
  
== Feladatok ==
+
== Tasks ==
  
=== Változók használata ===
+
=== Using variables ===
  
# Legyen Y a születési éved, M a születési hónapod, és D a születésed napja, ezekhez vedd fel a három változót.
+
# Let Y be your year of birth, M the month, and D the day, create these variables.
# Hányszor van meg D Y-ban? Legyen az érték a b változóhoz rendelve.
+
# How much is Y divided by D? Associate this value with the b variable.
# Legyen r a születési évednek a hónappal vett maradéka.
+
# Let r be the remainder of Y / M.
# Mennyi most b és r különbsége?
+
# What's the difference r - b?
  
=== Beépített Sage függvények, metódusok ===
+
=== Sage functions, methods ===
  
# Prímszám-e 2011? (használd az ''is_prime()'' függvényt)
+
# Is 2017 a prime? (use the ''is_prime()'' function)
# Prímedik napján születtél-e a hónapnak? (használd a D változót!)
+
# Were you born on a prime day? (use the D variable!)
# Oldd meg a D*x^2 + M*x - b*r = 0  egyenletet a ''solve(fv, változó)'' függvény segítségével! (Ne felejtsd el bevezetni az x-et szimbolikus változóként!)
+
# Solve the equation D*x^2 + M*x - b*r = 0  using the ''solve(fv, variable)'' function! (x needs to be a symbolic variable!)
# Numerikusan is oldd meg az egyenletet! Használd a ''find_root(fv == 0, min, max)''  függvényt.
+
# 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.
# Oldd meg a fenti egyenletet szimbolikusan is (fejezd ki x-et b, D, M és r-rel)!
+
# Solve the above equation symbolically (make D, M, b, r symbolic variables, then use solve)!
# Deriváld le az sin(x)cos(x)x^2 függvényt.
+
# Differentiate the function sin(x)cos(x)x^2.
# Integráld le az elõzõ függvényt.
+
# Integrate the previous function.
# Számold ki a határértékét az (1 + 3/n)^4n függvénynek, ha n->oo
+
# Calculate the limit of (1 + 3/n)^4n, if n->oo
# Legyen f a következő függvény: f = (x+2*y)^3
+
# Let f be the following function: f = (x+2*y)^3
# Helyettesíts be x helyére 3-at; utána x helyére 4-et és y helyére 2-t. Mennyi az eredmény? ( használd f-nek a ''subs()'' függvényét)
+
# Substitute 3 into x; then 4 into x and 2 into y. What's the result? ( use the ''subs()'' method of f)
# Bontsd összeggé f-et! (''expand()'')
+
# Expand f! (''expand()'')
# Az elõbb tanultakat használva, számold ki az 4. tagig a sin(x)cos(x)x^2 függvény [https://hu.wikipedia.org/wiki/Taylor-sor Taylor-sorát] (deriválni / integrálni, ha '''f''' egy függvény úgy is lehet, hogy '''f.diff(x)''')
+
# Using the above, calculate the [https://en.wikipedia.org/wiki/Taylor_series 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)''')
  
=== Rajzolás a Sage segítségével (plot) ===
+
=== Plotting with Sage (plot) ===
  
# Rajzolj egy cosinus-görbét 0-tól 4*pi -ig!  
+
# Plot a cosine curve from 0 to 4*pi!  
# Rajzold ki az (x-2)^2 + 3 másodfokú polinomot -2-től 4-ig, zöld színnel!
+
# Plot the (x-2)^2 + 3 polynomial from -2 to 4, color it green!
# Rajzold az előző mellé (a ''show'' függvénnyel) az x^3-3*x + 6 harmadfokú polinomot pirossal!
+
# Plot next to the previous one (using the ''show'' function) the function x^3-3*x + 6 in red!
# Rajzoljunk kört: ''cirlce((középpont koordinátái), sugár, egyebek)''. Az "egyebek" lehetnek: szín, ''aspect_ratio=True'' hogy az x és y tengelyek skálázása azonos legyen (különben ellipszist kaphatunk!).
+
# 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.
 
+
=== Polinomgyûrûk és vektorterek ===
+

A lap jelenlegi, 2017. november 13., 15:01-kori változata

Tartalomjegyzék

Using Sage

Sage server

https://sage.math.bme.hu/

If your browser finds the certificate untrustworthy, accept it manually!

Public

SageMathCloud

From home (if you want to install, optional)

http://doc.sagemath.org/html/en/installation/index.html

Command line

On leibniz write sage into a command prompt, this starts the sage interactive shell.

Most sage commands work here, for example:

23^19

Tasks

  1. Calculate the squareroot of 2017!
  2. Caltulate the 4th root of 2017!
  3. Calculate the 2017^6!
  4. What's the remaider of 123*321 divided by 11?

Text completion and help

Sage can complete your commands, try the following:

V = Vec[press TAB]

Sage completes the command to Vector, and offers additional options. Complete it to match the following:

V = VectorSpace(QQ,3)

This way V will be the 3 dimensional vector space over the rational field.

Now write V. and press TAB. Now we can see all the possible operations with V. Writing a questionmark at the end of a command gives a detailed description of the command. For example:

V.basis?

Try it:

V.basis()

Sage notebook

  • Go to the sage notebook page: notebook
  • Login with the username and password provided.
  • Top right Settings change your password.
  • After logging in again with the new password, you can open a new notebook with New Worksheet.
  • Name it something like Practical10

Introduction

  • You can write any sage command in the cells, even multiple ones, for example:
A = Matrix([[1, 1], [1, 0]])
B = Matrix([[-2, 0], [-1, 1]])
  • Run the commands with SHIFT + ENTER. The commands run one after the other.
  • Try writing just A or B in a cell and run it. Then try A*B.

Tasks

Using variables

  1. Let Y be your year of birth, M the month, and D the day, create these variables.
  2. How much is Y divided by D? Associate this value with the b variable.
  3. Let r be the remainder of Y / M.
  4. What's the difference r - b?

Sage functions, methods

  1. Is 2017 a prime? (use the is_prime() function)
  2. Were you born on a prime day? (use the D variable!)
  3. Solve the equation D*x^2 + M*x - b*r = 0 using the solve(fv, variable) function! (x needs to be a symbolic variable!)
  4. 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.
  5. Solve the above equation symbolically (make D, M, b, r symbolic variables, then use solve)!
  6. Differentiate the function sin(x)cos(x)x^2.
  7. Integrate the previous function.
  8. Calculate the limit of (1 + 3/n)^4n, if n->oo
  9. Let f be the following function: f = (x+2*y)^3
  10. Substitute 3 into x; then 4 into x and 2 into y. What's the result? ( use the subs() method of f)
  11. Expand f! (expand())
  12. 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)

  1. Plot a cosine curve from 0 to 4*pi!
  2. Plot the (x-2)^2 + 3 polynomial from -2 to 4, color it green!
  3. Plot next to the previous one (using the show function) the function x^3-3*x + 6 in red!
  4. 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.
Személyes eszközök