all: hw2sol.pdf

clean:
	rm -f hw2sol.dvi hw2sol.pdf hw2sol.log roots newtdiv newtontan \
		newtcomp stefbisect stefatan *.out phi?.i hw2sol.ps

hw2sol.dvi: hw2sol.tex roots.out newtontan.out newtcomp.out \
		xtanx.tex stefbisect.out stefatan.out newtdiv.out \
		prob361.out
	tex hw2sol

hw2sol.pdf: hw2sol.dvi
	dvipdf hw2sol

newtontan: newtontan.c
	gcc -o newtontan newtontan.c -lm

newtontan.out: newtontan
	./newtontan <wilkpoly.dat >newtontan.out

roots: roots.c
	gcc -o roots roots.c -lm

roots.out: roots
	./roots <wilkpoly.dat >roots.out

phi1.i: makephi.mpl
	maple -q -DN=1 -DF="z^2+1" makephi.mpl

phi2.i: makephi.mpl
	maple -q -DN=2 -DF="z+sin(z)-3" makephi.mpl

phi3.i: makephi.mpl
	maple -q -DN=3 -DF="z^4+z^2+2+3*I" makephi.mpl

newtcomp: newtcomp.c phi1.i phi2.i phi3.i
	gcc -o newtcomp newtcomp.c -lm

newtcomp.out: newtcomp
	./newtcomp >newtcomp.out

prob361.out: prob361.mpl
	maple -q prob361.mpl >prob361.out

xtanx.tex: xtanx.plt
	gnuplot xtanx.plt

stefbisect: stefbisect.c
	gcc -o stefbisect stefbisect.c -lm

stefbisect.out: stefbisect
	./stefbisect >stefbisect.out

stefatan: stefatan.c
	gcc -o stefatan stefatan.c -lm

stefatan.out: stefatan
	./stefatan >stefatan.out

newtdiv: newtdiv.c
	gcc -o newtdiv newtdiv.c

newtdiv.out: newtdiv
	./newtdiv >newtdiv.out
