#OK to post homework #Blair Seidler, 2021-02-14, Assignment 7 with(combinat): with(plots): Help:=proc(): print(`NiceValentine()`): print(`DrawMandelbrot(R,K)`): print(`RandSPn(n)`): print(`NuAdjacentMates(SP,n)`,`EstimateAvAdjacentMates(n,K)`,`CalcAvAdjacentMates(n)`): end: # 1. MyVal:=proc(): plot([16*sin(t)^3, 13*cos(t) - 5*cos(2*t) - 2*cos(3*t) - cos(4*t), t = 0 .. 2*Pi], axes = none, color = red) end: NiceValentine:=proc(): implicitplot3d((x^2+9*y^2/4+z^2-1)^3-x^2*z^3-9*y^2*z^3/200=0, x=-2..2, y=-2..2, z=-2..2, grid=[100,100,100], style=surface,axes=none,color=red,title="I Love Experimental Mathematics", caption="Happy Valentine's Day, Dr.Z!",scaling=constrained): end: # 2. #DrawMandelbrot(R,K): plots the Mandelbrot set by picking all those complex c #(of the form x+I*y, with x,y in [-4,4] with resolution 1/R, and deciding whether #to accept it if iterating z goes to z^2+c (starting at z=0) after K iterations stay bounded. #Also send the output as .jpeg file, for R as large as possible. DrawMandelbrot:=proc(R,K) local th,f,xmin,xmax,ymin,ymax,res,pts,x,y,z,c,i: xmin:=-4: xmax:=4: ymin:=-4: ymax:=4: th:=10^3: f:=(z,c)->evalf(evalc(z^2+c)): res:=1/R: pts:=[]: x:=xmin: while x+res<=xmax do y:=ymin: while y+res<=ymax do c:=x+I*y: z:=0: for i from 1 to K do z:=f(z,c): od: if abs(z)