#============================================================================= # # Maple startup assignments # #============================================================================= # # Marc A. Murison # Astronomical Applications Dept. # U.S. Naval Observatory # 3450 Massachusetts Ave., NW # Washignton, DC 20392 # # murison@riemann.usno.navy.mil # http://riemann.usno.navy.mil/murison/ # http://riemann.usno.navy.mil/AESOP/ # #============================================================================= if STARTUP_READ <> 1 then STARTUP_READ := 1: readlib(isolate): # so we can use isolate() readlib(optimize): #------------------------------------------------------------------------------ # interface settings #------------------------------------------------------------------------------ interface( verboseproc=2, # print all procedures showassumed=0, # zap the damned tildes # labelwidth=30, # approx min width to trigger %n labels labeling=false, # no %n labels echo=1, # default screen echo prompt=`` # no command prompt (red text is enough of a clue) ): #infolevel[solve] := 1: printlevel := 2: #------------------------------------------------------------------------------ # macro substitutions #------------------------------------------------------------------------------ macro( GLOBAL=1, LOCAL=0, ON=1, OFF=0, YES=1, NO=0, TRUE=1, FALSE=0 ): macro( deg=Pi/180, arcmin=1/60*Pi/180, arcsec=1/3600*Pi/180 ): mycolors := [black,blue,red,aquamarine,sienna, green,magenta,navy,maroon,gray,turquoise]: #------------------------------------------------------------------------------ # aliases #------------------------------------------------------------------------------ alias( Id=&*(), #this bit of bizarreness creates an identity matrix fn=unapply, #vec=linalg[vector], mat=linalg[matrix], cross=linalg[crossprod], det=linalg[det], size=linalg[vectdim], rows=linalg[rowdim], cols=linalg[coldim], transpose=linalg[transpose], inverse=linalg[inverse], augment=linalg[augment], stack=linalg[stack], extend=linalg[extend], grad=linalg[grad], curl=linalg[curl], div=linalg[diverge], laplacian=linalg[laplacian], angle=linalg[angle], intparts=student[intparts] ); #------------------------------------------------------------------------------ # procedures #------------------------------------------------------------------------------ # # procedures to force a read of my utility files # read_utils := proc() global UTILS_READ; UTILS_READ:=0: read`c:/maple/utils.p`; end: read_diff := proc() global DIFFEQN_READ; DIFFEQN_READ:=0: read`c:/maple/diffeqn.p`; end: read_plot := proc() global PLOTTING_READ; PLOTTING_READ:=0: read`c:/maple/plotting.p`; end: # # common function definitions # unprotect(norm); norm := proc(A) linalg[norm](A,2); end: dot := proc(u::vector,v::vector) linalg[dotprod](u,v,'orthogonal'); end: mag := proc(u::vector) sqrt( dot(u,u) ); end: vec := proc() linalg[vector]([args]); end: mat := proc() local i; if nargs=1 and type(args[1],vector) then convert(args,matrix); else linalg[matrix]([ seq( [args[i]], i=1..nargs ) ]); fi; end: matfunc := proc( eqn::(matrix=matrix), func::procedure ) map(func,lhs(eqn),args[3..nargs]) = map(func,rhs(eqn),args[3..nargs]); end: protect( norm, dot, mag, vec, mat ); # # redefinition of Testzero and Normalizer -- a fixup to correct # erroneous limit behavior (see Heck, p. 291) # Normalizer := proc() normal( simplify(args[1]) ) end: Testzero := proc() evalb( Normalizer(args[1]) = 0 ) end: # # fix table indexing so that we can make assignments # to table/array/set/sequence elements (see Heck, p. 312) # `index/newtable` := proc( ind, tab, val ) if not assigned(tab) then tab := table(); tab[op(ind)] := op(val); elif nops([eval(tab)]) > 1 and type(ind,[integer]) #expression sequence and ind[1] >= 1 and ind[1] <= nops([eval(tab)]) then tab := op( subsop(ind[1]=op(val),[eval(tab)]) ); elif type(eval(tab),set) and type(ind,[integer]) and ind[1] >= 1 and ind[1] <= nops(eval(tab)) then tab := subsop( ind[1]=oop(val), eval(tab) ); else ERROR(`: not a table/array/set/sequence`); fi; end: #------------------------------------------------------------------------------ # default plot options #------------------------------------------------------------------------------ plots[setoptions]( axes=box, color=blue, titlefont=[TIMES,ITALIC,18], axesfont=[HELVETICA,12], labelfont=[TIMES,ROMAN,18], scaling=unconstrained ): plots[setoptions3d]( axes=box, titlefont=[TIMES,ITALIC,18], axesfont=[HELVETICA,12], labelfont=[TIMES,ROMAN,18], scaling=unconstrained, style=patch, lightmodel=light4, shading=zhue, orientation=[55,70], projection=normal ): #------------------------------------------------------------------------------ # my standard utility procedures #------------------------------------------------------------------------------ read`c:/maple/utils.p`: read`c:/maple/diffeqn.p`: read`c:/maple/plotting.p`: fi: