#Please do not post homework
#James Betti, 2 Feb 2025, Assignment 1

AM := proc(G) local n,E,adj,i,e:
    n := G[1];
    E := G[2];
    adj := [[0$n]$n];
    for e in E do
        adj[e[1]][e[2]] := 1;
        adj[e[2]][e[1]] := 1;
    od;
    adj;
end:

AM([2,{{1,2}}]);

Image := proc(pi, G) local n,E,e:
    n := G[1];
    E := G[2];
    E := {seq({pi[e[1]],pi[e[2]]},e in E)};
    [n, E];
end:

# Below is some ``Maple V Primer'' scrap work.

105/25;
105/25-1/5;
%+1/5;

seq(sqrt(i),i=1..10);
evalf(%);
convert(%[2],rational);                 # changing to a float is irreversible

3*4^(1/2)+5;
simplify(%);

(x^2)^(1/2);
simplify(%);
assume(x>0);
simplify(%%);
x := 'x';                               # remove assumption about x

y := x^3+3*x^2+3*x+1;
simplify(y^(1/3));
radsimp(y^(1/3));
assume(x>-1);                           # sometimes `simplify` needs some help
simplify(y^(1/3));
assume(x<-1);
simplify(y^(1/3));
x := 'x';

p := (x+y+1)*(x-y+1)*(x-y-1);
q := expand(p);
coeff(q,x,2);
coeff(p,x,2);                           # not what we want, so be careful
degree(q,x);

x := 1: y := 2: p;
x := 'x': y := 'y': p;                  # restoring variables also changes `p`

eqn := x^2-x=1;
R := solve(eqn,x);
simplify(R[1]*R[2]);

ifactor(5003266235067621177579);
ithprime(1000000);

eqn1 := x^3+a*x=14: eqn2 := a^2-x=7:
isolve({eqn1,eqn2});
assign(%);                            # handy shortcut to put variables in scope
a := 'a': b := 'b':