[Date Index]
[Thread Index]
[Author Index]
Re: Simplify by Recurrence Relations
*To*: mathgroup at smc.vnet.net
*Subject*: [mg75756] Re: Simplify by Recurrence Relations
*From*: dimitris <dimmechan at yahoo.com>
*Date*: Thu, 10 May 2007 05:06:03 -0400 (EDT)
*References*: <f1s3n1$h2g$1@smc.vnet.net>
Hello Ajit.
As always your queries are very good and make me think.
(and I learn/recall a couple of things!)
So...
What you want can be achieved as follows:
--->Add a rule about BesselJ function
BTW since you were interested in the function convert of another CAS
in Mathematica you can try
In[37]:=
FullSimplify[BesselJ[n, x], ComplexityFunction -> (If[Head[#1] ===
BesselJ, 1, 0] & )]
Out[37]=
(x^n*Hypergeometric0F1Regularized[1 + n, -(x^2/4)])/2^n
End of parenthesis
Before adding a rule for a built in command, you must first unprotect
it.
In[42]:=
Attributes[BesselJ]
Out[42]=
{Listable, NumericFunction, Protected}
In[43]:=
Unprotect[BesselJ];
Now
In[44]:=
Attributes[BesselJ]
Out[44]=
{Listable,NumericFunction}
It is time to add the rule
In[45]:=
BesselJ[n_, z_] := 2*(n/z)*BesselJ[n - 1, z] - BesselJ[n - 2, z] /; n
>= 2
In this way
In[46]:=
(BesselJ[#1, z] & ) /@ Range[5]
(Collect[#1, {BesselJ[0, z], BesselJ[1, z]}] & )[%]
Out[46]=
{BesselJ[1, z], -BesselJ[0, z] + (4*BesselJ[1, z])/z, -BesselJ[1, z] +
(6*(-BesselJ[0, z] + (4*BesselJ[1, z])/z))/z,
BesselJ[0, z] - (4*BesselJ[1, z])/z + (8*(-BesselJ[1, z] + (6*(-
BesselJ[0, z] + (4*BesselJ[1, z])/z))/z))/z,
BesselJ[1, z] - (6*(-BesselJ[0, z] + (4*BesselJ[1, z])/z))/z +
(10*(BesselJ[0, z] - (4*BesselJ[1, z])/z + (8*(-BesselJ[1, z] +
(6*(-BesselJ[0, z] + (4*BesselJ[1, z])/z))/z))/z))/z}
Out[47]=
{BesselJ[1, z], -BesselJ[0, z] + (4*BesselJ[1, z])/z, -((6*BesselJ[0,
z])/z) + (-1 + 24/z^2)*BesselJ[1, z],
(1 - 48/z^2)*BesselJ[0, z] + (192/z^3 - 12/z)*BesselJ[1, z], (-(480/
z^3) + 16/z)*BesselJ[0, z] +
(1 + 1920/z^4 - 144/z^2)*BesselJ[1, z]}
and so on.
Watch the desirable factoring and the rule is not applied for n<2. The
role of n>=2, because otherwise
$RecursionLimit::reclim messeges "fill" the screen! (Which is normal
of course.)
What about derivatives?
In[54]:=
(D[BesselJ[#1, z], z] & ) /@ Range[3]
(Collect[#1, {BesselJ[0, z], BesselJ[1, z]}] & )[%]
Out[54]=
{(1/2)*(2*BesselJ[0, z] - (4*BesselJ[1, z])/z), BesselJ[1, z] -
(4*BesselJ[1, z])/z^2 +
(2*(2*BesselJ[0, z] - (4*BesselJ[1, z])/z))/z, (1/2)*(-2*BesselJ[0,
z] + (4*BesselJ[1, z])/z) -
(6*(-BesselJ[0, z] + (4*BesselJ[1, z])/z))/z^2 +
(6*(BesselJ[1, z] - (4*BesselJ[1, z])/z^2 + (2*(2*BesselJ[0, z] -
(4*BesselJ[1, z])/z))/z))/z}
Out[55]=
{BesselJ[0, z] - (2*BesselJ[1, z])/z, (4*BesselJ[0, z])/z + (1 - 12/
z^2)*BesselJ[1, z],
(-1 + 30/z^2)*BesselJ[0, z] + (-(96/z^3) + 8/z)*BesselJ[1, z]}
and so on!
Hope that these are helpful.
Regards
Dimitris
=CF/=C7 Mr Ajit Sen =DD=E3=F1=E1=F8=E5:
> 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 Yaho=
o! Security Centre. http://uk.security.yahoo.com
Prev by Date:
**Re: How to get sqrt(Year^2)===Year?**
Next by Date:
**Re: How to get sqrt(Year^2)===Year?**
Previous by thread:
**Re: Simplify by Recurrence Relations**
Next by thread:
**Re: Simplify by Recurrence Relations**
| |