Raw start (if without mcstools)
> | #restart; with(linalg):with(plots):with(plottools):eye:=n->diag(1$n): emat:=proc(i,j,k,n) local tmp; tmp:=eye(n);tmp[i,j]:=k;op(tmp);end: multrow:=(mat,row,k)-> evalm(emat(row,row,k,rowdim(mat))&*mat): multcol:=(mat,col,k)-> evalm(mat&*emat(col,col,k,coldim(mat))): |
Warning, the protected names norm and trace have been redefined and unprotected
Warning, the name changecoords has been redefined
Warning, the assigned name arrow now has a global binding
MCtools pieces
> | MCtools[PARAMS]:=proc(Defaults,Args) local Ndefs,Nargs,In_args,j,k,Not_in_args,PLOTOPTIONS,Nopts,In_PLOTOPTIONS,ARGS,NARGS,In_ARGS: PLOTOPTIONS:=[adaptive,axes,axesfont,color,coords,discont,filled,font,labels,labeldirections,labelfont,legend,linestyle,numpoints,sample,scaling,style,symbol,symbolsize,thickness,tickmarks,title,titlefont,view,xtickmarks,ytickmarks]: Nargs:=nops(Args): Ndefs:=nops(Defaults): Nopts:=nops(PLOTOPTIONS): In_PLOTOPTIONS:=NULL: for j from 1 to Nargs do for k from 1 to Nopts do if convert(lhs(Args[j]),string) = convert(PLOTOPTIONS[k],string) then In_PLOTOPTIONS:=In_PLOTOPTIONS,Args[j]:fi: od: od: ARGS:=[op({op(Args)} minus {In_PLOTOPTIONS})]: NARGS:=nops(ARGS): In_ARGS:=NULL: for j from 1 to NARGS do for k from 1 to Ndefs do if convert(lhs(ARGS[j]),string) = convert(lhs(Defaults[k]),string) then In_ARGS:=In_ARGS,Defaults[k]:fi: od: od: Not_in_args:=[op({op(Defaults)} minus {In_ARGS})]: [op(ARGS),op(Not_in_args)],[In_PLOTOPTIONS]: end: PT:= proc(LOCATION,TXT) local Args,defaults,ARGS,FONTSIZE,CLR,PLOTOPTIONS: defaults:=location=[0,0], fontsize=14,clr=black: Args:=seq([args][j],j=3..nargs): ARGS:=MCtools[PARAMS]([defaults],[Args])[1]: PLOTOPTIONS:=op(MCtools[PARAMS]([defaults],[Args])[2]): FONTSIZE:=subs(ARGS,fontsize): CLR:=subs(ARGS,clr): if nops(LOCATION)=3 then plots[textplot3d]([LOCATION[1],LOCATION[2],LOCATION[3],TXT],font=[HELVETICA,FONTSIZE], color=CLR,PLOTOPTIONS) else plots[textplot]([LOCATION[1],LOCATION[2],TXT],font=[HELVETICA,FONTSIZE], color=CLR,PLOTOPTIONS) fi: end: |
> | with(plots):with(plottools): |
Warning, the previous binding of the name arrow has been removed and it now has an assigned value
> | bu:=polygon([[-5,-3.5],[5,-3.5],[5,6],[-5,6]],color=wheat): ca:=disk([0,0],2.5,color=yellow): cb:=disk([2,2.5],2.5,color=pink): cc:=disk([-2,2.5],2.5,color=cyan): |
> | ta:=PT([0,-0.5],`A`,fontsize=24,color=navy):r1:=PT([0,-1.9],`1`,color=red): tb:=PT([2.5,3],`B`,fontsize=24,color=navy):r2:=PT([3.5,3.5],`2`,color=red): tc:=PT([-2.5,3],`C`,fontsize=24,color=navy):r3:=PT([-3.5,3.5],`3`,color=red): tu:=PT([-1,5.5],`U`,fontsize=24,color=navy):r0:=PT([0,5.5],`0`,color=red): r4:=PT([0,3.5],`4`,color=red):r5:=PT([-1,1.5],`5`,color=red):r6:=PT([1,1.5],`6`,color=red): r7:=PT([0,1.7],`7`,color=red): tit:=textplot([0,-3,`3 set Venn Diagram`],color=blue,font=[TIMES,BOLD,16]): venndiag:=[ca,cb,cc,bu,ta,tb,tc,tu,r0,r1,r2,r3,r4,r5,r6,r7,tit]: |
> | display(venndiag,axes=none); |
> | bu:=polygon([[-5,-2],[5,-2],[5,6],[-5,6]],color=wheat): #ca:=disk([0,0],2.5,color=yellow): cb:=disk([2,2.5],2.5,color=pink): ca:=disk([-2,2.5],2.5,color=cyan): |
> | #ta:=PT([0,-0.5],`A`,fontsize=24,color=navy):r1:=PT([0,-1.9],`1`,color=red): tb:=PT([2.5,3],`B`,fontsize=24,color=navy):r2:=PT([3.5,3.5],`2`,color=red): ta:=PT([-2.5,3],`A`,fontsize=24,color=navy):r3:=PT([-3.5,3.5],`1`,color=red): tu:=PT([-1,5.5],`U`,fontsize=24,color=navy):r0:=PT([0,5.5],`0`,color=red): r4:=PT([0,3.5],`3`,color=red): #r5:=PT([-1,1.5],`5`,color=red):r6:=PT([1,1.5],`6`,color=red): #r7:=PT([0,1.7],`7`,color=red): tit:=textplot([0,-3,`2 set Venn Diagram`],color=blue,font=[TIMES,BOLD,16]): venndiag2:=[ca,cb,bu,ta,tb,tu,r0,r2,r3,r4,tit]: |
> | display(venndiag2,axes=none,scaling=CONSTRAINED); |
> |
Scratch