MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Problems solving using Solve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68861] Re: [mg68829] Re: Problems solving using Solve
  • From: brucem at wolfram.com
  • Date: Mon, 21 Aug 2006 03:28:29 -0400 (EDT)
  • References: <ec65bn$1f8$1@smc.vnet.net> <200608200843.EAA04405@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

If exact numbers give a quick solution, how about using
exact (rational) approximations to the floating-point
parameters?

{ax,ay} = Rationalize[{-44.9376, 36.1678}];
{cx,cy} = Rationalize[{17.8329, 122.477}];
{centerOfMassx,centerOfMassy} = Rationalize[{-18.6338,72.3356}];
rcAB = Rationalize[-0.166667];
rcCD = Rationalize[-0.37931];

In[25]:=
{ax,ay,cx,cy,centerOfMassx,centerOfMassy,rcAB,rcCD}

Out[25]=
   28086   180839  178329  122477    93169   180839    166667      37931
{-(-----), ------, ------, ------, -(-----), ------, -(-------), -(------)}
    625     5000   10000    1000     5000     2500     1000000     100000


N[] can convert the results back to floating-point.

Bruce Miller
Technical Support
Wolfram Research, Inc.
support at wolfram.com
http://support.wolfram.com/



>
> definition for cd is cd[input_,rcCD_,cx_,cy_] := rcCD*input + cy -
> rcCD*cx;
> (which just defines a line of the form y=ax+b)
>
> Using NSolve instead of Solve still takes way too long (quit it after 15
> minutes, do not know if it even will solve it). I have about a 100 cones
> for
> each part I need to test and the way it is now takes too long.
>
> In my usage all values except beta and v are Reals. Beta is usually the
> range [0, Pi/2] and v is also a Real.
>
> For a solvable solution try:
>
> {ax,ay}= {7,4} and {cx,cy}= {21,11} and
> {centerOfMassx,centerOfMassy}={13,7} and rcAB=3 and
> rcCD=7/4
>
> That should give a solution, and quite fast at that.
>
> 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
>>
>>
>
>



  • Prev by Date: Re: benchmark...why don't you send it back?
  • Next by Date: RE: Re: Re: Change CellTags with FrontEnd
  • Previous by thread: Re: Problems solving using Solve
  • Next by thread: Re: Problems solving using Solve