# OK to post homework # Aurora Hiveley, 02/11/24, Valentine Help:= proc(): print(`valentine()`): end: # copied from class HelpC:= proc(): print(`CC(P,k1) `): end: ### caesar code #CC(P,k1): Implements the Caesar Code #Inputs a message, given a list of characters, P (in lower case) #and an integer k from 0 to 25, outputs the encrypted message #For example #CC([d,o,r,o,n],2); should output [f,q,t,q,p] CC:=proc(P,k1) local A,T,i1: A:=[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]: for i1 from 1 to nops(A) do T[A[i1]]:=A[(i1+k1-1 mod 26)+1]: od: [seq(T[P[i1]],i1=1..nops(P))]: end: ### encode message and convert to string txt := [i,l,o,v,e,c,o,d,i,n,g,t,h,e,o,r,y]: code := CC(txt,23); msg := cat(seq(convert(i,string), i in code)); ### build graphics valentine := proc() local t,p: with(plots): t := textplot([0,0.25,msg],'align'={'above'}): p := animate(implicitplot,[x^2 + (y - (x^2)^(1/3))^2 = A, x = -3 .. 3, y = -3 .. 3, color="DeepPink", linestyle="dashdot"], A=1..4, trace=4, axes=none): display({p,t}, 'view' = [-3..3,-3..3]); end: