Re: piecewise vs which

*To*: mathgroup at smc.vnet.net*Subject*: [mg60167] Re: piecewise vs which*From*: Peter Breitfeld <phbrf at t-online.de>*Date*: Mon, 5 Sep 2005 22:27:24 -0400 (EDT)*References*: <df9437$620$1@smc.vnet.net> <dfbfl4$isf$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Helen Read schrieb: > > Limit does indeed default to Direction->-1. Try, for example, > Limit[Abs[x]/x,x->0] > > I don't like this at all. For purposes of teaching calculus students, > where we are only concerned with real numbers and are not taking limits > in the complex plane, I would like Limit to check from both directions. > Why don't you write a little function to test the equality of both limits, like this: tsLimit[expr_, limRule_] := Module[{right, left}, left = Limit[expr, limRule, Direction ->1]; right =Limit[expr, limRule, Direction -> -1]; If[left == right, right, Indeterminate]] Then tsLimit[g[x],x->2] will return Indeterminate. Gruss Peter -- ==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-== Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de