How to run FriCAS in a virtual machine
Explains how to download and install a virtual appliance that contains FriCAS
FriCAS is a free Computer Algebra System.
Download and import the virtual machine
- As a prerequisite you should have a virtual machine player installed. The virtual machine below was created with Oracle's VirtualBox, but since it was exported into a standard format, it should also be possible to import it into VMware player, Windows Virtual PC, and others.
- Download the virtual appliance fricas.ova (or try the VirtualBox disk image fricas.vdi).
sha1sum fricas.* 4b4423161597c8d546d75fe22f0ccffcafc30f92 fricas.ova b25343551ce4a4a34eb68b8f07bc60cfe3a2d482 fricas.vdi
- Start VirtualBox and got to File->Import Appliance.
- Choose fricas.ova and click "Import". (For those that do not use fricas.ova: You first have to create a new VirtualBox virtual machine and add fricas.vdi as an existing disk image. The fricas.vdi file will probably not work with VMWare or VirtualPC.)
Do some computations inside FriCAS
- Start the fricas virtual machine.
- Log in as "me" (password "me").
- Click on the little yellow icon on the bottom bar or start a terminal and type "efricas&" (without quotes).
- Two windows will pop up. One contains the documentation and the other one is your input window.
- The Fricas prompt looks like "(1) -> " where the number will increase with every input.
- Computations with permutations.
(1) -> P:=Permutation Integer (1) Permutation(Integer) Type: Type (2) -> p(x)==coercePreimagesImages([[i for i in 1..#x], x])$P; Type: Void (3) -> show(x) == (n:=5; matrix [[i for i in 1..n],[x i for i in 1..n]]); Type: Void (4) -> f := p [3,4,2,5,1]; g := p [3,5,2,4,1]; h := p [5,1,3,4,2]; Type: Permutation(Integer) (5) -> show(g * h * f)
+1 2 3 4 5+ (5) | | +2 4 3 5 1+ Type: Matrix(Integer) (6) -> show(g^2*h^2) +1 2 3 4 5+ (6) | | +1 3 5 4 2+ Type: Matrix(Integer) (7) -> show(g^(-1) * h^(-1)) +1 2 3 4 5+ (7) | | +3 2 1 4 5+ Type: Matrix(Integer) - Computations in finite rings and fields.
(1) -> Z5 := PrimeField 5 (1) PrimeField(5) Type: Type (2) -> a: Z5 := 3; b: Z5 := 2; Type: PrimeField(5) (3) -> a+b (3) 0 Type: PrimeField(5) (4) -> a*b (4) 1 Type: PrimeField(5) (5) -> a/b (5) 4 Type: PrimeField(5) (6) -> Z6 := IntegerMod 6 (6) IntegerMod(6) Type: Type (7) -> u: Z6 := 2; v: Z6 := 3; Type: IntegerMod(6) (8) -> u+v (8) 5 Type: IntegerMod(6) (9) -> u*v (9) 0 Type: IntegerMod(6) (10) -> -- Z6 is not a field, i.e. there is no division (10) -> u/v There are 12 exposed and 12 unexposed library operations named / having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op / to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation. Cannot find a definition or applicable library operation named / with argument type(s) IntegerMod(6) IntegerMod(6) Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. (11) -> Z100 := IntegerMod 100 (11) IntegerMod(100) Type: Type (12) -> n: Z100 := 0; for i in 1..100 repeat n := n + i::Z100; n (12) 50 Type: IntegerMod(100)
- Complex Numbers
(1) -> Q := Fraction Integer (1) Fraction(Integer) Type: Type (2) -> C := Complex Q (2) Complex(Fraction(Integer)) Type: Type (3) -> %i -- The imaginary unit is represented by %i. (3) %i Type: Complex(Integer) (4) -> r:C := 3+4*%i; s:C := 7-2*%i; Type: Complex(Fraction(Integer)) (5) -> r+s (5) 10 + 2%i Type: Complex(Fraction(Integer)) (6) -> r*s (6) 29 + 22%i Type: Complex(Fraction(Integer)) (7) -> r/s 13 34 (7) -- + -- %i 53 53 Type: Complex(Fraction(Integer)) (8) -> r^2 (8) - 7 + 24%i Type: Complex(Fraction(Integer)) (9) -> -- sqrt norm x is basically the same as |x|. (9) -> sqrt norm r (9) 5 Type: AlgebraicNumber (10) -> sqrt norm s +--+ (10) \|53 Type: AlgebraicNumber (11) -> E := Expression Integer (11) Expression(Integer) Type: Type (12) -> polar(x:C): Record(radius:AlgebraicNumber, arg: Expression Integer)_
== [sqrt norm x,_
(r:=real x; i:=imag x;_
if r=0 then_
if i=0 then error "argument cannot be computed"_
else if i>0 then %pi/2_
else -%pi/2_
else (a := atan(i/r);_
if r>0 then a else if i<0 then a-%pi else a+%pi))] Type: Void (13) -> polar r 4 (13) [radius= 5,arg= atan(-)] 3 Type: Record(radius: AlgebraicNumber,arg: Expression(Integer)) (14) -> polar s +--+ 2 (14) [radius= \|53 ,arg= - atan(-)] 7 Type: Record(radius: AlgebraicNumber,arg: Expression(Integer)) (15) -> polar(1+%i) +-+ %pi (15) [radius= \|2 ,arg= ---] 4 Type: Record(radius: AlgebraicNumber,arg: Expression(Integer)) (16) -> toComplex(rad:Q, phi:E):Complex(E) == rad*(cos phi + %i*sin(phi)) Type: Void (17) -> toComplex(2,%pi) Compiling function toComplex with type (Fraction(Integer),Expression (Integer)) -> Complex(Expression(Integer)) (17) - 2 Type: Complex(Expression(Integer)) (18) -> polar(-2) (18) [radius= 2,arg= %pi] Type: Record(radius: AlgebraicNumber,arg: Expression(Integer)) (19) -> toComplex(1,%pi/6) +-+ \|3 1 (19) ---- + - %i 2 2 Type: Complex(Expression(Integer)) (20) -> eq := (z-r)*(z-s) 2 (20) z + (- 10 - 2%i)z + 29 + 22%i Type: Polynomial(Complex(Fraction(Integer))) (21) -> solve(eq,z) (21) [z= 7 - 2%i,z= 3 + 4%i] Type: List(Equation(Fraction(Polynomial(Complex(Integer))))) - Solving linear equations
(1) -> e := [3*x+2*y-4*z, 2*x-3*y+z, x+2*y+z] (1) [- 4z + 2y + 3x,z - 3y + 2x,z + 2y + x] Type: List(Polynomial(Integer)) (2) -> sol := first solve([e.1=-2, e.2=1/2, e.3=0]) 16 11 1 (2) [z= --,y= - --,x= - -] 45 90 9 Type: List(Equation(Fraction(Polynomial(Integer)))) (3) -> [subst(e.i, sol) for i in 1..3] 1 (3) [- 2,-,0] 2 Type: List(Expression(Integer))