capacitator

5 Reputation

One Badge

9 years, 224 days

MaplePrimes Activity


These are replies submitted by capacitator

@tomleslie 

wooo yes it's working now !

thanks a lot guys you saved me :) 

have a nice day !

Thank you for the very quik answer!

About 'tan 6' it was my fault i copied and pasted the result also, sorry.

Ok i've changed pi with Pi , and i've added DirectSearch but it doesn't work.. i can't even find it with the help. It may be implemented in recent versions of maple (mine is 2015.1).

new code:

restart:

L := 1:

b := 1.1:

p := 1.8:
xa := 0:
xd := -b/2:
ya := -p+z:
yd := 0:


quadrilatero := proc(q,xa,ya,xd,yd,l1,l2,l3,modo,alpha0,alpha1)
local xb,yb,l5,c,alpha,theta5,theta2,xc,yc,theta3,xm,ym:

xb := xa+l1*cos(q + alpha0 + Pi/2):
yb := ya+l1*sin(q + alpha0 + Pi/2):
l5 := sqrt((xd-xb)^2+(yd-yb)^2):
c := (l2^2+l5^2-l3^2)/(2*l2*l5):
if modo = 1 then alpha := arccos(c) else alpha := -arccos(c) end if:
theta5 := arctan(yd-yb,xd-xb):
theta2 := theta5 + alpha:
xc := xb + l2*cos(theta2 + Pi):
yc := yb + l2*sin(theta2 + Pi):
theta3 := arctan(yd-yc,xd-xc):
return (theta3 - Pi - alpha1):
end proc:
#funione sterzo
f := proc(q,ya,l1,l2,l3,yd,alpha0,alpha1)
local theta;
theta := quadrilatero(q, 0, ya,-b/2,0, l1, l2, l3, -1,alpha0,alpha1) - Pi/2;
if theta < Pi and Im(theta) = 0 then theta := theta + 2*Pi end if;
return theta;
end proc:
#funzione desiderata
Yd(q) := arctan(tan(q),(1 - b*tan(q)/2/p)):

#Definisco procedura dei minimi quadrati:
n := 1: i := 0:
q := Vector[n]: rms := 0:
for i from 0 by 1 to (n-1) do
q[i] := Pi*(i/(4*n)):
rms := rms + abs(f(q[i],ya,l1,l2,l3,yd,alpha0,alpha1) - yd(q[i])^2):
end do:
rms := sqrt(rms / n):
#with(Optimization):
#Optimization[NLPSolve](((rms)));
DirectSearch[Search](rms, [z = -0.4..0,alpha0 = 0..Pi/3,alpha1 = Pi/2..5*Pi/4,l1 = 0.3..1,l2 = 0.001..0.3,l3 = 0.01..0.3]);

 

and the result is :

 

DirectSearch[Search](sqrt(abs(-arctan(1.8-z-l1*cos(alpha0)-l2*sin(-arctan(1.8-z-l1*cos(alpha0), -.5500000000+l1*sin(alpha0))+arccos((1/2)*(l2^2+(-.5500000000+l1*sin(alpha0))^2+(1.8-z-l1*cos(alpha0))^2-l3^2)/(l2*sqrt((-.5500000000+l1*sin(alpha0))^2+(1.8-z-l1*cos(alpha0))^2)))), -.5500000000+l1*sin(alpha0)+l2*cos(-arctan(1.8-z-l1*cos(alpha0), -.5500000000+l1*sin(alpha0))+arccos((1/2)*(l2^2+(-.5500000000+l1*sin(alpha0))^2+(1.8-z-l1*cos(alpha0))^2-l3^2)/(l2*sqrt((-.5500000000+l1*sin(alpha0))^2+(1.8-z-l1*cos(alpha0))^2)))))+(3/2)*Pi+alpha1)), [z = -.4 .. 0, alpha0 = 0 .. (1/3)*Pi, alpha1 = (1/2)*Pi .. (5/4)*Pi, l1 = .3 .. 1, l2 = 0.1e-2 .. .3, l3 = 0.1e-1 .. .3])

should i download some extra libraries ? 

Page 1 of 1