Re: Limits pre- & post-Solve[]

*To*: mathgroup at smc.vnet.net*Subject*: [mg14644] Re: Limits pre- & post-Solve[]*From*: "Webmaster" <webmaster at salford-software.com>*Date*: Sat, 7 Nov 1998 02:09:57 -0500*Delivered-to*: catchall-comp-soft-sys-math-mathematica@moderators.isc.org*Organization*: Salford Software.com*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 db at salford-software.com Richard W. Klopp wrote in message <70rkib$4u5$5 at dragonfly.wolfram.com>... >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]? > > >