2
$\begingroup$

Hermite Polynoms have the following recursion relation: $$ H_{n+1}(x) = 2x H_n(x) - 2n H_{n-1}(x), $$ which can be rearranged to be $$ x H_n(x) = \frac{1}{2} H_{n+1}(x) - n H_{n-1}(x).$$

Is it possible, that in an expression like $ x^3 H_n(x) $, $ x H_n(x) $ is replaced recursively until no $ x H_n(x) $ is left?

$\endgroup$
2
  • 3
    $\begingroup$ Please, get into the habit of posting copyable code. $\endgroup$ Commented Dec 12, 2018 at 8:25
  • $\begingroup$ As, for me, this is a more general question that would not esp. need this example. That is why I did not post special code. But this is probably my reduced understanding of the matter. I will give my best to do so in the future, thank you for the reminder. :) $\endgroup$ Commented Dec 12, 2018 at 9:09

2 Answers 2

2
$\begingroup$

Use ReplaceRepeated ( //. )

Format[H[n_]] := Subscript[H, n] // TraditionalForm

x^3 * H[n][x] //. 
  x^m_. * H[n_][x] :> 
   Expand[x^(m - 1) (H[n + 1][x]/2 - n*H[n - 1][x])] // Simplify

enter image description here

$\endgroup$
2
$\begingroup$

Yes, it is possible. The idea is a little different but I suppose equivalent: repeatedly replace according to the rule until x appears in the denominator.

rule = H[n_] :> 1/x (1/2 H[n + 1] - n H[n - 1]);
replace[expr_, rule_] := NestWhile[Simplify[# /. rule] &, expr, FreeQ[#, Power[x, -1]] &, 1, \[Infinity], -1]

replace[x^3 H[n], rule]
1/8 (-8 n (2 - 3 n + n^2) H[-3 + n] + 12 n^2 H[-1 + n] - 6 H[1 + n] - 6 n H[1 + n] + H[3 + n])
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.