Re: Beginner question

*To*: mathgroup at smc.vnet.net*Subject*: [mg14103] Re: [mg14078] Beginner question*From*: "Jens-Peer Kuska" <kuska at linmpi.mpg.de>*Date*: Fri, 25 Sep 1998 03:15:27 -0400*Sender*: owner-wri-mathgroup at wolfram.com

Hi Jean-Denis, this mean that You mix up Set[] and Equal[] Your input (bezX[t] + bezY[t]) = (bezX[t] - bezY[t])^2 +1 try to *set* the value for (bezX[t] + bezY[t]), that is nonsense and Mathematica trys to say this in a very moderate way. It is not clear to me what are input and what have to come out. If You mean SolveAlways[ Join[ eqns/. {X0->1,Y0->0,X3->0,Y3->1}, (* the boundary bnds*) 0==# & /@ CoefficientList[ 2 (bezX[t] + bezY[t]) -((bezX[t] - bezY[t])^2 +1)/. {X0->1,Y0->0, X3->0,Y3->1}, (* again the bnds *) t ] ], t ] You have to type it, and You will get six solutions. Let's go to Your statements step by step: eqns = { X0 == Dx, Y0 == Dy, X1 == X0 + Cx /3, Y1 == Y0 + Cy /3, X2 == X1 + (Cx+Bx)/3, Y2 == Y1 + (Cy+By)/3, X3 == X0 + Cx + Bx + Ax, Y3 == Y0 + Cy + By + Ay } Here You know the difference between Set[] and Equal[]. If this is an interpolation X0,X1,X2,X3 and Y0,Y1, Y2, Y3 are input parameter. You have 8 equations for the 8 unknowns Ax,Ay,..,Dx,Dy and parasol=Solve[eqns,{Ax,Ay,Bx,By,Cx,Cy,Dx,Dy}] give You a unique solution and You have no degree of freedom anymore to add the condition of the canonical parabolic arc or the boundaries. By the way, the equations above using the conditions {bezX[0],bezY[0]}=={X0,Y0} and {bezX[1],bezY[1]}=={X3,Y3}. That means that You will never fullfill the boundary conditions with free X0,Y0 and X3,Y3. Let's try the opposite version and start with Your condition, since it must be valid for all t the polynom in t obtained by inserting the expressions into the parabolic arc condition must have zero coefficients. One quickly writes down eqns=0==# & /@ CoefficientList[ 2 (cX[t] + cY[t]) -((cX[t] - cY[t])^2 +1) /. { cX[t_]:>a[0]+a[1]*t+a[2]*t^2+a[3]*t^3, cY[t_]:>b[0]+b[1]*t+b[2]*t^2+b[3]*t^3 }, t ] that are six equations for the six powers of t. Unfortunatly only five of them are linear independent. With cond=Solve[eqns,{a[3],b[3],a[2],b[2],a[1]}] You get four solutions for the five parameters. The three parameters a[0],b[0] and b[1] remain to be fixed by the "boundary" conditions With the four bondary conditions You will not be able to find a solution with the 3 remaining paramters You can prove this by Solve[{cX[0] == 1, cY[t]==0,cX[1] ==0,cY[1] ==1} /. {cX[t_]:>a[0]+a[1]*t+a[2]*t^2+a[3]*t^3, cY[t_]:>b[0]+b[1]*t+b[2]*t^2+b[3]*t^3} /.#,{b[1],b[0],a[0]}] & /@ cond What is left, the statements bezX[t_] == Ax t^3 + Bx t^2 + Cx t + Dx bezY[t_] == Ay t^3 + By t^2 + Cy t + Dy mean probably bezX[t_] := Ax t^3 + Bx t^2 + Cx t + Dx bezY[t_] := Ay t^3 + By t^2 + Cy t + Dy ? and You have to look for the difference of SetDelayed[] and Equal[] Implies[] is only use full is You not insert equations. Hope that helps Jens -----Original Message----- From: Jean-Denis S Bertron <bertronj at indra.com> To: mathgroup at smc.vnet.net Subject: [mg14103] [mg14078] Beginner question >Hi all, >I've got this very simple problem, for which I know the solution, but >somehow I can't get mathematica to solve it. The question is : Is it >possible to parameterize a parabolic arc using a bezier curve ? >Here are the basic equations: > >The definition of a bezier curve is: eqns = { >X0 == Dx, >Y0 == Dy, >X1 == X0 + Cx /3, >Y1 == Y0 + Cy /3, >X2 == X1 + (Cx+Bx)/3, >Y2 == Y1 + (Cy+By)/3, >X3 == X0 + Cx + Bx + Ax, >Y3 == Y0 + Cy + By + Ay >} >and >with bezX[t_] == Ax t^3 + Bx t^2 + Cx t + Dx > bezY[t_] == Ay t^3 + By t^2 + Cy t + Dy with 0 <= t <= 1. >The canonical parabolic arc is defined by: 2 (bezX[t] + bezY[t]) = >(bezX[t] - bezY[t])^2 +1 If there is a solution the boundary conditions >are: bnds = {bezX[0] == 1, bezY[0] == 0, bezX[1] ==0,bezY[1] ==1} > >I entered all this stuff in mathematica (eqns,bnds,bezX[t_],bezY[t_]) >and each statement returns nice algebraic rules. When I finally give it >the following: SolveAlways[Implies[eqns,2 (bezX[t] + bezY[t]) = >(bezX[t] - bezY[t])^2 +1], t] All it does is reply: >Set::write: Tag Times in 2 (bezX[t] + bezY[t]) is protected. >SolveAlways::elist: > ---------- Message text not found ---- (....) > >What does this mean ? >J.D. > >-- >Jean-Denis Bertron jd.bertron at pobox.com >http://rainbow.rmi.net/~bertronj >Disclaimer(message):- Offending(message)!. > >