MathGroup Archive 2002

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

Search the Archive

RE: Strategy for overly long computations?

First of all, you have 16 unknowns, not 5 --- x, y, z, x1, x2, y1, y2,
z1, z2, r1, r2, xv, yv, zv, lm1, and lm2.

Eliminating lm1 and lm2 brings it down to 14 variables, with 3 equations
--- two quadratic and one of THIRD degree.

I realize there's language in Help for Reduce and Solve about variables
and parameters, but there's no practical difference.  Mathematica still
has to deal with all that dimensionality, with too few equations to
reduce it.  There are many, many, many special cases, with that many

You can do a change of variables to make x1==x2==x3==0 in the new
coordinate system:

eqns /. {x -> x + x1, y -> y + y1, z -> z + z1} /. {x1 -> 0, y1 -> 0, 
        z1 -> 0} // Simplify
Solve[eqns2, {x, y, z}]

(Solve worked quickly this time, but it's a very complicated solution!)

You might further reduce the problem by looking for symmetries.  For
instance, permutations of the three coordinates, accompanied by
permutations of the associated parameters, don't matter, so you could
assume x2>y2>z2 or something like that.  Reduce and Solve can't use
assumptions, so that may not help.  But keep looking for
simplifications.  Try this, for instance:

I never let a calculation run more than two minutes if I don't have good
reason to think it will succeed.  Try a smaller problem by falling back
to two dimensions, and see what happens.


-----Original Message-----
From: Peter S. Shenkin [mailto:shenkin at] 
To: mathgroup at
Subject: [mg35350]  Strategy for overly long computations?


I'm trying to solve a set of 5 eqns in 5 unknowns, three of which
are quadratic and two of which are linear.  I'm only interested
in three of the unknowns, so first I eliminate the other two.

So far, Mathematica 4.0 on an UltraSPARC has been grinding away for
over 24 hours on this system at 96% of the CPU.  There are no

Does anyone out there have any insight into any of:

1.  Whether this system is so tough it'll take "forever" to get
    through all the possibilities;

2.  Whether there's some way of reorganizing the calculation so
    that Mathematica can work faster;

3.  Whether I'm encountering some sort of bug or malfunction;

4.  Whether I'm doing something really stupid.

Thanks.  The system is shown here;  I'm running in background,
redirecting stdin from a file with contents shown here.  The
calculation through the first Save is nearly immediate;  almost
all the time so far is taken up in the Reduce step.

For clarity, let me say that I'm running the job as:

    math < intersect >& intersect.log &

cn1 = ( x - x1 )^2 + ( y - y1 )^2 + ( z - z1 )^2  == r1^2
cn2 = ( x - x2 )^2 + ( y - y2 )^2 + ( z - z2 )^2  == r2^2
lgrx = ( x - xv ) + lm1 * ( x - x1 ) + lm2 * ( x - x2 ) == 0
lgry = ( y - yv ) + lm1 * ( y - y1 ) + lm2 * ( y - y2 ) == 0
lgrz = ( z - zv ) + lm1 * ( z - z1 ) + lm2 * ( z - z2 ) == 0

lgrxyz = { lgrx, lgry, lgrz }
elim = Eliminate[ lgrxyz, {lm1,lm2} ]
eqns = { cn1, cn2, elim }

Save[ "intersect.out", cn1, cn2, lgrx, lgry, lgrz, lgrzyx, elim, eqns ]

redn = Reduce[ eqns, {x,y,z} ]
Save[ "intersect.out", redn ]
soln = Solve[ eqns, {x,y,z} ]
Save[ "intersect.out", soln ]



work: shenkin at = 100%
play: shenkin at  =   0%
Peter S. Shenkin              = Dull boy


  • Prev by Date: Re: entering problem
  • Next by Date: RE: AppendTo VERY slow
  • Previous by thread: Strategy for overly long computations?
  • Next by thread: RE: Strategy for overly long computations?