Re: Problems solving using Solve
- To: mathgroup at smc.vnet.net
- Subject: [mg68832] Re: Problems solving using Solve
- From: "akil" <akomur at wanadoo.nl>
- Date: Mon, 21 Aug 2006 03:27:26 -0400 (EDT)
- References: <ec65bn$1f8$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Sorry, ab[input_,rcAB_,ax_,ay_] := rcAB*input + ay - rcAB*ax; I hope I did not forget anything else. I need the derivative because it gives me the maximum or minimum answer for Cone for each beta, and that is needed for further steps in my project. The code itself works quite well. Tested it extensively on cones, and double checked te answers. Also checked if the maximums were where they were supposed to be, and that also checked out. A picture of an example is at: http://home.wanadoo.nl/akomur/example.png Akil "akil" <akomur at wanadoo.nl> schreef in bericht news:ec65bn$1f8$1 at smc.vnet.net... >I have a problem suing the following code: > > Cone[beta_, v_,rcAB_,rcCD_,ax_,ay_,cx_,cy_,centerOfMassx_,centerOfMassy_] > := > Module[ > {betaUsed, vtemp, fx, fy, ex, ey, > waarde,criticalRC,criticalHeight,xVerplaatsing,ePx2Py2}, > betaUsed = beta ; > vtemp = v; > fline[x_] := Tan[betaUsed]x - Tan[betaUsed]vtemp; > fx = x /. Solve[fline[x] == cd[x,rcCD,cx,cy], x][[1]]; > fy = cd[fx,rcCD,cx,cy]; > criticalRC = (centerOfMassy - fy)/(centerOfMassx - fx); > criticalHeight = -criticalRC*fx + fy; > ex = (-ay + rcAB*ax + criticalHeight)/(rcAB + (-criticalRC)); > ey = ab[ex,rcAB,ax,ay]; > xVerplaatsing = ex - vtemp; > ePx2Py2 = Sqrt[xVerplaatsing^2 + ey^2]; > waarde = xVerplaatsing/ePx2Py2; > ArcCos[-waarde] > ]; > > afg = > Simplify[D[Cone[beta,v,rcAB,rcCD,ax,ay,cx,cy,centerOfMassx,centerOfMassy],v], > TimeConstraint -> 1 ]; > Solve[afg== 0, v]; > > eg. > {ax,ay}= {-44.9376, 36.1678} and {cx,cy}= {17.8329, 122.477} and > {centerOfMassx,centerOfMassy}={-18.6338,72.3356} and rcAB=-0.166667 and > rcCD=-0.37931 > > Doing the Solve[afg== 0, v] takes ages (after an hour I quit it). Is there > any way I can make it work faster? Is any code in Cone such that it > unnecessarily makes it run faster? So are there any ways I can try to make > everything run faster? Using integers it runs, but it takes too long when > using real cones (made up of four points A B C D and a centerOfMass). > > Akil > >