Car.mw

Maple worksheet. Study of a flat model of a car with 

Intrinsic and Apparent Singularities. 

 

Joint work with Yirmeyahu J. Kaminski, Jean Lévine, François Ollivier 

 

> with(plots); -1
 

> with(plottools); -1
 

This function draws the car : x and y are the coordinates of the rear axle center, theta the angle of the car body and phi the angle of the front wheel. A red dot provides the orientation of this wheel. 

If the global variable car_display is 0, the body of the car is a magenta polygon (used for animations). If not is just a black curve (used for  superpositions). 

> car_display := 0; -1
 

> car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
car := proc (x, y, theta, phi) local caisse, essieu, roue; global car_display; if car_display = 0 then caisse := polygonplot([seq([`+`(x, cos(`+`(theta, `/`(`*`(-1, `*`(3.141592654)), `*`(2.)), `/`(`*...
 

This functions computes the position of  a car, described by the trajectory (f,g) of the middle of the rear axle. The functions f and g depend on the variable t and t0 that must be of type numeric, stands for the current time. The value of theta is stored using global variable theta_prev and theta is computed modulo Pi in order to minimize |theta_prev - theta|. The same thing is done for phi_prev. 

> theta_prev := 0.; -1; phi_prev := 0.; -1
 

> rear_axle := proc (f, g, t, t0) local theta, theta_num, n_theta, phi, phi_num, n_phi, x, y; global theta_prev, phi_prev; theta := arctan(diff(g, t), diff(f, t)); theta_num := evalf(subs(t = t0, theta)...
rear_axle := proc (f, g, t, t0) local theta, theta_num, n_theta, phi, phi_num, n_phi, x, y; global theta_prev, phi_prev; theta := arctan(diff(g, t), diff(f, t)); theta_num := evalf(subs(t = t0, theta)...
rear_axle := proc (f, g, t, t0) local theta, theta_num, n_theta, phi, phi_num, n_phi, x, y; global theta_prev, phi_prev; theta := arctan(diff(g, t), diff(f, t)); theta_num := evalf(subs(t = t0, theta)...
rear_axle := proc (f, g, t, t0) local theta, theta_num, n_theta, phi, phi_num, n_phi, x, y; global theta_prev, phi_prev; theta := arctan(diff(g, t), diff(f, t)); theta_num := evalf(subs(t = t0, theta)...
rear_axle := proc (f, g, t, t0) local theta, theta_num, n_theta, phi, phi_num, n_phi, x, y; global theta_prev, phi_prev; theta := arctan(diff(g, t), diff(f, t)); theta_num := evalf(subs(t = t0, theta)...
rear_axle := proc (f, g, t, t0) local theta, theta_num, n_theta, phi, phi_num, n_phi, x, y; global theta_prev, phi_prev; theta := arctan(diff(g, t), diff(f, t)); theta_num := evalf(subs(t = t0, theta)...
rear_axle := proc (f, g, t, t0) local theta, theta_num, n_theta, phi, phi_num, n_phi, x, y; global theta_prev, phi_prev; theta := arctan(diff(g, t), diff(f, t)); theta_num := evalf(subs(t = t0, theta)...
rear_axle := proc (f, g, t, t0) local theta, theta_num, n_theta, phi, phi_num, n_phi, x, y; global theta_prev, phi_prev; theta := arctan(diff(g, t), diff(f, t)); theta_num := evalf(subs(t = t0, theta)...
 

The trajectory is given by theta and psi= sin(theta)x-cos(theta)y. This may be seen as the limit of flat outputs given by a point of the rear axle, when the point goes to infinity. There is no more ambiguity about the value of theta, but theta_prev is stored together with phi_prev to allow combined use with rear_axle function. 

> point_infinity := proc (theta, psi, t, t0) local x, y, phi, phi_num, n_phi; global theta_prev, phi_prev; x := `+`(`*`(psi, `*`(sin(theta))), `/`(`*`(diff(psi, t), `*`(cos(theta))), `*`(diff(theta, t))...
point_infinity := proc (theta, psi, t, t0) local x, y, phi, phi_num, n_phi; global theta_prev, phi_prev; x := `+`(`*`(psi, `*`(sin(theta))), `/`(`*`(diff(psi, t), `*`(cos(theta))), `*`(diff(theta, t))...
point_infinity := proc (theta, psi, t, t0) local x, y, phi, phi_num, n_phi; global theta_prev, phi_prev; x := `+`(`*`(psi, `*`(sin(theta))), `/`(`*`(diff(psi, t), `*`(cos(theta))), `*`(diff(theta, t))...
point_infinity := proc (theta, psi, t, t0) local x, y, phi, phi_num, n_phi; global theta_prev, phi_prev; x := `+`(`*`(psi, `*`(sin(theta))), `/`(`*`(diff(psi, t), `*`(cos(theta))), `*`(diff(theta, t))...
point_infinity := proc (theta, psi, t, t0) local x, y, phi, phi_num, n_phi; global theta_prev, phi_prev; x := `+`(`*`(psi, `*`(sin(theta))), `/`(`*`(diff(psi, t), `*`(cos(theta))), `*`(diff(theta, t))...
point_infinity := proc (theta, psi, t, t0) local x, y, phi, phi_num, n_phi; global theta_prev, phi_prev; x := `+`(`*`(psi, `*`(sin(theta))), `/`(`*`(diff(psi, t), `*`(cos(theta))), `*`(diff(theta, t))...
point_infinity := proc (theta, psi, t, t0) local x, y, phi, phi_num, n_phi; global theta_prev, phi_prev; x := `+`(`*`(psi, `*`(sin(theta))), `/`(`*`(diff(psi, t), `*`(cos(theta))), `*`(diff(theta, t))...
point_infinity := proc (theta, psi, t, t0) local x, y, phi, phi_num, n_phi; global theta_prev, phi_prev; x := `+`(`*`(psi, `*`(sin(theta))), `/`(`*`(diff(psi, t), `*`(cos(theta))), `*`(diff(theta, t))...
 


 

> switch := proc (x, y, theta, psi, t, t0, epsilon) if `<`(epsilon, evalf(subs(t = t0, `^`(`+`(`*`(`^`(diff(x, t), 2)), `*`(`^`(diff(y, t), 2))), .5)))) then rear_axle(x, y, t, t0) else point_infinity(t...
switch := proc (x, y, theta, psi, t, t0, epsilon) if `<`(epsilon, evalf(subs(t = t0, `^`(`+`(`*`(`^`(diff(x, t), 2)), `*`(`^`(diff(y, t), 2))), .5)))) then rear_axle(x, y, t, t0) else point_infinity(t...
 

Parametrization of a trajectory. Functions x and y are used if  


 

 

Views is the list of times to be computed. N_size the size of the output picture. The global variable param_display controls the style of the output: an animation if param_output=0 a superposition of views if not. 

> param_display := 0; -1
 

> parametrage := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t = ...
parametrage := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t = ...
parametrage := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t = ...
parametrage := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t = ...
parametrage := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t = ...
parametrage := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t = ...
parametrage := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t = ...
parametrage := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t = ...
parametrage := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t = ...
 

We denote the position of the car by the quintuple (x,y,theta,phi,u). Here the car goes from (0,10,0,0,10) at time t=0 to (0,-10,Pi,0,10) at time t=1. 

> Y1 := `+`(`*`(A1, `*`(cos(`*`(Pi, `*`(t))))), `*`(B1, `*`(cos(`+`(`*`(3, `*`(Pi, `*`(t)))))))); -1; resu := solve([eval(Y1, t = 0) = 10, eval(diff(Y1, t, t), t = 0) = 0], [A1, B1]); -1; Y1 := subs(op(...
Y1 := `+`(`*`(A1, `*`(cos(`*`(Pi, `*`(t))))), `*`(B1, `*`(cos(`+`(`*`(3, `*`(Pi, `*`(t)))))))); -1; resu := solve([eval(Y1, t = 0) = 10, eval(diff(Y1, t, t), t = 0) = 0], [A1, B1]); -1; Y1 := subs(op(...
 

> Theta1_prev := 0.; -1; Theta1 := arctan(diff(Y1, t), diff(X1, t)); -1; theta1 := subs(Tag = Theta1, proc (t) local resu; global Theta1_prev; if type(t, numeric) then resu := evalf(Tag); Theta1_prev :=...
Theta1_prev := 0.; -1; Theta1 := arctan(diff(Y1, t), diff(X1, t)); -1; theta1 := subs(Tag = Theta1, proc (t) local resu; global Theta1_prev; if type(t, numeric) then resu := evalf(Tag); Theta1_prev :=...
Theta1_prev := 0.; -1; Theta1 := arctan(diff(Y1, t), diff(X1, t)); -1; theta1 := subs(Tag = Theta1, proc (t) local resu; global Theta1_prev; if type(t, numeric) then resu := evalf(Tag); Theta1_prev :=...
 

> Theta1_prev := 0.; -1; plot(theta1, 0 .. 1, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, theta]); 1
Theta1_prev := 0.; -1; plot(theta1, 0 .. 1, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, theta]); 1
 

Plot_2d
 

> Phi1_prev := 0.; -1; Phi1 := arctan(diff(`+`(Y1, sin(Theta1)), t), diff(`+`(X1, cos(Theta1)), t)); -1; phi1 := subs([Tag1 = Phi1, Tag2 = Theta1], proc (t) local resu; global Phi1_prev; if type(t, nume...
Phi1_prev := 0.; -1; Phi1 := arctan(diff(`+`(Y1, sin(Theta1)), t), diff(`+`(X1, cos(Theta1)), t)); -1; phi1 := subs([Tag1 = Phi1, Tag2 = Theta1], proc (t) local resu; global Phi1_prev; if type(t, nume...
Phi1_prev := 0.; -1; Phi1 := arctan(diff(`+`(Y1, sin(Theta1)), t), diff(`+`(X1, cos(Theta1)), t)); -1; phi1 := subs([Tag1 = Phi1, Tag2 = Theta1], proc (t) local resu; global Phi1_prev; if type(t, nume...
 

> Phi1_prev := 0.; -1; plot(phi1, 0 .. 1, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, phi])
 

Plot_2d
 

> plot(X1, t = 0 .. 1, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, x]); 1; plot(Y1, t = 0 .. 1, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, y]...
plot(X1, t = 0 .. 1, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, x]); 1; plot(Y1, t = 0 .. 1, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, y]...
 

 

Plot_2d
Plot_2d
 

> theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage(X1, Y1, 0, 0, t, [seq(`+`(`*`(0.5e-1, `*`(i))), i = 0 .. 20)], 0., -12, 12, -12, 12, 500); 1; param_display := 1; 1; theta...
theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage(X1, Y1, 0, 0, t, [seq(`+`(`*`(0.5e-1, `*`(i))), i = 0 .. 20)], 0., -12, 12, -12, 12, 500); 1; param_display := 1; 1; theta...
theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage(X1, Y1, 0, 0, t, [seq(`+`(`*`(0.5e-1, `*`(i))), i = 0 .. 20)], 0., -12, 12, -12, 12, 500); 1; param_display := 1; 1; theta...
 

 

 

 

 

Plot_2d
1
0.
0.
Plot_2d
 

Here we want to go to from point (0,1,0,0,40) at t=0 to point (0,1,0,0,-40) at t=1, meaning that we start forward and arrive backward. For this, we need to cross a cusp where x~c_1-c_2*t^2, y~c3*t^3.  

 

> Y2 := `+`(`*`(A2, `*`(cos(`*`(Pi, `*`(t))))), `*`(B2, `*`(cos(`+`(`*`(3, `*`(Pi, `*`(t))))))), `*`(C2, `*`(cos(`+`(`*`(5, `*`(Pi, `*`(t)))))))); -1; resu := solve([eval(Y2, t = 0) = 10, eval(diff(Y2, ...
Y2 := `+`(`*`(A2, `*`(cos(`*`(Pi, `*`(t))))), `*`(B2, `*`(cos(`+`(`*`(3, `*`(Pi, `*`(t))))))), `*`(C2, `*`(cos(`+`(`*`(5, `*`(Pi, `*`(t)))))))); -1; resu := solve([eval(Y2, t = 0) = 10, eval(diff(Y2, ...
Y2 := `+`(`*`(A2, `*`(cos(`*`(Pi, `*`(t))))), `*`(B2, `*`(cos(`+`(`*`(3, `*`(Pi, `*`(t))))))), `*`(C2, `*`(cos(`+`(`*`(5, `*`(Pi, `*`(t)))))))); -1; resu := solve([eval(Y2, t = 0) = 10, eval(diff(Y2, ...
 

The presence of the cusp implies that diff(x,t) and diff(y,t) have a common factor that we need to remove to avoid trouble like: division by 0, or an extra loop in the curve, due to floating point inaccuracies, and the value of theta increase by Pi!  

> c3 := simplify(ChebyshevU(2, cos(`*`(Pi, `*`(t)))), 'ChebyshevU'); -1; c5 := simplify(ChebyshevU(4, cos(`*`(Pi, `*`(t)))), 'ChebyshevU'); -1; diff(X2, t); -1; diff(Y2, t); -1; T := `/`(`*`(factor(subs...
c3 := simplify(ChebyshevU(2, cos(`*`(Pi, `*`(t)))), 'ChebyshevU'); -1; c5 := simplify(ChebyshevU(4, cos(`*`(Pi, `*`(t)))), 'ChebyshevU'); -1; diff(X2, t); -1; diff(Y2, t); -1; T := `/`(`*`(factor(subs...
c3 := simplify(ChebyshevU(2, cos(`*`(Pi, `*`(t)))), 'ChebyshevU'); -1; c5 := simplify(ChebyshevU(4, cos(`*`(Pi, `*`(t)))), 'ChebyshevU'); -1; diff(X2, t); -1; diff(Y2, t); -1; T := `/`(`*`(factor(subs...
 

> Theta2_prev := 0.; -1; Theta2 := arctan(T, 1); -1; theta2 := subs(Tag = Theta2, proc (t) local resu; global Theta2_prev; if type(t, numeric) then resu := evalf(Tag); Theta2_prev := `+`(resu, `*`(round...
Theta2_prev := 0.; -1; Theta2 := arctan(T, 1); -1; theta2 := subs(Tag = Theta2, proc (t) local resu; global Theta2_prev; if type(t, numeric) then resu := evalf(Tag); Theta2_prev := `+`(resu, `*`(round...
Theta2_prev := 0.; -1; Theta2 := arctan(T, 1); -1; theta2 := subs(Tag = Theta2, proc (t) local resu; global Theta2_prev; if type(t, numeric) then resu := evalf(Tag); Theta2_prev := `+`(resu, `*`(round...
 

> Theta2_prev := 0; -1; plot(theta2, 0 .. 2, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, theta]); 1
Theta2_prev := 0; -1; plot(theta2, 0 .. 2, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, theta]); 1
 

Plot_2d
 

> Phi2_prev := 0.; -1; Phi2 := arctan(diff(`+`(Y2, sin(Theta2)), t), diff(`+`(X2, cos(Theta2)), t)); -1; phi2 := subs([Tag1 = Phi2, Tag2 = Theta2], proc (t) local resu; global Phi2_prev; if type(t, nume...
Phi2_prev := 0.; -1; Phi2 := arctan(diff(`+`(Y2, sin(Theta2)), t), diff(`+`(X2, cos(Theta2)), t)); -1; phi2 := subs([Tag1 = Phi2, Tag2 = Theta2], proc (t) local resu; global Phi2_prev; if type(t, nume...
Phi2_prev := 0.; -1; Phi2 := arctan(diff(`+`(Y2, sin(Theta2)), t), diff(`+`(X2, cos(Theta2)), t)); -1; phi2 := subs([Tag1 = Phi2, Tag2 = Theta2], proc (t) local resu; global Phi2_prev; if type(t, nume...
 

> phi2(1.); -1; plot(phi2, 0 .. 2, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, phi])
 

Plot_2d
 

> plot(X2, t = 0 .. 2, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, x]); 1; plot(Y2, t = 0 .. 2, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, y]...
plot(X2, t = 0 .. 2, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, x]); 1; plot(Y2, t = 0 .. 2, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, y]...
 

 

Plot_2d
Plot_2d
 

> theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage(X2, Y2, Theta2, `+`(`*`(sin(Theta2), `*`(X2)), `-`(`*`(cos(Theta2), `*`(Y2)))), t, [seq(`+`(`*`(0.2e-1, `*`(i))), i = 0 .....
theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage(X2, Y2, Theta2, `+`(`*`(sin(Theta2), `*`(X2)), `-`(`*`(cos(Theta2), `*`(Y2)))), t, [seq(`+`(`*`(0.2e-1, `*`(i))), i = 0 .....
theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage(X2, Y2, Theta2, `+`(`*`(sin(Theta2), `*`(X2)), `-`(`*`(cos(Theta2), `*`(Y2)))), t, [seq(`+`(`*`(0.2e-1, `*`(i))), i = 0 .....
theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage(X2, Y2, Theta2, `+`(`*`(sin(Theta2), `*`(X2)), `-`(`*`(cos(Theta2), `*`(Y2)))), t, [seq(`+`(`*`(0.2e-1, `*`(i))), i = 0 .....
 

 

 

 

 

Plot_2d
1
0.
0.
Plot_2d
 

> theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage(X2, Y2, Theta2, `+`(`*`(sin(Theta2), `*`(X2)), `-`(`*`(cos(Theta2), `*`(Y2)))), t, [seq(`+`(`*`(0.2e-1, `*`(i))), i = 0 .....
theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage(X2, Y2, Theta2, `+`(`*`(sin(Theta2), `*`(X2)), `-`(`*`(cos(Theta2), `*`(Y2)))), t, [seq(`+`(`*`(0.2e-1, `*`(i))), i = 0 .....
theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage(X2, Y2, Theta2, `+`(`*`(sin(Theta2), `*`(X2)), `-`(`*`(cos(Theta2), `*`(Y2)))), t, [seq(`+`(`*`(0.2e-1, `*`(i))), i = 0 .....
theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage(X2, Y2, Theta2, `+`(`*`(sin(Theta2), `*`(X2)), `-`(`*`(cos(Theta2), `*`(Y2)))), t, [seq(`+`(`*`(0.2e-1, `*`(i))), i = 0 .....
 

Like in the previous example, we want to go to from point (0,1,0,0,-40) at t=0 to point (0,1,0,0,-40) at t=1, meaning that we start forward and arrive backward. But this time, we want to have a better control on the value of phi and avoid it to reach Pi/2. For this, we need to cross a rhamphoid cusp with x~c_1-c_2*t^2, y~c3*t^5.  

> Y3 := `+`(`*`(A3, `*`(cos(`*`(Pi, `*`(t))))), `*`(B3, `*`(cos(`+`(`*`(3, `*`(Pi, `*`(t))))))), `*`(C3, `*`(cos(`+`(`*`(5, `*`(Pi, `*`(t))))))), `*`(D3, `*`(cos(`+`(`*`(7, `*`(Pi, `*`(t)))))))); -1; re...
Y3 := `+`(`*`(A3, `*`(cos(`*`(Pi, `*`(t))))), `*`(B3, `*`(cos(`+`(`*`(3, `*`(Pi, `*`(t))))))), `*`(C3, `*`(cos(`+`(`*`(5, `*`(Pi, `*`(t))))))), `*`(D3, `*`(cos(`+`(`*`(7, `*`(Pi, `*`(t)))))))); -1; re...
Y3 := `+`(`*`(A3, `*`(cos(`*`(Pi, `*`(t))))), `*`(B3, `*`(cos(`+`(`*`(3, `*`(Pi, `*`(t))))))), `*`(C3, `*`(cos(`+`(`*`(5, `*`(Pi, `*`(t))))))), `*`(D3, `*`(cos(`+`(`*`(7, `*`(Pi, `*`(t)))))))); -1; re...
 

The presence of the rhamphoid cusp implies that diff(x,t) and diff(y,t) have a common factor that we need first to remove. But this is not enough, as we will have at this point x'=y'=theta'=0. 

> c3 := simplify(ChebyshevU(2, cos(`*`(Pi, `*`(t)))), 'ChebyshevU'); -1; c5 := simplify(ChebyshevU(4, cos(`*`(Pi, `*`(t)))), 'ChebyshevU'); -1; c7 := simplify(ChebyshevU(6, cos(`*`(Pi, `*`(t)))), 'Cheby...
c3 := simplify(ChebyshevU(2, cos(`*`(Pi, `*`(t)))), 'ChebyshevU'); -1; c5 := simplify(ChebyshevU(4, cos(`*`(Pi, `*`(t)))), 'ChebyshevU'); -1; c7 := simplify(ChebyshevU(6, cos(`*`(Pi, `*`(t)))), 'Cheby...
c3 := simplify(ChebyshevU(2, cos(`*`(Pi, `*`(t)))), 'ChebyshevU'); -1; c5 := simplify(ChebyshevU(4, cos(`*`(Pi, `*`(t)))), 'ChebyshevU'); -1; c7 := simplify(ChebyshevU(6, cos(`*`(Pi, `*`(t)))), 'Cheby...
c3 := simplify(ChebyshevU(2, cos(`*`(Pi, `*`(t)))), 'ChebyshevU'); -1; c5 := simplify(ChebyshevU(4, cos(`*`(Pi, `*`(t)))), 'ChebyshevU'); -1; c7 := simplify(ChebyshevU(6, cos(`*`(Pi, `*`(t)))), 'Cheby...
 

> Theta3_prev := 0.; -1; Theta3 := arctan(T, 1); -1; theta3 := subs(Tag = Theta3, proc (t) local resu; global Theta3_prev; if type(t, numeric) then resu := evalf(Tag); Theta3_prev := `+`(resu, `*`(round...
Theta3_prev := 0.; -1; Theta3 := arctan(T, 1); -1; theta3 := subs(Tag = Theta3, proc (t) local resu; global Theta3_prev; if type(t, numeric) then resu := evalf(Tag); Theta3_prev := `+`(resu, `*`(round...
Theta3_prev := 0.; -1; Theta3 := arctan(T, 1); -1; theta3 := subs(Tag = Theta3, proc (t) local resu; global Theta3_prev; if type(t, numeric) then resu := evalf(Tag); Theta3_prev := `+`(resu, `*`(round...
 

> Theta3_prev := 0.; -1; plot(theta3, 0 .. 1, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, theta]); 1
Theta3_prev := 0.; -1; plot(theta3, 0 .. 1, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, theta]); 1
 

Plot_2d
 

> Phi3_prev := 0.; -1; Phi3 := arctan(diff(`+`(Y3, sin(Theta3)), t), diff(`+`(X3, cos(Theta3)), t)); -1; phi3 := subs([Tag1 = Phi3, Tag2 = Theta3], proc (t) local resu; global Phi3_prev; if type(t, nume...
Phi3_prev := 0.; -1; Phi3 := arctan(diff(`+`(Y3, sin(Theta3)), t), diff(`+`(X3, cos(Theta3)), t)); -1; phi3 := subs([Tag1 = Phi3, Tag2 = Theta3], proc (t) local resu; global Phi3_prev; if type(t, nume...
Phi3_prev := 0.; -1; Phi3 := arctan(diff(`+`(Y3, sin(Theta3)), t), diff(`+`(X3, cos(Theta3)), t)); -1; phi3 := subs([Tag1 = Phi3, Tag2 = Theta3], proc (t) local resu; global Phi3_prev; if type(t, nume...
 

> Phi3_prev := 0.; -1; plot(phi3, 0 .. 1, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, phi])
 

Plot_2d
 

> plot(X3, t = 0 .. 2, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, x]); 1; plot(Y3, t = 0 .. 2, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, y]...
plot(X3, t = 0 .. 2, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, x]); 1; plot(Y3, t = 0 .. 2, font = [TIMES, ITALIC, 18], labelfont = [TIMES, ITALIC, 26], labels = [t, y]...
 

 

Plot_2d
Plot_2d
 

> Theta3_ser := convert(evalf(simplify(series(Theta3, t = `/`(1, 2), 6))), polynom); 1; Phi3_ser := evalf(simplify(series(Phi3, t = `/`(1, 2), 6))); 1
Theta3_ser := convert(evalf(simplify(series(Theta3, t = `/`(1, 2), 6))), polynom); 1; Phi3_ser := evalf(simplify(series(Phi3, t = `/`(1, 2), 6))); 1
 

 

`+`(`*`(426.1647735, `*`(`^`(`+`(t, `-`(.5000000000)), 3))), `-`(`*`(8412.155450, `*`(`^`(`+`(t, `-`(.5000000000)), 5)))))
series(`+`(`-`(`*`(`+`(`*`(1., `*`(I))), `*`(ln(`+`(`-`(`*`(1., `*`(csgn(`+`(t, `-`(.5000000000))))))))))), `-`(`*`(10.17393454, `*`(`+`(t, `-`(.5000000000))))), `*`(1095.169426, `*`(`^`(`+`(t, `-`(.5...
series(`+`(`-`(`*`(`+`(`*`(1., `*`(I))), `*`(ln(`+`(`-`(`*`(1., `*`(csgn(`+`(t, `-`(.5000000000))))))))))), `-`(`*`(10.17393454, `*`(`+`(t, `-`(.5000000000))))), `*`(1095.169426, `*`(`^`(`+`(t, `-`(.5...
(1)
 

We remove the spurious ln term in Phi3_ser. 

> Phi3_ser := convert(simplify(subs(csgn(`+`(t, `-`(.5000000000))) = -1, Phi3_ser)), polynom)
 

`+`(`-`(`*`(10.17393454, `*`(t))), 5.086967270, `*`(1095.169426, `*`(`^`(`+`(t, `-`(.5000000000)), 3))), `-`(`*`(66603.05484, `*`(`^`(`+`(t, `-`(.5000000000)), 5)))))
`+`(`-`(`*`(10.17393454, `*`(t))), 5.086967270, `*`(1095.169426, `*`(`^`(`+`(t, `-`(.5000000000)), 3))), `-`(`*`(66603.05484, `*`(`^`(`+`(t, `-`(.5000000000)), 5)))))
(2)
 


 

> switch2 := proc (x, y, theta_ser, phi_ser, t, t0, epsilon) local x1, y1, resu; global theta_prev, phi_prev; if `<`(epsilon, evalf(subs(t = t0, `^`(`+`(`*`(`^`(diff(x, t), 2)), `*`(`^`(diff(y, t), 2)))...
switch2 := proc (x, y, theta_ser, phi_ser, t, t0, epsilon) local x1, y1, resu; global theta_prev, phi_prev; if `<`(epsilon, evalf(subs(t = t0, `^`(`+`(`*`(`^`(diff(x, t), 2)), `*`(`^`(diff(y, t), 2)))...
switch2 := proc (x, y, theta_ser, phi_ser, t, t0, epsilon) local x1, y1, resu; global theta_prev, phi_prev; if `<`(epsilon, evalf(subs(t = t0, `^`(`+`(`*`(`^`(diff(x, t), 2)), `*`(`^`(diff(y, t), 2)))...
switch2 := proc (x, y, theta_ser, phi_ser, t, t0, epsilon) local x1, y1, resu; global theta_prev, phi_prev; if `<`(epsilon, evalf(subs(t = t0, `^`(`+`(`*`(`^`(diff(x, t), 2)), `*`(`^`(diff(y, t), 2)))...
switch2 := proc (x, y, theta_ser, phi_ser, t, t0, epsilon) local x1, y1, resu; global theta_prev, phi_prev; if `<`(epsilon, evalf(subs(t = t0, `^`(`+`(`*`(`^`(diff(x, t), 2)), `*`(`^`(diff(y, t), 2)))...
 

Function parametrage2 uses switch2 instead of switch, that is power series approximations near singularities. 

> parametrage2 := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t =...
parametrage2 := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t =...
parametrage2 := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t =...
parametrage2 := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t =...
parametrage2 := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t =...
parametrage2 := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t =...
parametrage2 := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t =...
parametrage2 := proc (x, y, theta, psi, t, Views, epsilon, x_min, x_max, y_min, y_max, N_size) local i, curve; global param_display, car_display; car_display := param_display; curve := plot([x, y, t =...
 

> theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage2(X3, Y3, Theta3_ser, Phi3_ser, t, [seq(`+`(`*`(0.2e-1, `*`(i))), i = 0 .. 50)], .2, -15, 15, -15, 15, 500); 1; param_displ...
theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage2(X3, Y3, Theta3_ser, Phi3_ser, t, [seq(`+`(`*`(0.2e-1, `*`(i))), i = 0 .. 50)], .2, -15, 15, -15, 15, 500); 1; param_displ...
theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage2(X3, Y3, Theta3_ser, Phi3_ser, t, [seq(`+`(`*`(0.2e-1, `*`(i))), i = 0 .. 50)], .2, -15, 15, -15, 15, 500); 1; param_displ...
 

 

Plot_2d
Plot_2d
 

> Digits := 10; 1
 

10 (3)
 

> theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage2(X3, Y3, Theta3_ser, Phi3_ser, t, [seq(`+`(`*`(0.1e-4, `*`(i))), i = 49950 .. 50050)], -.2, 12, 15, -1.5, 1.5, 500); 1
theta_prev := 0.; -1; phi_prev := 0.; -1; param_display := 0; -1; parametrage2(X3, Y3, Theta3_ser, Phi3_ser, t, [seq(`+`(`*`(0.1e-4, `*`(i))), i = 49950 .. 50050)], -.2, 12, 15, -1.5, 1.5, 500); 1
 

Plot_2d
 

>