InputMode:=Word InputMode:=Word "A Bezier curve can be defined by two parametric equations:" eq11:=[x=a0+a1*t+a2*t^2+a3*t^3,y=b0+b1*t+b2*t^2+b3*t^3] eq11:=[x=a0+a1*t+a2*t^2+a3*t^3,y=b0+b1*t+b2*t^2+b3*t^3] "A Bezier curve can also be defined by four control points." [[x0,y0],[x1,y1],[x2,y2],[x3,y3]] [[x0,y0],[x1,y1],[x2,y2],[x3,y3]] "x=x0 xnd y=y0 when t=0 so" eq12:=SUBST(eq11,[x,y,t],[x0,y0,0]) eq12:=[x0=a0,y0=b0] "x=x3 and y=y3 when t=1 so" eq13:=SUBST(eq11,[x,y,t],[x3,y3,1]) eq13:=[x3=a0+a1+a2+a3,y3=b0+b1+b2+b3] "The other two control points require the derivative of the curve which is:" eq14:=[dx,dy]=DIF(RHS(eq11),t) eq14:=dx=a1+2*a2*t+3*a3*t^2 AND dy=b1+2*b2*t+3*b3*t^2 "dx=3(x1-x0) and dy=3(y1-y0) when t=0 so" eq15:=SUBST(eq14,[dx,dy,t],[3*(x1-x0),3*(y1-y0),0]) eq15:=x0-x1=-a1/3 AND y0-y1=-b1/3 "dx=3(x3-x2) and dy=3(y3-y2) when t=1 so" eq16:=SUBST(eq14,[dx,dy,t],[3*(x3-x2),3*(y3-y2),1]) eq16:=x2-x3=-(a1+2*a2+3*a3)/3 AND y2-y3=-(b1+2*b2+3*b3)/3 "Solve for a0, a1, a2, a3, b0, b1, b2, b3 using equations 1.2, 1.3, 1.5, and ~ 1.6." eq17:=SOLVE((SOLVE(APPEND(eq12,eq13),[a0,a1,a2,a3,b0,b1,b2,b3])) SUB 1 AND eq~ 15 AND eq16,[a0,a1,a2,a3,b0,b1,b2,b3]) eq17:=a0=x0 AND a1=3*(x1-x0) AND a2=3*(x0-2*x1+x2) AND a3=-x0+3*x1-3*x2+x3 AN~ D b0=y0 AND b1=3*(y1-y0) AND b2=3*(y0-2*y1+y2) AND b3=-y0+3*y1-3*y2+y3 "The example will use these four control points:" eq18:=[[x0,y0],[x1,y1],[x2,y2],[x3,y3]]=[[6,8],[1,10],[7,3],[4,4]] eq18:=x0=6 AND x1=1 AND x2=7 AND x3=4 AND y0=8 AND y1=10 AND y2=3 AND y3=4 "Substitute these values in equation 1.7." eq19:=SOLVE(eq18 AND eq17,[a0,a1,a2,a3,b0,b1,b2,b3,x0,x1,x2,x3,y1,y0,y2,y3]) eq19:=a0=6 AND a1=-15 AND a2=33 AND a3=-20 AND b0=8 AND b1=6 AND b2=-27 AND b~ 3=17 AND x0=6 AND x1=1 AND x2=7 AND x3=4 AND y1=10 AND y0=8 AND y2=3 AND y3=4 "Substitute these values in equation 1.1 to find the Bezier curve." eq110:=SOLVE((SOLVE(eq11,[x,y])) SUB 1 AND eq19,[x,y,a0,a1,a2,a3,b0,b1,b2,b3,~ x0,x1,x2,x3,y0,y1,y2,y3]) eq110:=x=-20*t^3+33*t^2-15*t+6 AND y=17*t^3-27*t^2+6*t+8 AND a0=6 AND a1=-15 ~ AND a2=33 AND a3=-20 AND b0=8 AND b1=6 AND b2=-27 AND b3=17 AND x0=6 AND x1=1~ AND x2=7 AND x3=4 AND y0=8 AND y1=10 AND y2=3 AND y3=4 eq111:=[LHS(eq110),LHS(RHS(eq110))] eq111:=[x=-20*t^3+33*t^2-15*t+6,y=17*t^3-27*t^2+6*t+8] "Here is the example Bezier curve and the control points:" "To show the control points we want a line such that x=x0 and y=y0 when t=0 a~ nd x=x1 y=y1 when t=1." eq112:=(SOLVE(VECTOR(SUBST([x=m1*t+b1,y=m2*t+b2],[x,y,t],v),v,[[x,y,t],[x0,y0~ ,0],[x1,y1,1]]),[x,y,b1,b2,m1,m2])) SUB 1 eq112:=x=t*(x1-x0)+x0 AND y=t*(y1-y0)+y0 AND b1=x0 AND b2=y0 AND m1=x1-x0 AND~ m2=y1-y0 "We want another line such that x=x3 and y=y3 when t=0 and x=x2 and y=y2 when~ t=1." eq113:=(SOLVE(VECTOR(SUBST([x=m1*t+b1,y=m2*t+b2],[x,y,t],v),v,[[x,y,t],[x3,y3~ ,0],[x2,y2,1]]),[x,y,b1,b2,m1,m2])) SUB 1 eq113:=x=t*(x2-x3)+x3 AND y=t*(y2-y3)+y3 AND b1=x3 AND b2=y3 AND m1=x2-x3 AND~ m2=y2-y3 "Plot this with t=0 to t=1." SUBST([[RHS(LHS(eq112)),RHS(LHS(RHS(eq112)))],[RHS(LHS(eq113)),RHS(LHS(RHS(eq~ 113)))],RHS(eq111)],APPEND([[x0,y0],[x1,y1],[x2,y2],[x3,y3]]),APPEND([[6,8],[~ 1,10],[7,3],[4,4]])) [[6-5*t,2*t+8],[3*t+4,4-t],[-20*t^3+33*t^2-15*t+6,17*t^3-27*t^2+6*t+8]] "The length of a curve is s, which is an integral." ds=SQRT(dx^2+dy^2) ds=SQRT(dx^2+dy^2) eq21a:=ds=SQRT(dx^2+dy^2) eq21a:=ds=SQRT(dx^2+dy^2) s='INT(ds,t) s=INT(ds,t) "The length s is from t=0 to t=1." eq21:=s=''INT(SQRT(dx^2+dy^2),t,0,1) eq21:=s='INT(SQRT(dx^2+dy^2),t,0,1) "Substitute the values for the Bezier curve from equation 1.4." eq22a:=[LHS(eq14),RHS(eq14)] eq22a:=[dx=a1+2*a2*t+3*a3*t^2,dy=b1+2*b2*t+3*b3*t^2] eq22:=SUBST(eq21,LHS(eq22a),RHS(eq22a)) eq22:=s=INT(SQRT(9*t^4*(a3^2+b3^2)+12*t^3*(a2*a3+b2*b3)+2*t^2*(3*a1*a3+2*a2^2~ +3*b1*b3+2*b2^2)+4*t*(a1*a2+b1*b2)+a1^2+b1^2),t,0,1) "Substitute the example values of a1, a2, a3, b1, b2, b3 from equation 1.9." eq23a:=[a0,a1,a2,a3,b0,b1,b2,b3,x0,x1,x2,x3,y0,y1,y2,y3] eq23a:=[a0,a1,a2,a3,b0,b1,b2,b3,x0,x1,x2,x3,y0,y1,y2,y3] eq23:=SUBST(eq22,eq23a,(SOLUTIONS(eq19,eq23a)) SUB 1) eq23:=s=3*INT(SQRT(689*t^4-1492*t^3+1076*t^2-292*t+29),t,0,1) "Factor the polynomial in the integral." eq25a:=dx^2+dy^2 eq25a:=dx^2+dy^2 eq25b:=SUBST(eq25a,LHS(eq22a),RHS(eq22a)) eq25b:=a1^2+a1*(4*a2*t+6*a3*t^2)+4*a2^2*t^2+12*a2*a3*t^3+9*a3^2*t^4+(b1+2*b2*~ t+3*b3*t^2)^2 eq25c:=SUBST(eq25b,eq23a,(SOLUTIONS(eq19,eq23a)) SUB 1) eq25c:=9*(689*t^4-1492*t^3+1076*t^2-292*t+29) eq25:=VECTOR(x SUB 1,x,FACTORS(eq25c,Complex,t)) eq25:=[t-SQRT(1378*SQRT(6005)+93508)/1378-373/689+#i*(7/689-SQRT(1378*SQRT(60~ 05)-93508)/1378),t-SQRT(1378*SQRT(6005)+93508)/1378-373/689+#i*(SQRT(1378*SQR~ T(6005)-93508)/1378-7/689),t+SQRT(1378*SQRT(6005)+93508)/1378-373/689-#i*(SQR~ T(1378*SQRT(6005)-93508)/1378+7/689),t+SQRT(1378*SQRT(6005)+93508)/1378-373/6~ 89+#i*(SQRT(1378*SQRT(6005)-93508)/1378+7/689),6201] "This integral is an elliptic integral which is in tables of elliptic integra~ ls on a web site: http://www.getnet.net/~cherry/derive/index.html" "The type of elliptic integral that is to be evaluated:" [IA(m):=,IHAT(m):=] [IA(m):=,IHAT(m):=] kk:=SQRT(eq25 SUB 5) kk:=3*SQRT(689) eq31:=kk*IA(e1+e2+e3+e4) eq31:=3*SQRT(689)*IA(e1+e2+e3+e4) [h=4,n=4,a=c,b=[-1,-1,-1,-1],x=1,y=0] [h=4,n=4,a=c,false,x=1,y=0] "Since h = 4 and n = 4 use the table: http://www.getnet.net/~cherry/derive/IH~ 4N4N.txt" "For b = [-1, -1, -1, -1] IA(m)=IHAT(m)." LOAD("c2001.mth") true ei:= ei:= "This is the function that generates the table of integrals." "For the integral IHAT(e1+e2+e3+e4) m=[1,1,1,1] and i=1." eq32:=EXPAND(RE179(1,[1,1,1,1],4,4),et) eq32:=(16*AHAT(2*e1+e2+e3+e4)-4*(r12+r13+r14)*AHAT(e1+e2+e3+e4)-2*(3*r12^2-2*~ r12*(r13+r14)+3*r13^2-2*r13*r14+3*r14^2)*AHAT(e2+e3+e4)+r12*r13*r14*(3*r12^2-~ 2*r12*(r13+r14)+3*r13^2-2*r13*r14+3*r14^2)*IHAT(-e1)-3*(r12^3-r12^2*(r13+r14)~ -r12*(r13^2-2*r13*r14+r14^2)+(r13+r14)*(r13^2-2*r13*r14+r14^2))*IHAT(e1)-2*r1~ 2*r13*r14*(r12+r13+r14)*IHAT(0))/48 rij=ai/bi-aj/bj rij=ai/bi-aj/bj [aa:=-SUBST(VECTOR(eq25 SUB i,i,1,4),[t],[0]),bb:=[-1,-1,-1,-1]] [aa:=[SQRT(1378*SQRT(6005)+93508)/1378+373/689+#i*(SQRT(1378*SQRT(6005)-93508~ )/1378-7/689),SQRT(1378*SQRT(6005)+93508)/1378+373/689+#i*(7/689-SQRT(1378*SQ~ RT(6005)-93508)/1378),-SQRT(1378*SQRT(6005)+93508)/1378+373/689+#i*(SQRT(1378~ *SQRT(6005)-93508)/1378+7/689),-SQRT(1378*SQRT(6005)+93508)/1378+373/689-#i*(~ SQRT(1378*SQRT(6005)-93508)/1378+7/689)],bb:=[-1,-1,-1,-1]] AHAT(2*e1+e2+e3+e4)=APPROX(AHAT_xy([2,1,1,1],4,4,aa,bb,1,0),24) AHAT(2*e1+e2+e3+e4)=2844536313237/14675993374918+107074312406*#i/172129751397~ 79 AHAT(e1+e2+e3+e4)=APPROX(AHAT_xy([1,1,1,1],4,4,aa,bb,1,0),24) AHAT(e1+e2+e3+e4)=-9405777879293/111067479093515 AHAT(e2+e3+e4)=APPROX(AHAT_xy([0,1,1,1],4,4,aa,bb,1,0),24) AHAT(e2+e3+e4)=2539999669912/2740381402779+1838030863268*#i/5110999864117 rr(i,j,a,b):=a SUB i/b SUB i-a SUB j/b SUB j rr(i,j,a,b):=a SUB i/b SUB i-a SUB j/b SUB j eq33:=SUBST(eq32,[r12,r13,r14,AHAT(2*e1+e2+e3+e4),AHAT(e1+e2+e3+e4),AHAT(e2+e~ 3+e4)],[rr(1,2,aa,bb),rr(1,3,aa,bb),rr(1,4,aa,bb),APPROX(AHAT_xy([2,1,1,1],4,~ 4,aa,bb,1,0),24),APPROX(AHAT_xy([1,1,1,1],4,4,aa,bb,1,0),24),APPROX(AHAT_xy([~ 0,1,1,1],4,4,aa,bb,1,0),24)]) eq33:=(417252363562487185995356102733412248285360300*(SQRT(916056770954*SQRT(~ 6005)-61899181744492)-721924)*IHAT(-e1)-2296289374358819045095258040574190830~ 159047526166980*IHAT(e1)+3077688454068661504665457175712675720678870*(1347853~ 746-7*SQRT(20268031751578*SQRT(6005)+488694913282988))*IHAT(0)-42624581607615~ 874537812784888560119208101528211693*SQRT(1378*SQRT(6005)+93508)+793620696260~ 4578912748005529722360534521760674725805)/20807638670845134192510371415288054~ 88286384647861259010-SQRT(2)*#i*(26077986335008815479647478388163412539436270~ 0*(SQRT(458028385477*SQRT(6005)+30949590872246)-654556*SQRT(2))*IHAT(-e1)+192~ 3534159599729564872830811416828095457830*(1200404914*SQRT(2)-7*SQRT(101340158~ 75789*SQRT(6005)-244347456641494))*IHAT(0)+2664007094431733656207549641539081~ 8352308810002437*SQRT(689*SQRT(6005)-46754)+138025426060318164554999238041101~ 86205583196016692831*SQRT(2))/13004631352815287764674359018561370007448627233~ 24335090 LOAD("c2001a.mth") true LOAD("carlson.mth") true "Substitute the functions that generate the basic integrals." eq310:=APPROX(ISHAT(eq33,aa,bb,1,0),24) eq310:=(3170625007861239947508009182090515271613655966031192*'I414([156183321~ 6069/1803212715379+15043483681536*#i/204798546645343,1561833216069/1803212715~ 379-15043483681536*#i/204798546645343,1270691020174/5866820156033+16579738865~ 233*#i/176804654551357,1270691020174/5866820156033-16579738865233*#i/17680465~ 4551357],[-1,-1,-1,-1],1,0)-9566256498271820822041305083145657709391727932882~ 27*'I428([1561833216069/1803212715379+15043483681536*#i/204798546645343,15618~ 33216069/1803212715379-15043483681536*#i/204798546645343,1270691020174/586682~ 0156033+16579738865233*#i/176804654551357,1270691020174/5866820156033-1657973~ 8865233*#i/176804654551357],[-1,-1,-1,-1],1,0)+229628937435881904509525804057~ 4190830159047526166980*'I429([1561833216069/1803212715379+15043483681536*#i/2~ 04798546645343,1561833216069/1803212715379-15043483681536*#i/204798546645343,~ 1270691020174/5866820156033+16579738865233*#i/176804654551357,1270691020174/5~ 866820156033-16579738865233*#i/176804654551357],[-1,-1,-1,-1],1,0)-1113999042~ 8725270850328526471630058327595652747203025)/20807638670845134192510371415288~ 05488286384647861259010-#i*(1476138894406138422201843351812485284023531427260~ 683*'I414([1561833216069/1803212715379+15043483681536*#i/204798546645343,1561~ 833216069/1803212715379-15043483681536*#i/204798546645343,1270691020174/58668~ 20156033+16579738865233*#i/176804654551357,1270691020174/5866820156033-165797~ 38865233*#i/176804654551357],[-1,-1,-1,-1],1,0)-94214308272488085080180722149~ 5169013095767346304047*'I428([1561833216069/1803212715379+15043483681536*#i/2~ 04798546645343,1561833216069/1803212715379-15043483681536*#i/204798546645343,~ 1270691020174/5866820156033+16579738865233*#i/176804654551357,1270691020174/5~ 866820156033-16579738865233*#i/176804654551357],[-1,-1,-1,-1],1,0)+1084510236~ 9977102372543495691976533779794264926984114)/45978315082034376017404340214993~ 3772659625933515736195 eq311:=kk*eq310 eq311:=SQRT(689)*(3170625007861239947508009182090515271613655966031192*I414([~ 1561833216069/1803212715379+15043483681536*#i/204798546645343,1561833216069/1~ 803212715379-15043483681536*#i/204798546645343,1270691020174/5866820156033+16~ 579738865233*#i/176804654551357,1270691020174/5866820156033-16579738865233*#i~ /176804654551357],[-1,-1,-1,-1],1,0)-9566256498271820822041305083145657709391~ 72793288227*I428([1561833216069/1803212715379+15043483681536*#i/2047985466453~ 43,1561833216069/1803212715379-15043483681536*#i/204798546645343,127069102017~ 4/5866820156033+16579738865233*#i/176804654551357,1270691020174/5866820156033~ -16579738865233*#i/176804654551357],[-1,-1,-1,-1],1,0)+2296289374358819045095~ 258040574190830159047526166980*I429([1561833216069/1803212715379+150434836815~ 36*#i/204798546645343,1561833216069/1803212715379-15043483681536*#i/204798546~ 645343,1270691020174/5866820156033+16579738865233*#i/176804654551357,12706910~ 20174/5866820156033-16579738865233*#i/176804654551357],[-1,-1,-1,-1],1,0)-111~ 39990428725270850328526471630058327595652747203025)/6935879556948378064170123~ 80509601829428794882620419670-3*SQRT(689)*#i*(1476138894406138422201843351812~ 485284023531427260683*I414([1561833216069/1803212715379+15043483681536*#i/204~ 798546645343,1561833216069/1803212715379-15043483681536*#i/204798546645343,12~ 70691020174/5866820156033+16579738865233*#i/176804654551357,1270691020174/586~ 6820156033-16579738865233*#i/176804654551357],[-1,-1,-1,-1],1,0)-942143082724~ 880850801807221495169013095767346304047*I428([1561833216069/1803212715379+150~ 43483681536*#i/204798546645343,1561833216069/1803212715379-15043483681536*#i/~ 204798546645343,1270691020174/5866820156033+16579738865233*#i/176804654551357~ ,1270691020174/5866820156033-16579738865233*#i/176804654551357],[-1,-1,-1,-1]~ ,1,0)+10845102369977102372543495691976533779794264926984114)/4597831508203437~ 60174043402149933772659625933515736195 "This is the length of the example Bezier curve." APPROX(s=eq311,24) s=7.23722336832905097768476-3.99378516859591712626745*10^(-13)*#i