Re: Simplify by Recurrence Relations

• To: mathgroup at smc.vnet.net
• Subject: [mg75800] Re: Simplify by Recurrence Relations
• From: David Bailey <dave at Remove_Thisdbailey.co.uk>
• Date: Fri, 11 May 2007 05:18:59 -0400 (EDT)
• References: <f1s3n1\$h2g\$1@smc.vnet.net> <f1upqj\$8ij\$1@smc.vnet.net>

```dh wrote:
> Hi Ajit,
>
> you could e.g. define a rule for BesselJ that reduces the order. E.g:
>
> Unprotect[BesselJ];
>
> BesselJ[n_/;n>1,z_]=2n/z BesselJ[n-1,z]-BesselJ[n-2,z];
>
> now try:
>
> D[BesselJ[2, x], x] // Simplify
>
> hope this helps, Daniel
>
>
>
> Mr Ajit Sen wrote:
>
>> Dear Mathgroup,
>
>
>>   Could someone please show me how to simplify a
>
>>   function by using its recurrence relations.
>
>>
>
>>   As a simple example, let's take the Bessel
>
>> recurrence
>
>>   relation
>
>
>>      BesselJ[n+1,z]= 2n/z BesselJ[n,z]-BesselJ[n-1,z].
>
>
>>   How do I get Mathematica (5.2 !) to evaluate
>
>
>>                D[BesselJ[2,x],x]
>
>
>>   as   (1-4/x^2)BesselJ[1,x]+ 2/x BesselJ[0,x]
>
>
>>   instead of (BesselJ[1,x]-BesselJ[3,x])/2 ?
>
>
>>   [Basically, reduce the order to 0 &/or 1, so that
>
>> all
>
>>   J0 and J1 can be factored out later.]
>
>
>>   Thanking you in advance.
>
>
>>   Ajit.
>
>
>
>
>>
>
>> ___________________________________________________________
>
>> To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
>
>
>
>
The problem with changing the built-in function in this way, is that you
end up with no choice as to whether to use the relation. Also, in more
complicated cases it may be hard to debug if it goes into an infinite
loop (suppose you omit the test n>0).

I would define something like:

besselSimplify={BesselJ[n_/;n>1,z_]->2n/z  BesselJ[n-1,z]-BesselJ[n-2,z]};

After making this definition, you can use expr/.besselSimplify or
expr//.besselSimplify (to get exhaustive simplification. Obviously, it
is easier to debug with /. rather than //.

David Bailey
http://www.dbaileyconsultancy.co.uk

```

• Prev by Date: Re: 6.0 not seeing style sheets in \$InstallationDirectory/SystemFiles/FrontEnd/StyleSheets
• Next by Date: Re: infinite loop depending on previous function call
• Previous by thread: Re: Simplify by Recurrence Relations
• Next by thread: Re: Re: What happened to the