MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Odd little Bessel function quirk

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79059] Re: Odd little Bessel function quirk
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Tue, 17 Jul 2007 03:24:02 -0400 (EDT)

On 7/16/07 at 2:19 AM, siegman at stanford.edu (AES) wrote:

>[Indented lines are Output cells; others are Input cells]

>f[r_] := If[r =E2=89=A4 1, BesselJ[0, \ r], BesselK[0, r]]
>f[r]

>If[r =E2=89=A4 1, BesselJ[0, r], BesselK[0, r]]

>D[f[r], r]

>If[r =E2=89=A4 1, 1/2 (BesselJ[-1, r] - BesselJ[1, r]), 1/2 (-BesselK[-1, r]
>- BesselK[1, r])]

>D[f[r], r] /. r =E2=89=A4 1 -> True

>-BesselJ[1, r]

>D[f[r], r] /. r =E2=89=A4 1 -> False

>-BesselK[1, r]

>Nothing erroneous here (so far as I know) -- but how come the
>results of the (superfluous) 4th and 5th Input lines are simplified,
>but the 3rd one is not?

In the 4th and 5th input lines you provided a rule that
specified whether r<=1 was true or not. Consequently, the If
statement evaluated to one of the alternatives before the
derivative was computed and simplified. With the third input
Mathematica sees the If statement, cannot resolve it and
consequently doesn't go further with respect to simplification.

If you want the third input simplified further use Simplify, i.e.,

In[7]:= D[f[r], r] // Simplify

Out[7]= Piecewise[{{-BesselJ[1, r], r <= 1}}, -BesselK[1, r]]
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Odd little Bessel function quirk
  • Next by Date: Re: Cascaded (Multi-range) Iterators?
  • Previous by thread: Re: Odd little Bessel function quirk
  • Next by thread: How to Map[ f[x,y], {y}]?