MS-E1621 - Algebraic Statistics D, 09.09.2020-04.12.2020
Kurssiasetusten perusteella kurssi on päättynyt 04.12.2020 Etsi kursseja: MS-E1621
First computations
It's usually a good idea to
restart
first.
Exercise 1: run commands
1+1
1/2
sqrt(5)
0..4
You do not need punctuation at the end of the lines. Most of the time, output has two lines:
- o1 - the actual answer
- o2 - the type of the answer (="what mathematical object is it? where does it live?")
Exercise 2: compare
a= 1+2
b=1+2;
Semicolon ; suppresses the printing of the output.
Exercise 3: print previous output
oo
o1
Important difference between Macaulay2 and other general computational algebra systems: you need to specify the ring where the variables live before using the variables
Exercise 4: first try
x+y
now try
R=QQ[x,y]
x+y
Notation for common rings/fields:
- ZZ - integers
- QQ - rationals
- RR - reals
- CC - complex numbers
Most of the time you'll want to use QQ.
Exercise 5: Matrices
A=matrix{{1,2},{3,4}}
B=matrix{{x,y},{x-y,x+y}}
A*B
Macaulay2 thinks of matrices as maps, so you get additional information about the map in the second line of the output.
Our best friends in this course will be ideals, so let's make some.
Exercise 6: After restarting, define a new ring and an ideal
restart
R=QQ[x_1..x_3]
I = ideal (x_1+x_2^2,x_3-x_1)