Re: problem with mathematica :(
- To: mathgroup at smc.vnet.net
- Subject: [mg98597] Re: problem with mathematica :(
- From: Peter Pein <petsie at dordos.net>
- Date: Mon, 13 Apr 2009 03:37:45 -0400 (EDT)
- References: <grs6c7$qjg$1@smc.vnet.net>
olfa schrieb:
> Hi Mathematica community,
> I have this system of equations:
> Reduce[{i >= iP, v + a*t/(1 - d) == vP + a*tP/(1 - d),
> t/d^(x/a) == tP/d^(xP/a), a*i + 1*x == a*iP + 1*xP,
> t/d^(i/-1) == tP/d^(iP/-1),
> z - c*x*(x - a)/(2*a) == zP - c*xP*(xP - a)/(2*a),iP==0},
> {iP,tP,vP,xP,zP},Backsubstitution->True]
> But mathematica still in running until I abort.Could you tell me what
> is the problem?
> Thank you.
>
Salut,
you know: iP==0. Usi this and the assumptions d>0 , a!=0 and all variables
are real:
In[1]:= sys = {i >= iP, v + a*(t/(1 - d)) == vP + a*(tP/(1 - d)),
t/d^(x/a) == tP/d^(xP/a),
a*i + 1*x == a*iP + 1*xP, t/d^(i/-1) == tP/d^(iP/-1),
z - c*x*((x - a)/(2*a)) == zP - c*xP*((xP - a)/(2*a)),
iP == 0};
tosolvefor = {iP, tP, vP, xP, zP};
In[3]:= simpsys =
FullSimplify[And @@ sys /. iP -> 0, Inequality[a, Unequal, 0, Less, d]]
Out[3]= d^i*t == tP && t/d^(x/a) == tP/d^(xP/a) &&
(a*(t - tP))/(-1 + d) + vP == v && a*i + x == xP &&
a*c*x + c*xP^2 + 2*a*z == c*x^2 + a*c*xP + 2*a*zP && i >= 0
In[4]:= vars =
Union[Cases[simpsys, s_Symbol /; ! NumericQ[s], Infinity]];
In[5]:= tosolvefor = Intersection[tosolvefor, vars];
I'll delete the parts telling us about real variables:
In[6]:= soln =
DeleteCases[
Reduce[And[simpsys, Im[vars] == 0 && a != 0 && 0 < d],
tosolvefor, Backsubstitution -> True], Element[_, Reals], 2]
Out[6]= (a != 0 && 0 < d < 1 && i >= 0 && tP == d^i*t &&
vP == ((-a)*t + a*d^i*t - v + d*v)/(-1 + d) && xP == a*i + x &&
zP == (1/2)*((-a)*c*i + a*c*i^2 + 2*c*i*x + 2*z))
||
(a != 0 && d > 1 && i >= 0 && tP == d^i*t &&
vP == ((-a)*t + a*d^i*t - v + d*v)/(-1 + d) && xP == a*i + x &&
zP == (1/2)*((-a)*c*i + a*c*i^2 + 2*c*i*x + 2*z))
and to compact this, use e.g:
In[7]:= LogicalCompact = Block[{common},
#1 //. Or[r1___, x_And, r2___, y_And, r3___ /;((common = Intersection[x,
y]) =!= True) :>
(common &&
Or @@ DeleteCases[{x, y}, Alternatives @@ common, 2]) ||
r1 || r2 || r3] & ;
In[8]:= LogicalCompact[soln]
Out[8]= tP == d^i*t && vP == ((-a)*t + a*d^i*t - v + d*v)/(-1 + d) &&
xP == a*i + x &&
zP == (1/2)*((-a)*c*i + a*c*i^2 + 2*c*i*x + 2*z) && i >= 0 &&
a != 0 &&
(0 < d < 1 || d > 1)
HTH,
Peter