[Date Index]
[Thread Index]
[Author Index]
Re: Limits pre- & post-Solve[]
*To*: mathgroup at smc.vnet.net
*Subject*: [mg14623] Re: Limits pre- & post-Solve[]
*From*: mark at salford-software.com (Mark Stevens)
*Date*: Wed, 4 Nov 1998 13:46:53 -0500
*Organization*: Salford Software Ltd
*References*: <70rkib$4u5$5@dragonfly.wolfram.com>
*Sender*: owner-wri-mathgroup at wolfram.com
The simplest answer to this question is to set n=m using 'Block'. This
performs the substitution before 'Solve' gets to process the equations
and 'Solve' gets the correct answer right off:
Block[{n=m},Solve[Integrate[m x + b,{x,0,t+h}]==
Integrate[n x +c,{x,0,t-h}],h]]
In a way this is just doing what you did manually to produce Out[158],
but obviously it could form part of some larger construct which sets n
to a range of values - so it may be an effective answer to your
problem.
As far as I can see the real problem lies with 'Limit' rather than
'Solve', which produced a valid answer either way of working. I think
the trouble is that 'Limit' gets confused because of the two-valued
nature of the square root - if you take the negative branch of the Sqrt
the answer is indeed infinite. Maybe Mathematica should make 'Limit'
put out a diagnostic on these occasions, or even have an option to use
the same assumptions as PowerExpand.
David Bailey
Salford Software Ltd.
On 24 Oct 1998 04:20:27 GMT, "Richard W. Klopp" <rwklopp at unix.sri.com>
wrote:
>I've run into difficulties while solving a practical problem. I can
>illustrate with a simpler example. Consider two linear functions
>f[x]:=m x + b, and g[x]:= n x + c. The question that I want to answer
>is how far from the origin do I have to integrate each function so that
>their definite integrals are equal. I ask for the answer as left and
>right offset h from some target ordinate t, as shown below. Visualize
>it as equating the areas under two straight lines bounded on the left
>by the origin.
>
>In[154]:=
>
>Solve[Integrate[m x + b,{x,0,t+h}]==Integrate[n x + c,{x,0,t-h}],h]
>
>Out[154]=
>
>{{h -> (-b - c - m*t - n*t -
> Sqrt[b^2 + 2*c*b + 4*n*t*b + c^2 + 4*m*n*t^2 + 4*c*m*t])/
> (m - n)}, {h ->
> (-b - c - m*t - n*t + Sqrt[b^2 + 2*c*b + 4*n*t*b + c^2 +
> 4*m*n*t^2 + 4*c*m*t])/(m - n)}}
>
>I think that you can anticipate the problem if the slopes of the lines,
>m and n are the same:
>
>In[155]:=
>
>Solve[Integrate[m x + b,{x,0,t+h}]==Integrate[n x +
>c,{x,0,t-h}],h]/.n->m
>
>\!\(Power::"infy" \( : \ \) "Infinite expression \!\(1\/0\)
>encountered."\)
>\!\(Power::"infy" \( : \ \) "Infinite expression \!\(1\/0\)
>encountered."\)
>
>Out[155]=
>
>{{h -> ComplexInfinity}, {h -> ComplexInfinity}}
>
>Taking the limit as one slope approaches the other m->n doesn't help.
>
>In[157]:=
>
>Limit[h/.Solve[Integrate[m x + b,{x,0,t+h}]==Integrate[n x +
>c,{x,0,t-h}],h],
> n->m]
>
>Out[157]=
>
>{DirectedInfinity[b + c + 2*m*t +
> Sqrt[b^2 + 2*c*b + 4*m*t*b + c^2 + 4*m^2*t^2 + 4*c*m*t]],
> DirectedInfinity[b + c + 2*m*t -
> Sqrt[b^2 + 2*c*b + 4*m*t*b + c^2 + 4*m^2*t^2 + 4*c*m*t]]}
>
>However, if I makes the slopes equal before I Solve[], everything's
>fine.
>
>In[158]:=
>h/.Solve[((Integrate[m x + b,{x,0,t+h}]-Integrate[n x +
>c,{x,0,t-h}])/.n->m)==
> 0,h]
>
>Out[158]=
>
>{((-b + c)*t)/(b + c + 2*m*t)}
>
>What's going on and how do I get In[154] to behave as I desire, that is,
>come out with something like Out[158]?
>
>
>
--
David Bailey Salford Software Ltd Adelphi House,
Adelphi Street, Salford, M3 6EN, UK Tel: +44 (0) 161 834 2454
Fax: +44 161 834 2148 Web: www.salford.co.uk email:
db at salford-software.com
Prev by Date:
**Comparison of Mathematica on Various Computers**
Next by Date:
**Junior Research Fellow/Research Assistant in CFD**
Previous by thread:
**Comparison of Mathematica on Various Computers**
Next by thread:
**Re: Limits pre- & post-Solve[]**
| |