MathGroup Archive 2011

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

Search the Archive

Re: Trouble using Eliminate and Reduce with big examples

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118004] Re: Trouble using Eliminate and Reduce with big examples
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Fri, 8 Apr 2011 04:14:12 -0400 (EDT)

Johannes Gross wrote:
> Hi,
> 
> i am generating equation systems for dimensional analysis in engineering 
> applications. When trying to replace the dimensional parameters by the 
> dimensionless ones, i get problems with the Eliminate and Reduce 
> functions in Mathematica.
> 
> Sometimes Eliminate works even for very big examples, sometimes it 
> doesnt. Same with Reduce.
> 
> My equations are of the nature
> f(x1, ... , xn)
> pi0= f(x1,x2)
> pi1= f(x3,x2,x4) etc.
> 
> i want to eliminate all xn variables and i know that its possible 
> because i can do it by hand.
> 
> I think Mathematica has problems when case-by-case-analysis requires 
> many cases. I tried to avoid this by telling that all variables are 
> positive (e.g. Reduce[{a == x^2, x > 0, a > 0}, x]). It did not improve 
> runtime.
> 
> Example 1:
> 
> Eliminate[{pe ==
>     1/f 1.` (-0.35` c +
>        1.4254109407099804` f ((R k c^2 Eb lm ll Tn (re -
>                 1.` sma)^2)/(f^2 etaG Dg^2 P etaT))^0.5`) (-0.25` + \
> (0.5079490874739279` R k Eb lm ll Tn (re -
>               1.` sma)^2)/(etaG Dg^2 P etaT))^0.5`, Pi0 == etaT,
>    Pi1 == ll, Pi2 == f*c^-1*re^1, Pi3 == pe*re^-1, Pi4 == etaG,
>    Pi5 == k*P^-1*c^1*re^-1*Tn^1, Pi6 == R*c^-1*re^1*Eb^1,
>    Pi7 == sma*re^-1, Pi8 == lm, Pi9 == Dg*re^-1}, {etaT, ll, f, pe,
>    etaG, k, R, sma, lm, Dg}]
> 
> 
> Questions:
> 
> How can i tell mathematica to avoid case-by-case-analysis (because i 
> only need the positive, real results)?
> How can i eliminate variables in another way than by reduce or eliminate?
> How might i improve runtime of reduce or eliminate in these cases?
> 
> Any answer to any of the questions is warmly welcome!
> 
> Thanks,
> 
> Johannes

This is a bit unclear to me. In particular I do not see how Example 1 
(of 1, I gather) is related to either the remarks preceding it, or to 
the first question.

I can indicate how to do the elimination step, though. The issue is that 
Eliminate is, by and large, legacy code. There are a couple of ways to 
go about it. For my

One is to first explicitly eliminate variables using GroebnerBasis. I 
first set up the system. Note that I changed decimal powers to exact 
rationals.

eqns = {pe == (1.*(-0.25 +
        (0.5079490874739279*Eb*k*ll*lm*R*(re - 1.*sma)^2*Tn)/
        (Dg^2*etaG*etaT*P))^(1/2)*(-0.35*c + 1.4254109407099804*f*
       ((c^2*Eb*k*ll*lm*R*(re - 
1.*sma)^2*Tn)/(Dg^2*etaG*etaT*f^2*P))^(1/2)))/f,
  Pi0 == etaT, Pi1 == ll, Pi2 == (f*re)/c, Pi3 == pe/re, Pi4 == etaG,
  Pi5 == (c*k*Tn)/(P*re), Pi6 == (Eb*R*re)/c, Pi7 == sma/re, Pi8 == lm,
  Pi9 == Dg/re};

exprs = Apply[Subtract,eqns,1];

elimvars = vars = {etaT, ll, f, pe, etaG, k, R, sma, lm, Dg}
keepvars = Complement[Variables[exprs],elimvars];;

I now compute a generating set for the system with the specified 
variables eliminated.

InputForm[Timing[gb = GroebnerBasis[exprs, keepvars, elimvars,
   MonomialOrder->EliminationOrder,
   CoefficientDomain->InexactNumbers]]]

Out[12]//InputForm=
{0.10598400000000001, {1.*Pi1^4*Pi5^4*Pi6^4*Pi8^4 -
    8.*Pi1^4*Pi5^4*Pi6^4*Pi7*Pi8^4 + 27.999999999999996*Pi1^4*Pi5^4*Pi6^4*
     Pi7^2*Pi8^4 - 55.99999999999999*Pi1^4*Pi5^4*Pi6^4*Pi7^3*Pi8^4 +
    69.99999999999999*Pi1^4*Pi5^4*Pi6^4*Pi7^4*Pi8^4 -
    55.99999999999999*Pi1^4*Pi5^4*Pi6^4*Pi7^5*Pi8^4 +
    27.999999999999996*Pi1^4*Pi5^4*Pi6^4*Pi7^6*Pi8^4 -
    8.*Pi1^4*Pi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^2*Pi2^2*Pi3^2*Pi4^2*Pi5^2*
     Pi6^2*Pi7^3*Pi8^2*Pi9^4 + 0.3645675015084412*Pi0^2*Pi1^2*Pi4^2*Pi5^2*
     Pi6^2*Pi7^4*Pi8^2*Pi9^4 - 1.9378922925187378*Pi0^2*Pi1^2*Pi2^2*Pi3^2*
     Pi4^2*Pi5^2*Pi6^2*Pi7^4*Pi8^2*Pi9^4 - 0.032787772020290366*Pi0^3*Pi1*
     Pi4^3*Pi5*Pi6*Pi8*Pi9^6 + 
0.8369443555563412*Pi0^3*Pi1*Pi2^2*Pi3^2*Pi4^3*
     Pi5*Pi6*Pi8*Pi9^6 + 
0.06557554404058073*Pi0^3*Pi1*Pi4^3*Pi5*Pi6*Pi7*Pi8*
     Pi9^6 - 1.6738887111126823*Pi0^3*Pi1*Pi2^2*Pi3^2*Pi4^3*Pi5*Pi6*Pi7*Pi8*
     Pi9^6 - 0.032787772020290366*Pi0^3*Pi1*Pi4^3*Pi5*Pi6*Pi7^2*Pi8*Pi9^6 +
 
0.8369443555563412*Pi0^3*Pi1*Pi2^2*Pi3^2*Pi4^3*Pi5*Pi6*Pi7^2*Pi8*Pi9^6 +
    0.000880544835576746*Pi0^4*Pi4^4*Pi9^8 + 
0.05750496885399157*Pi0^4*Pi2^2*
     Pi3^2*Pi4^4*Pi9^8 + 0.9388566343508825*Pi0^4*Pi2^4*Pi3^4*Pi4^4*Pi9^8}}

Can now get solutions for some variables. Here we notice that the 
polynomial "system" has only one member once we eliminated the specified 
variables. So we do not expect that solutions will "solve" for all 
remaining variables.

Timing[solns = Reduce[gb==0, keepvars];]

Reduce::ratnz: Reduce was unable to solve the system with inexact
     coefficients. The answer was obtained by solving a corresponding exact
     system and numericizing the result.

Out[16]= {6.51301, Null}

Also when I looked at some solutions I saw huge coefficients in places. 
This means you will likely get garbage (due to truncation error) if/when 
you substitute values for any variables that were not solved in terms of 
others.

An alternative method might be to use Reduce directly. But I have not 
figured out a way to get that to work in reasonable time. This might 
mean the problem is difficult when cast that way. Or it might indicate a 
deficiency in Reduce. Or a deficiency in me.

A similar question arose recently in a different forum. It has at least 
one relaated response.

http://stackoverflow.com/questions/5335006/get-branch-points-of-equation

Daniel Lichtblau
Wolfram Research


  • Prev by Date: fitting a parametric curve
  • Next by Date: Recognize multiple outputs
  • Previous by thread: Trouble using Eliminate and Reduce with big examples
  • Next by thread: Re: Trouble using Eliminate and Reduce with big examples