> bessel_j(nu-1,z)+bessel_j(nu+1,z) = (2*nu/z) * bessel_j(nu,z)
...
> After substituting a solution into a differential equation
> I have the following expression that should equal zero....
I don't know of any straightforward way to do this using patterns, or
any other way to do it automatically (automagically as we say), but
here's the approach I would take. For simplicity, I will use b(n) as a
shorthand for bessel_j(n,x^2/2). By the way, in my version of Maxima
(5.9.0), the arguments to bessel_j are in the other order! anyway....
First rewrite the identity so that they it function as a substitution,
namely with one term on one side:
ident: b(n-1)+b(n+1)=2*n/(x^2/2)*b(n)$
ident1: subst(n+1,n,ident)$
identsub: solve(ident1,b(n))$
Now let's write your expression:
expr: ( ( ( b(-1/4) + b(-9/4) ) * %c
+ b(1/4) + b(-7/4)
) * x^2
+ 5 * b(-5/4) * %c
+ 3 * b(-3/4)
)$
Now instantiate identsum with the lowest order n=-9/4 (using
subst(-9/4,n,identsub)), and substitute. Then do the same with n=-7/4.
Note that I do *NOT* define b as some sort of function or global
substitution rule, which would be much harder to control.
If you have many expressions like this to process, you might want to try
to get cleverer, but the semi-automatic (semi-manual?) way might be
acceptable if you don't need to do this very often.
I hope this is helpful.
A completely different approach -- if you're only comparing to zero --
is to expand as series. But I haven't looked into that in detail. The
straightforward approach of calling Taylor doesn't seem to get you very
far.
Here's a batchfile that uses the substitution approach:
ident: b(n-1)+b(n+1)=2*n/(x^2/2)*b(n);
ident1: subst(n+1,n,ident);
identsub: solve(ident1,b(n));
expr: ( ( ( b(-1/4) + b(-9/4) ) * %c
+ b(1/4) + b(-7/4)
) * x^2
+ 5 * b(-5/4) * %c
+ 3 * b(-3/4)
); /* Denominator not needed */
expr1: ratsimp(subst(subst(-9/4,n,identsub),expr));
expr2: ratsimp(subst(subst(-7/4,n,identsub),expr1));
Here is a display2d:false execution:
(C2) IDENT:b(1+n)+b(n-1) = 2*n*b(n)/(x^2/2)
(D2) b(n+1)+b(n-1) = 4*n*b(n)/x^2
(C3) ident1:SUBST(1+n,n,IDENT)
(D3) b(n+2)+b(n) = 4*(n+1)*b(n+1)/x^2
(C4) identsub:SOLVE(ident1,b(n))
(D4) [b(n) = -(b(n+2)*x^2+(-4*n-4)*b(n+1))/x^2]
(C5) EXPR:3*b((-3)/4)+5*b((-5)/4)*%C
+(b((-7)/4)+b(1/4)+(b((-9)/4)+b((-1)/4))*%C)
*x^2
(D5) ((b(-1/4)+b(-9/4))*%C+b(1/4)+b(-7/4))*x^2
+5*b(-5/4)*%C+3*b(-3/4)
(C6) expr1:RATSIMP(SUBST(SUBST((-9)/4,n,identsub),EXPR))
(D6) (b(1/4)+b(-7/4))*x^2+3*b(-3/4)
(C7) expr2:RATSIMP(SUBST(SUBST((-7)/4,n,identsub),expr1))
(D7) 0
And a display2d:true execution:
(2 n) b(n)
(C2) IDENT : b(1 + n) + b(n - 1) = ----------
2
x
--
2
4 n b(n)
(D2) b(n + 1) + b(n - 1) = --------
2
x
(C3) ident1 : SUBST(1 + n, n, IDENT)
4 (n + 1) b(n + 1)
(D3) b(n + 2) + b(n) = ------------------
2
x
(C4) identsub : SOLVE(ident1, b(n))
2
b(n + 2) x + (- 4 n - 4) b(n + 1)
(D4) [b(n) = - ----------------------------------]
2
x
- 3 - 5
(C5) EXPR : 3 b(---) + 5 b(---) %C
4 4
- 7 1 - 9 - 1 2
+ (b(---) + b(-) + (b(---) + b(---)) %C) x
4 4 4 4
1 9 1 7 2 5
(D5) ((b(- -) + b(- -)) %C + b(-) + b(- -)) x + 5 b(- -) %C
4 4 4 4 4
3
+ 3 b(- -)
4
- 9
(C6) expr1 : RATSIMP(SUBST(SUBST(---, n, identsub), EXPR))
4
1 7 2 3
(D6) (b(-) + b(- -)) x + 3 b(- -)
4 4 4
- 7
(C7) expr2 : RATSIMP(SUBST(SUBST(---, n, identsub), expr1))
4
(D7) 0