{VERSION 5 0 "IBM INTEL LINUX" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 1 12 255 0 0 1 2 1 2 2 1 2 0 0 0 1 }{CSTYLE "Text" -1 200 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 0 0 0 1 }{CSTYLE "" -1 202 "Courier" 1 12 255 0 0 1 2 1 2 2 1 2 0 0 0 1 }{CSTYLE "" -1 206 "Courier" 1 12 255 0 0 1 2 1 2 2 1 2 0 0 0 1 } {CSTYLE "" -1 210 "Courier" 1 12 255 0 0 1 2 1 2 2 1 2 0 0 0 1 } {CSTYLE "" -1 214 "Courier" 1 12 255 0 0 1 2 1 2 2 1 2 0 0 0 1 } {CSTYLE "" -1 218 "Courier" 1 12 255 0 0 1 2 1 2 2 1 2 0 0 0 1 } {CSTYLE "" -1 222 "Courier" 1 12 255 0 0 1 2 1 2 2 1 2 0 0 0 1 } {CSTYLE "" -1 226 "Courier" 1 12 255 0 0 1 2 1 2 2 1 2 0 0 0 1 } {CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{PSTYLE "Normal " -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 0 0 1 }1 1 0 0 0 0 2 0 2 0 2 2 -1 1 }{PSTYLE "Heading 1" -1 3 1 {CSTYLE "" -1 -1 "MS Serif" 1 18 0 0 0 1 2 1 2 2 2 2 1 0 0 1 }1 1 0 0 8 4 2 0 2 0 2 2 -1 1 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT 200 203 "In this worksheet we wil l set up the equations to solve the forward displacement problem of St ewart-Gough platforms, using soma coordinates. The choices of the par ameters correspond to the 3-3 platform." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 45 "Andrew J. Sommese and Charles W. Wampler II: " }{TEXT 256 83 "The Numerical Solution of Systems of Polynomials Arising in En gineering and Science" }{TEXT -1 26 ". World Scientific, 2005." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 14 "1. Quaternions" }}{EXCHG {PARA 0 "" 0 "" {TEXT 200 166 "A quaternion q is a 4-tuple q = (q[0],q[1],q[2],q[3]) where q [0] is a scalar and (q[1],q[2],q[3]) a vector. In this section we def ine five operations on quaternions." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "CreateQuaternion := (s,v) -> s + v[1]*i + v[2]*j + v[ 3]*k:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 52 "RealPart := q -> c oeff(coeff(coeff(q,i,0),j,0),k,0):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 60 "VectorPart := q -> :" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 81 "Conjugate := q - > RealPart(q) - coeff(q,i,1)*i - coeff(q,j,1)*j - coeff(q,k,1)*k:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 457 "MultiplyQuaternions := proc (q,r)\n description `multiplies two quaternions`:\n local q0,r0,u,v, s,w:\n q0 := RealPart(q): u := VectorPart(q):\n r0 := RealPart(r): v := VectorPart(r):\n s := r0*q0 - u[1]*v[1] - u[2]*v[2] - u[3]*v[3]: \n w := :\n w[1] := w[1] + (u[2]*v[3] - v[2]*u[3]):\n w[2] := w[2] - (u[1]*v[3] - v[1]*u [3]):\n w[3] := w[3] + (u[1]*v[2] - v[1]*u[2]):\n return CreateQuate rnion(s,w):\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "x := CreateQuaternion(1,<5,3,4>);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "s := RealPart(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "v := VectorPart(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "Conjugate(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "x + Conjugate(x) = 2*RealPart(x);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 35 "y := CreateQuaternion(-1,<4,-1,2>);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "z := MultiplyQuaternions(x,y);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "Conjugate(z) = MultiplyQuate rnions(Conjugate(y),Conjugate(x));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 200 157 "A position in 3-space given by 3 coordinates corresponds to a position vector. This vector along with a zero real part is used as \+ input to CreateQuaternion." }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 31 "2 . Formulation of the Equations" }}{EXCHG {PARA 0 "" 0 "" {TEXT 200 137 "The unknowns are the quaternions e and g. Since e represents a r otation, we use symbolic coordinates \"r\" to represent e as a quatern ion." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "e := CreateQuaterni on(r[0],);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "eq[1] := MultiplyQuaternions(e,Conjugate(e)) - 1;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "g := CreateQuaternion(h[0],);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "eq[2] := Real Part(MultiplyQuaternions(g,Conjugate(e)));" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 136 "for n from 1 to 6 do\n a[n] := CreateQuaternion(0 ,):\n b[n] := CreateQuaternion(0,):\nend do:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "alia s(MQ = MultiplyQuaternions):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "alias(Cg = Conjugate):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "alias(RP = RealPart):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 233 "for n from 1 to 3 do\n eq[2+n] := MQ(g,Cg(g))\n + MQ(b[n],C g(b[n])) + MQ(a[n],Cg(a[n])) - L[n]^2\n + 2*RP( MQ(MQ(g,Cg(b[n])), Cg(e))\n - MQ(MQ(g,Cg(e)),Cg(a[n])) \n - MQ(MQ(MQ(e, b[n]),Cg(e)),Cg(a[n])) ):\nend do:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 199 "eq[6] := MQ(g,Cg(g))\n + MQ(b[6],Cg(b[6])) + MQ( a[4],Cg(a[4])) - L[4]^2\n + 2*RP( MQ(MQ(g,Cg(b[6])),Cg(e))\n \+ - MQ(MQ(g,Cg(e)),Cg(a[4])) \n - MQ(MQ(MQ(e,b[6]),Cg(e)),C g(a[4])) ):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 199 "eq[7] := MQ (g,Cg(g))\n + MQ(b[4],Cg(b[4])) + MQ(a[5],Cg(a[5])) - L[5]^2\n \+ + 2*RP( MQ(MQ(g,Cg(b[4])),Cg(e))\n - MQ(MQ(g,Cg(e)),Cg(a[5]) ) \n - MQ(MQ(MQ(e,b[4]),Cg(e)),Cg(a[5])) ):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 199 "eq[8] := MQ(g,Cg(g))\n + MQ(b[5],Cg( b[5])) + MQ(a[6],Cg(a[6])) - L[6]^2\n + 2*RP( MQ(MQ(g,Cg(b[5])),Cg (e))\n - MQ(MQ(g,Cg(e)),Cg(a[6])) \n - MQ(MQ(MQ(e,b[ 5]),Cg(e)),Cg(a[6])) ):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 200 44 "Note \+ that we exploited that MQ(e,Cg(e)) = 1." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "eq[3];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "e xpand(eq[3]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 59 "A3 := Line arAlgebra[RandomMatrix](3,3,generator=-1.0..0.0):" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 43 "A := LinearAlgebra[Transpose](< A3 | A3 >); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "B3 := LinearAlgebra[Ran domMatrix](3,3,generator=0.0..1.0);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "B := LinearAlgebra[Transpose](< B3 | B3 >);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 69 "distance := (x,y) -> sqrt((x [1]-y[1])^2+(x[2]-y[2])^2+(x[3]-y[3])^2):" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 74 "Ld := seq(distance(,),k=1..3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 " L[1] := Ld[1]; L[2] := Ld[2]; L[3] := Ld[3];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 64 "L[4] := distance(,);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 64 "L[5] := distance(,);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 64 "L[6] := distance(,);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "expand(eq[3]);" }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 29 "3. Writ ing the system to file" }}{EXCHG {PARA 0 "" 0 "" {TEXT 200 74 "To writ e the polynomials into a nice format to file, we use the following:" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 202 131 "printpoly := proc(p::po lynom)\n description `writes p, two terms per line, using lprint`:\n \+ local lp,i,s:\n lp := convert(p,list);\n" }{MPLTEXT 1 206 166 " for i from 1 to nops(lp) do\n s := convert(lp[i],string); \n if typ e(lcoeff(lp[i]),float) or type(lcoeff(lp[i]),integer) then \n if lcoeff(lp[i]) > 0 then\n" }{MPLTEXT 1 210 76 " printf(\"+%s\" ,s);\n else\n printf(\"%s\",s);\n end if;\n" } {MPLTEXT 1 214 83 " else\n if Im(lcoeff(lp[i])) > 0 then\n \+ printf(\"+%s\",s);\n else\n" }{MPLTEXT 1 218 98 " p rintf(\"%s\",s);\n end if;\n end if;\n if (i < nops(lp)) \+ and (i mod 2 = 0) then\n" }{MPLTEXT 1 222 61 " printf(\"\\n\"); \n end if;\n end do;\n printf(\";\\n\");\n" }{MPLTEXT 1 226 9 "e nd proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 118 "writeto(\"/tmp /platform33\"):\nprintf(\"8\\n\"):\nfor n from 1 to 8 do\n printpoly( expand(eq[n])):\nend do:\nwriteto(terminal):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}}{MARK "3 0 0" 14 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }