Author 
Comment/Response 
akil

02/21/06 12:24pm
For my thesis I wrote a module that computes something for cones and two angles (not that important what it does).
This code produces a surface.
Now I need the derivative of Cones[alphaInput_, v_], so I need Cones'[alphaInput_, v_] to v, so I can plot the maximal curve of the surface.
I tried using
D[Conesv2[x, y], y]
Solve[% == 0, x]
and then plotting this, but Mathematica won't even return something for Solve.I also tried it with removing the if statements, but didn't work.
That attempt is added as attachment.
Cones[alphaInput_, v_] := Module[{betafinal, alpha, vgebruik, heightv},
alpha = alphaInput /180 * Pi;
ax = 3; ay = 3; bx = 6; by = 7; cx = 22; cy = 2; dx = 17; dy = 8;
abslope = (by  ay)/(bx  ax);
cdslope = (dy  cy)/(dx  cx);
heightv = 0;
rcad = (dy  ay)/(dx  ax);
AD[x100_] := rcad*x100  (rcad*ax) + ay;
rcac = (ay  cy)/(ax  cx);
AC[x103_] := rcac*x103 + ay  (rcac*ax);
rcbc = (by  cy)/(bx  cx);
BC[x101_] := rcbc*x101 + cy  (rcbc*cx);
rcbd = (by  dy)/(bx  dx);
BD[x104_] := rcbd*x104 + by  (rcbd*bx);
part1 = rcad*x102 + ay  (rcad*ax);
part2 = rcbc*x102 + cy  (rcbc*cx);
part3 = rcac*x102 + ay  (rcac*ax);
part4 = rcbd*x102 + by  (rcbd*bx);
centerx = If[
ay < by, Solve[part1 == part2, x102], Solve[part3 == part4, x102]];
centerOfMassx = x102 /. centerx;
centerOfMassy = If[ay < by, BC[centerOfMassx], BD[centerOfMassx]];
AB[x_] := abslope*x + ay  abslope*ax;
CD[x_] := cdslope*x + cy  cdslope*cx;
mostRight = If[cx > dx, cx, dx];
vbegin = If[(alpha == 90/180*Pi ), ax, (ay + Tan[alpha]*ax)/Tan[alpha]];
veind = If [
alpha === 90/180*
Pi, bx, If[(by + Tan[
alpha]*bx)/Tan[alpha] > mostRight, mostRight, (by +
Tan[alpha]*bx)/Tan[alpha]]];
vtemp = v;
retour = If[vbegin ≤ vtemp ≤ veind,
vgebruik = vtemp;
VE[aa_, vv_, x_] := Tan[aa]*x + Tan[aa]*vv + Tan[aa]*heightv;
ex = Solve[AB[x1] == VE[alpha, vgebruik, x1], x1];
exx = x1 /. ex;
ey = AB[exx];
ecomrc = (centerOfMassy  ey)/(centerOfMassx  exx);
erc = ecomrc;
ecomb = erc*exx + ey;
fxwaarde = (cy  cdslope*cx  ecomb)/(ecomrc  cdslope);
fy = CD[fxwaarde];
slope = (fy  heightv)/(fxwaarde  vgebruik);
betafinal = ArcTan[slope]/Degree;
First[betafinal]
, Return[0]]
]
(*Plot3D[Evaluate[Cones[x5, y5]], {x5, 1, 90}, {y5, 0, 30},
PlotPoints > 200, ViewPoint > {0, 0, 2}, AxesLabel > {"Alpha", "V", "
Beta"}, PlotRange > {0, 90} , Mesh > False]*)
Attachment: test.nb, URL: , 
