Re: Beginner question: operating on piecewise defined functions
- To: mathgroup at smc.vnet.net
- Subject: [mg41638] Re: Beginner question: operating on piecewise defined functions
- From: "David W. Cantrell" <DWCantrell at sigmaxi.org>
- Date: Thu, 29 May 2003 08:14:08 -0400 (EDT)
- References: <bb1v7e$9hc$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Jan Rychter <jan at rychter.com> wrote:
> If I define a piecewise function as, say:
>
> f[x_] := 1/x^2 /; x >= 1
> f[x_] := 1 /; x < 1
>
> then how can I get Mathematica to operate on it, as in:
>
> Limit[f[x], {x->Infinity}]
>
> Just trying that returns the expression unevaluated
Good question!
I had thought that the answer might lie in rewriting your function in terms
of the UnitStep function: 1 + (-1 + x^(-2))*UnitStep[-1 + x] .
Alas, that doesn't work; again the limit is returned unevaluated.
(BTW, my rewriting above isn't quite equivalent to your function since my
form is undefined at x = 0.)
Here's what does work (except again at x = 0):
Rewrite your function as (1 + x^2 - (1 + x)*Abs[-1 + x])/(2*x^2) .
Thankfully, Mathematica can find the limit of that as x -> Infinity.
But there must be a better way. I'll be interested in seeing other replies.
David Cantrell