file qdrawcode.txt Maxima code for Ch. 13: 2d Plots and Graphics using qdraw and wxqdraw Maxima by Example April, 2018 Edwin L (Ted) Woollett http://www.csulb.edu/~woollett woollett@charter.net 1 2D Plots and Graphics using the qdraw package (%i1) load(draw); (%i2) load(qdraw); -------------------------------------------------- 2 qdraw or wxqdraw Syntax Summary If you are using wxMaxima with display2d:true, then these examples will produce inline plots **if** you replace 'qdraw' with 'wxqdraw'. See wxqdraw.wxm for examples. -------------------------------------------------- 3 Quick Plots for Explicit Functions: ex(...) and ex1(...) (%i3) qdraw ( ex (cos(x), x, 0, 6))$ (%i4) qdraw ( ex (cos(x), x, 0, 6, lc(red)))$ [syntax error] (%i5) qdraw ( ex1 (cos(x), x, 0, 6, lc(red)))$ (%i6) qdraw ( ex1 (cos(x), x, 0, 6, lc(red)), more (xlabel = "X", ylabel = "COS(X)", title = "single function"))$ (%i7) qdraw ( ex1 (cos(x), x, 0, 6, lc(red)), line ( 0,0,6,0, lc(brown), lw(1)), more (xlabel = "X", ylabel = "COS(X)", title = "single function"))$ (%i8) qdraw ( ex1 (cos(x), x, 0, 6, lc(red)), yr (-1.2, 1.2), line ( 0,0,6,0, lc(brown), lw(1)), more (xlabel = "X", ylabel = "COS(X)", title = "single function"))$ (%i9) qdraw ( ex ( [x,x^2,x^3],x,-3,3), line ( -3,0,3,0, lc(brown), lw(1)), more (xlabel = "X", title = "Using ex(..) for three functions"))$ (%i10) qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2), line ( -3,0,3,0, lc(brown), lw(1)), key (bottom), more (xlabel = "X", title = "Using ex(..) for three functions"))$ (%i11) qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2), line ( -3,0,3,0, lc(brown), lw(1)), key (bottom), pts ( [ [-1,-1], [0,0],[1,1] ] ), more (xlabel = "X", title = "Using ex(..) for three functions"))$ (%i12) qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2), line ( -3,0,3,0, lc(brown), lw(1)), key (bottom), pts ( [ [-1,-1], [0,0],[1,1] ], ps(2), pc(magenta)), more (xlabel = "X", title = "Using ex(..) for three functions"))$ (%i13) qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2), line ( -3,0,3,0, lc(brown), lw(1)), key (bottom), pts ( [ [-1,-1], [0,0],[1,1] ], ps(2), pc(magenta), pk("intersections")), more (xlabel = "X", title = "Using ex(..) for three functions"))$ (%i14) default_colors(15)$ (%i15) (L1:[[-1,-1],[-1,0],[-1,1]], L2:[[1,-1],[1,0],[1,1]], qdraw ( pts(L1), pts(L2), xr(-2,2),yr(-2,2)))$ (%i16) mycL : [aquamarine,beige,blue,brown,cyan,gold,goldenrod,green,khaki, magenta,orange,pink,plum,purple,red,salmon,skyblue,turquoise, violet,yellow ]$ (%i17) show_colors(mycL,10)$ (%i18) qdraw( ex1(bessel_j(0,x),x,0,20,lc(red),lw(6),lk("bessel_j ( 0, x)") ), ex1(bessel_j(1,x),x,0,20,lc(blue),lw(5),lk("bessel_j ( 1, x)")), ex1(bessel_j(2,x),x,0,20,lc(brown),lw(4),lk("bessel_j ( 2, x)") ), ex1(bessel_j(3,x),x,0,20,lc(green),lw(3),lk("bessel_j ( 3, x)") ) )$ (%i19) qdraw(line(0,0,50,0,lc(red),lw(2) ), ex1(bessel_j(0, sqrt(x)),x,0,50 ,lc(blue), lw(7),lk("J0( sqrt(x) )") ) )$ (%i20) g : x*exp(-x)$ (%i21) qdraw( ex1( log(g),x,0.001,10, lc(red) ),yr(-8,0) )$ (%i22) qdraw( ex1(g, x, 0.001,10,lc(red) ), yr(0.0001, 1), log(y) )$ (%i23) qdraw( ex1(g, x, 0.001,10,lc(red),lw(7) ), yr(0,0.4), log(x) )$ (%i24) qdraw( ex1(g, x, 0.001,10,lc(red) ), yr(0.0001,1), log(xy) )$ (%i25) point_types()$ (%i26) (L1:[[-1,-1],[-1,0],[-1,1]], L2:[[1,-1],[1,0],[1,1]], qdraw ( pts(L1,pt(3),ps(1),pc(red),pk("type 3")), pts(L2, pt(10),ps(2),pc(black),pj(3),pk("type 10")), xr(-2,2),yr(-2,2)))$ (%i27) draw2d( title = "draw2d line type examples", file_name = "c:/work5/linetype1", terminal = 'eps, line_width = 4, yrange = [-0.2,2.2], line_type = dots, explicit (x^2,x,-1,1), color = red, line_type = solid, explicit (0.2 + x^2,x,-1,1), color = turquoise, line_type = dashes, explicit (0.4 + x^2,x,-1,1), color = brown,line_type = dot_dash, explicit (0.6 + x^2,x,-1,1), color = magenta,line_type = short_long_dashes, explicit (0.8 + x^2,x,-1,1), color = green, line_type = short_short_long_dashes, explicit (1 + x^2,x,-1,1))$ ------------------------------------------------------------- 4 Parametric plots with para(...) (%i3) qdraw(xr(-1.5,2),yr(-2,2), para(sin(t),sin(2*t),t,0,2*%pi ), pts( [ [0,0] ],ps(1),pc(brown),pk("t = 0")), pts( [ [sin(%pi/8),sin(%pi/4)] ],ps(1),pc(red),pk("t = pi/8")), pts( [ [1,0] ],ps(1),pc(green),pk("t = pi/2")), more (title = "parametric plot", xlabel = "sin(t)", ylabel = "sin(2*t)"))$ (%i4) qdraw(xr(-3,4),yr(-1,40), para(2*cos(u),u^2,u,0,2*%pi) , pts([ [2,0] ],ps(1),pc(blue),pk("u = 0")), pts( [ [0,(%pi/2)^2] ],ps(1), pc(red), pk("u = pi/2")), pts([ [-2,%pi^2]],ps(1),pc(green),pk("u = pi")), pts( [[0,(3*%pi/2)^2]],ps(1),pc(magenta),pk("u = 3*pi/2")), more (title = "parametric plot",xlabel = "2*cos(u)",ylabel = "u^2"))$ ------------------------------------------------------ 5 Polar Plots with polar(...) (%i5) qdraw( polar(10/t,t,1,3*%pi,lc(brown),lw(5)),nticks(200), xr(-4,6),yr(-3,9),key(bottom) , pts( [[10*cos(1),10*sin(1)]],ps(2),pc(red),pk("t = 1 rad")), pts([[5*cos(2),5*sin(2)]],ps(2),pc(blue),pk("t = 2 rad") ), line(0,0,5*cos(2),5*sin(2)), more(title = "polar plot",xlabel = "10*cos(t)/t",ylabel = "10*sin(t)/t"))$ ----------------------------------------------------------- 6 Implicit plots with imp(...) and imp1(...) (%i3) e : sin(2*x)*cos(y)$ (%i4) qdraw( imp( e=0.4,x,-3,3,y,-3,3 ),cut(key), more(title=" sin(2 x) cos(y) = 0.4 ",xlabel = "x", ylabel = "y"))$ (%i5) qdraw( imp( [e=0.4,e=0.7,e=0.9],x,-3,3,y,-3,3 ),cut(key), more(title=" sin(2 x) cos(y) = 0.4,0.7,0.9 ",xlabel = "x", ylabel = "y"))$ (%i6) qdraw( imp( [e = 0.4,e = 0.7,e = 0.9] ,x,-4.2,4.2,y,-3,3 ), cut(key) )$ (%i7) x(th):= cos(th)*(1-cos(th))$ (%i8) y(th):= sin(th)*(1-cos(th))$ (%i9) fpprintprec : 6$ (%i10) xygrid : make_xygrid(x,y,0,2*%pi,20); (%i11) qdraw(pts(xygrid,ps(0.1),pj(1)))$ (%i12) qdraw(pts(xygrid,ps(0.1),pj(1)),xr(-3,1),yr(-1.4,1.4), more(title = "r = (1- cos(th))",xlabel = "x = r cos(th)", ylabel = "y = r sin(th)"))$ (%i13) xygrid : make_xygrid(x,y,0,2*%pi,60)$ (%i14) qdraw(pts(xygrid,ps(0.1),pj(1)),xr(-3,1),yr(-1.4,1.4), more(title = "r = (1- cos(th))",xlabel = "x = r cos(th)", ylabel = "y = r sin(th)"))$ (%i15) qdraw(para(x(th),y(th),th,0,2*%pi,lw(1)),xr(-3,1),yr(-1.4,1.4), more(title = "r = (1- cos(th))",xlabel = "x = r cos(th)", ylabel = "y = r sin(th)"))$ (%i16) qdraw ( imp([x^2 - y^2 = 1, y = exp(x)],x,-1.4*%pi,1.4*%pi,y,-%pi,%pi), more( xlabel = "x", ylabel = "y", title = "x^2 - y^2 = 1, y = exp(x)"))$ (%i17) qdraw ( imp (x^2 + y^2 = 1,x,-1.68,1.68,y,-1.2,1.2),cut(key), more(title = "x^2 + y^2 = 1",xlabel = "x",ylabel = "y"))$ (%i18) e : (x^2+y^2-1)*(x^2+y^2-0.73)*(x^2+y^2-0.5)*(x^2+y^2-0.3)$ (%i19) qdraw (imp (e=0,x,-1.68,1.68,y,-1.2,1.2),cut(key), more (xlabel = "x",ylabel = "y",title = "circles"))$ (%i20) eqn1 : 5*x^2 + 4*x*y + 8*y^2 - 16*x + 8*y - 16 = 0$ (%i21) eqn2 : y+1 = 2*(x-2)$ (%i22) eqn3 : y+1 = -(x-2)/2$ (%i23) qdraw( imp1(eqn1,x,-2,6.4,y,-4,2,lc(red),lw(6),lk("ELLIPSE")), imp1(eqn2,x,-2,6.4,y,-4,2,lc(blue),lw(4),lk("ROT X AXIS")), imp1(eqn3,x,-2,6.4,y,-4,2,lc(brown),lw(4),lk("ROT Y AXIS") ), pts([ [2,-1] ],ps(2),pc(magenta),pk("TRANSLATED ORIGIN") ) )$ (%i24) qdraw( imp1(y^3=x^2,x,-3,3,y,-1,3, lw(10), lc(dark-blue), lk("Y^3 = X^2")))$ ----------------------------------------------- 7 Contour Plots with contour(...) (%i3) e : sin(2*x)*cos(y)$ (%i4) qdraw( contour(e, x,-4.2,4.2, y,-3,3, cvals(0.4,0.7,0.9)))$ (%i5) qdraw( contour(e, x,-4.2,4.2, y,-3,3, cvals(0.4,0.7,0.9), lw(2), add(grid)), ipgrid(15))$ (%i6) qdraw( contour(e,x,-4.2,4.2,y,-3,3,cvals(0.4,0.7,0.9), lw(2), lc(brown) ), ipgrid(15) )$ (%i7) qdraw( contour(e, x, -4.2,4.2, y,-3,3, crange(4,0.2,0.9), lc(brown) ), ipgrid(15) )$ (%i8) qdraw( contour(sin(x)*sin(y),x,-2,2,y,-2,2,crange(4,0.2,0.9), lw(3), lc(blue), add(xyaxes) ), ipgrid(15), more(title = "sin(x) sin(y) contours",xlabel = "x", ylabel = "y"))$ ---------------------------------------------------------- 8 Density Plots If you are using wxMaxima with display2d:true, then these examples will produce inline plots **if** you replace 'qdensity' with 'wxqdensity'. See wxqdraw.wxm for examples. (%i3) qdensity(x*y,[x,0,1,0.2],[y,0,1,0.2] )$ (%i4) qdensity(x*y,[x,0,1,0.2],[y,0,1,0.2],palette(gray) )$ (%i5) qdensity(x*y,[x,0,1,0.05],[y,0,1,0.05] )$ (%i6) qdensity(sin(x)*sin(y),[x,-2,2,0.05],[y,-2,2,0.05] )$ (%i7) makelist( makelist(mod(x,y),x,1,5),y,1,4); (%i8) mod_table : makelist( makelist(mod(x,y),x,1,30),y,1,20)$ (%i9) length(mod_table); (%i10) first(mod_table); (%i11) last(mod_table); (%i12) M : apply ('matrix, mod_table)$ (%i13) length(M); (%i14) length(transpose(M)); (%i15) row (M,20); (%i16) qdensity_mat(M,[1,30],[1,20])$ ----------------------------------------------------- 9 Scatterplot Example: Old Faithful Wait Times vs. Eruption Durations (%i3) fL : read_nested_list("c:/work5/faithful.dat")$ (%i4) fll(fL); (%i5) qdraw (pts (fL, ps(1), pc(black), pt(6)))$ (%i6) fLs : []$ (%i7) for j thru length(fL) do if fL[j][1] < 3 then fLs : cons(fL[j],fLs)$ (%i8) fLs : reverse (fLs)$ (%i9) fll(fLs); (%i10) qdraw ( pts (fL, ps(1),pc(black),pt(6)), pts (fLs, ps(1),pc(red)) )$ (%i11) qdraw ( xr(1,6),yr(40,100), line(3,40,3,100), pts (fL, ps(1),pc(black),pt(6)), pts (fLs, ps(1),pc(red)))$ (%i12) load(lsquares); (%i13) Mf : apply('matrix,fL)$ (%i14) row(Mf,1); (%i15) length(Mf); (%i16) soln : (lsquares_estimates(Mf, [x,y], y = a*x+b, [a,b])), numer; (%i17) [a,b] : (fpprintprec:5, map('rhs, soln[1])); (%i18) qdraw ( xr(1,6),yr(40,100), line(3,40,3,100), key(bottom), pts (fL, ps(1),pc(black),pt(6)), pts (fLs, ps(1),pc(red)), ex1(a*x + b,x,1,6,lc(magenta),lk("linear fit")))$ ------------------------------------------------------------------------ 10 Data Plots, Error Bars, Least Squares Fit (%i3) plist : read_nested_list("c:/work2/fit1.dat"); (%i4) length (plist); (%i5) qdraw( pts(plist) )$ (%i6) qdraw( pts(plist, ps(2)), xr(0,12), yr(0,15) )$ (%i7) qdraw( pts(plist,pc(red),pk("fit1"), ps(2)), xr(0,12),yr(0,15), key(bottom), errorbars(plist, 1) )$ (%i8) qdraw( pts(plist, pc(red), pk("fit1"), ps(2)), xr(0,12),yr(0,15), key(bottom), errorbars( plist, 1, lw(3), lc(blue) ) )$ (%i9) dyL : [0.2,0.3,0.5,1.5,0.8,1,1.4,1.8,2,2]; (%i10) map ('length,[plist,dyL] ); (%i11) qdraw( pts (plist, pc(red), pk("fit1"), ps(2)), xr(0,12),yr(0,15), key(bottom), errorbars (plist, dyL, lw(3), lc(blue)))$ (%i12) pmatrix : apply( 'matrix, plist ); (%i13) soln : (lsquares_estimates(pmatrix, [x,y], y = a*x+b, [a,b])), numer; (%i14) [a,b] : (fpprintprec:5, map('rhs, soln[1])); (%i15) qdraw( pts(plist, pc(red),pk("fit1"), ps(2)), xr(0,12),yr(0,15), key(bottom), errorbars( plist, dyL, lw(3),lc(blue) ), ex1(a*x + b,x,0,12,lc(brown),lk("linear fit")))$ (%i16) printfile("c:/work5/fit2.dat"); (%i17) p2list: read_nested_list("c:/work5/fit2.dat"); (%i18) length(p2list); (%i19) qdraw( pts(plist,pc(red),pk("fit1"), ps(2)), xr(0,12),yr(0,15), key(bottom), errorbars( plist, dyL, lw(3),lc(blue) ), ex1( a*x + b,x,0,12, lc(brown),lk("linear fit 1") ), pts(p2list, pc(magenta),pk("fit2"),ps(2)), errorbars( p2list,0.5,lw(3)))$ ------------------------------------------------------------- 11 Geometric Figures (%i3) qdraw( line(0,0,1,1) )$ (%i4) qdraw( line(0,0,1,1,lc(red),lw(6),lk("radius") ), xr(0,2),yr(0,2),key(bottom), pts([ [1,1] ] , ps(2), pc(blue), pk("point")) )$ (%i5) doplot1(10)$ (%i6) qdraw ( xr (-1,2), yr (-1,2), rect (0,0,1,1) )$ (%i7) qdraw( xr(-1,2),yr(-1,2), rect(0,0,1,1, lw(5), lc(brown), fill(khaki) ) )$ (%i8) qdraw( xr(-3,3),yr(-3,3), rect( -2.5,-2.5,2.5,2.5,lw(4),lc(blue) ), rect( -2,-2,2,2,lw(4),lc(red) ), rect( -1.5,-1.5,1.5,1.5,lw(4),lc(green) ), rect( -1,-1,1,1,lw(4),lc(brown) ), rect( -.5,-.5,.5,.5,lw(4),lc(magenta) ), cut(all) )$ (%i9) qdraw( xr(-2,2),yr(-1,2),cut(all), poly([ [-1,-1],[1,-1], [2,2] ] ) )$ (%i10) doplot2()$ (%i11) qdraw(xr(-2,2),yr(-2,2),circle(0,0,1))$ (%i12) qdraw(xr(-2.1,2.1),yr(-1.5,1.5),cut(all), circle(0,0,1,lw(5),lc(brown),fill(khaki) ), line(-1.5,-1.5,1.5,1.5,lw(8), lc(red) ))$ (%i13) qdraw(xr(-2.1,2.1),yr(-1.5,1.5),cut(all), line(-1.5,-1.5,1.5,1.5,lw(8),lc(red) ), circle(0,0,1,lw(8),lc(brown),fill(khaki)))$ (%i14) qdraw( xr(-4.2,4.2),yr(-3,3), ellipse(0,0,3,2,90,270) )$ (%i15) qdraw( xr(-5.6,5.6),yr(-4,4),ex1(x,x,-4,4,lc(blue),lw(5)), ex1(4*cos(x),x,-4,4,lc(red),lw(5) ), ellipse(0,0,3,1,90,270,lc(brown),lw(5),fill(khaki)),cut(all))$ (%i16) qdraw( xr(-2,2), yr(-2,2), vector( [-1,-1], [2,2] ) )$ (%i17) qdraw(xr(-2,2),yr(-2,2), vector([-1,-1],[2,2],lw(5),lc(brown),lk("vec 1")), key(bottom) )$ (%i18) qdraw(xr(-2,2),yr(-2,2), vector([0,0],[1,1],lw(5),lc(brown),lk("vec 1"), ht(e), hb(t), ha(45)), key(bottom))$ (%i19) qdraw(xr(-2.8,2.8),yr(-2,2),vector([0,0],[1,1],lw(5),lc(brown),lk("vec 1"),ht(e), hb(t),ha(45) ), vector([0,0],[-1,-1],lw(5),lc(magenta),lk("vec 2")),key(bottom) )$ (%i20) qdraw(xr(-2.8,2.8),yr(-2,2), arrowhead(1.5,0,180,.3),arrowhead(0,1,270,.3), arrowhead(-1.5,0,0,.3),arrowhead(0,-1,90,.3) )$ ------------------------------------------------------------------------------- 12 Greek Letters, Math Symbols, and Adjustable Font Size with Labels (%i3) qdraw(xr(0,4),yr(0,2),line(0,0,4,0,lc(black),lw(2)), line(0,0,2,2,lc(blue),lw(3) ), ellipse(0,0,1,1,0,45 ), arrowhead(0.707,0.707,135,0.15), label(["{/=36 {/Symbol q \\254 } The Angle}",1,0.4]), cut(all))$ (%i4) qdraw(xr(0,2.8),yr(0,2),line(0,0,2.8,0,lw(2)), line(0,0,2,2,lc(blue),lw(8) ), ellipse(0,0,1,1,0,45 ), arrowhead(0.707,0.707,135,0.15), label(["{ {/Symbol=36 q \\254 } }",1,0.4]), label ( ["{ /=15 The Incline Angle}", 1.7, 0.42]))$ (%i5) qdraw(xr(0,2.8),yr(0,2),line(0,0,2.8,0,lw(2)), line(0,0,2,2,lc(blue),lw(8) ), ellipse(0,0,1,1,0,45 ), arrowhead(0.707,0.707,135,0.15), label(["{ {/Symbol=36 q \\254 } }",1,0.4], ["{ /=15 The Incline Angle}", 1.7, 0.42] ))$ (%i6) qdraw (xr(-3,3),yr(-3,3), label (["P = {/Symbol r}kT",-1,1]), label (["{/Helvetica=18 P = {/Symbol r}kT}",1,1]), label (["{/Helvetica=24 P = {/Symbol r}kT}",1,-1,lc(blue)]))$ (%i7) qdraw(xr(-5,5),yr(-2,2),label_align(c), label( ["{/=48 a b c d e f g h i j k l m}",0,1.5] ), label( ["{/Symbol=48 a b c d e f g h i j k l m}",0,0.5] ), label( ["{/=48 n o p q r s t u v w x y z}",0,-.5] ), label( ["{/Symbol=48 n o p q r s t u v w x y z}",0,-1.5] ), cut(all))$ ------- if using wxMaxima, (%i3) wxplot_size; (%o3) [600,400] (%i4) wxqdraw(xr(-5,5),yr(-2,2),label_align(c), label( ["{/=48 a b c d e f g h i j k l m}",0,1.5] ), label( ["{/Symbol=48 a b c d e f g h i j k l m}",0,0.5] ), label( ["{/=48 n o p q r s t u v w x y z}",0,-.5] ), label( ["{/Symbol=48 n o p q r s t u v w x y z}",0,-1.5] ), cut(all)), wxplot_size = [1024,768]$ --------- (%i8) qdraw(xr(-3,3),yr(-2,2),label_align(c), label( ["{/=48 A B C D E F G H I J K L M}",0,1.5] ), label( ["{/Symbol=48 A B C D E F G H I J K L M}",0,0.5] ), label( ["{/=48 N O P Q R S T U V W X Y Z}",0,-.5] ), label( ["{/Symbol=48 N O P Q R S T U V W X Y Z}",0,-1.5] ), cut(all))$ (%i9) s1 : "{/=36 243 {/Symbol \\243} &{abcd} 254 {/Symbol \\254} &{abcd} 263 {/Symbol \\263} &{abcd} 273 {/Symbol \\273}}"$ (%i10) s2 : "{/=36 245 {/Symbol \\245} &{abcd} 256 {/Symbol \\256} &{abcd} 264 {/Symbol \\264} &{abcd} 345 {/Symbol \\345}}"$ (%i11) s3 : "{/=36 253 {/Symbol \\253} &{abcd} 261 {/Symbol \\261} &{abcd} 271 {/Symbol \\271} &{abcd} 362 {/Symbol \\362}}"$ (%i12) qdraw(xr(-3,3),yr(-2,2),label([s1,-2,1]), label([s2,-2,0]), label([s3,-2,-1]),cut(all))$ (%i13) qdraw(xr(0,2.8),yr(0,2),line(0,0,2.8,0), line(0,0,2,2,lc(blue),lw(5) ), ellipse(0,0,1,1,0,45 ), arrowhead(0.707,0.707,135,0.15), label(["q",1,0.4]), cut(all) )$ ---------------------------------------------------------------- 13 Even More with more(...) (%i3) qdraw( ex([x,x^2,x^3],x,-2,2), more(xlabel = "X AXIS", title="intersections of x, x^2, x^3" ), cut(key),vector([-1,5],[-0.4,-2.7],lc(red),hl(0.1) ), label(["x^2",-0.9,6]), vector([-1.2,-6],[-0.5,0],lc(turquoise),lw(8)), label( ["x^3", -1,-5.5] ), pts( [[-1,-1],[0,0],[1,1]],ps(2),pc(magenta)))$ ------------------------------------------------------------------ 14 Basic Elements of the draw Program ----------------------------------------------------------------- 15 Programming Homework Exercises (%i3) draw2d( line_width = 5, line_type = dots, explicit(1 + x^2,x,-1,1), line_type = solid, /* default */ explicit(2 + x^2,x,-1,1))$ -----------------------------------------------------------------