2

If I have a linear recurrence relation

$$Q_{n+1}(X) = \int_0^X Q_n (x) e^{k (X-x)} \ \mathrm{d} x,$$

knowing $Q_0(x)=e^{kx}$ and $k$ is a constant. It is easy to show the general form of the solution is

$$Q_n(x) = e^{kx} \sum_{i=0}^n \alpha_{i,n} x^i,$$

and we can establish a recurrence relation for the coefficients $\alpha_{i,n}$.

The aim is to write a code in Wolfram Language that can find the recurrence relation for the coefficients $\alpha_{i, n}$ in this scenario, and in slightly more general scenarios (linear recurrence relation involving a single integral and similar solution form).

With ReplaceAll and properly defined Rules, I am able to insert the general solution form into the original recurrence relation, but I am unable to simplify further. For instance, Mathematica doesn't pull the sum out of the integral in the RHS.

Update 1

The coefficients $\alpha_{i,n}$ should also have an $n$ index.

Update 2

Indeed we know how to solve this recurrence equation explicitly but that is not the goal here. For human beings, it is rather simple to insert the general form of the solution, then exchange the sum and the integral in the RHS, also pulling out the coefficients $\alpha_{i,n}$ of the integral as they have no $x$ dependence. What I want to achieve is to write a code in Wolfram Language that does it in the way human beings would do.

Domen
  • 23,608
  • 1
  • 27
  • 45
  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Feb 17 '24 at 04:26
  • May the bot @Community specify what sort of details are missing? – Nathanaël DENG Feb 17 '24 at 08:53
  • How did you show the general form of the solution Q[n,x]? – Ulrich Neumann Feb 17 '24 at 14:35
  • @UlrichNeumann 1. $Q_0(x)=e^{kx}$ satisfies the form 2. Insert the expression in the RHS, you can pull out the $e^{kX}$ factor then you have a polynomial of degree (at most) $n$ to integrate so you obtain a polynomial of degree (at most) $n+1$ hence the form. – Nathanaël DENG Feb 17 '24 at 14:53
  • @NathanaëlDENG Thanks. That's what NestList does in my answer. But it doesn't give the sum-formula you're expecting I think! – Ulrich Neumann Feb 17 '24 at 14:56
  • @UlrichNeumann Well it is. We just have $\alpha_{i,n} = \delta_{i,n} / (n !)$. – Nathanaël DENG Feb 17 '24 at 14:59
  • Finally I found a similar question here https://mathematica.stackexchange.com/questions/262425/how-to-integrate-a-symbolic-sum. linearExpand worths a try methinks. – Nathanaël DENG Feb 17 '24 at 15:07

2 Answers2

1

Try NestList

sol = NestList[
Function[X,Evaluate@Integrate[ # [x] Exp[k (X - x)  ], {x, 0, X}]] &    , 
Exp[k #] &, 5];

Qn=Through[sol[X]] ({E^(k X), E^(k X) X, 1/2 E^(k X) X^2, 1/6 E^(k X) X^3,1/24 E^(k X) X^4,1/120 E^(k X) X^5})

It looks like your expectation might be wrong. Mathematica evaluates instead

Q[n][X]=Exp[k X] X^n/n!

This result might be confirmed with (Thanks @Mariusz Iwaniuk)

FindSequenceFunction[Qn, n] // FunctionExpand 
Ulrich Neumann
  • 53,729
  • 2
  • 23
  • 55
  • Well, I agree with the results you got. It also reminded me that I forgot to add the index $n$ to the coefficients. Nevertheless, what I want to achieve is really a code returning the recurrence relation for the coefficients of known solution form. – Nathanaël DENG Feb 17 '24 at 09:27
  • Your integralequation is the recurrence equation for Q, my answer gives the explicit solution. – Ulrich Neumann Feb 17 '24 at 09:29
  • ... alfa[i,n]=1/n! DiscreteDelta[i,n] – Ulrich Neumann Feb 17 '24 at 09:36
  • Indeed you gave the explicit solution. Thank you for that. Then I thought I made it clear in the description that I would love to write a code that gives the recurrence relation for the $\alpha_{i,n}$s. It is really a problem of expression simplification as far as I can see, and that is why this tag was added.

    Surely one can deduce the formulae in your comment once they have the explicit result. But this is human input and this is not what I am looking for.

    – Nathanaël DENG Feb 17 '24 at 09:36
  • FindSequenceFunction[Qn, n] // FunctionExpand gives: (E^(k X) X^(-1 + n))/Gamma[n]. – Mariusz Iwaniuk Feb 17 '24 at 11:50
1

Regarding the integral equation

$$ Q_{n+1}(X) = \int_0^X Q_n (x) e^{k (X-x)} \ \mathrm{d} x, $$

it can be written as

$$ Q_{n+1}(x) = Q_n(x)\circledast e^{kdx} $$

and taking the Laplace transform we have

$$ Q_{n+1}(s)=\frac{1}{s+k}Q_{n}(s) $$

now considering that $Q_0(s) = \frac{1}{s+k}$ we have

$$ Q_n(s) = \left(\frac{1}{s+k}\right)^{n+1} $$

with anti-transform

$$ Q_n(x) = \frac{e^{-k x} x^n}{\Gamma (n+1)} $$

Follow two scripts which produce the same results

Clear[Q]
InverseLaplaceTransform[Q[n] /. RSolve[{Q[n + 1] == Q[n]/(s + k), Q[0] == 1/(s + k)}, Q, n][[1]], s, x]

and

Clear[Q]
n = 10;
Q = Exp[k x];
QQ = {Q};
For[i = 1, i <= n, i++,
 Q = Integrate[Q Exp[k (u - x)], {x, 0, u}] /. {u -> x};
 AppendTo[QQ, Q]
 ]

QQ

Cesareo
  • 3,963
  • 7
  • 11
  • I totally agree with what you do, if the aim is to actually solve the recurrence relation. However, as I mentioned in the question description, the aim is really to find the recurrence relation for the coefficients $\alpha_{i,n}$. That is why the tag "simplifying-expressions" was added. – Nathanaël DENG Feb 17 '24 at 09:31
  • As can be depicted in the general answer, $\alpha_{n,n}=\frac{1}{n!}$ – Cesareo Feb 17 '24 at 09:39
  • Agreed and thank you for pointing that out. The goal was actually to write a code so that Mathematica can achieve what I, as human being, can manipulate. I will update the description so this is even more explicit. – Nathanaël DENG Feb 17 '24 at 09:44