Finding roots of a non linear expression when multiplied with a linear expression

Here is a simple polynomial equation:

b^2 + 2b + 1 = 0

I could easily solve this as:

import numpy as np
from scipy.optimize import fsolve

eq = lambda b : np.power(b,2) + 2*b + 1
fsolve(eq, np.linspace(0,1,2))

Similarly, I could solve any equation that has finite number of terms. But how do I solve an equation with infinite number of terms which is given as:

$G_t^{\lambda}=(1-\lambda) \sum \limits_{n=1}^{\infty} \lambda^{n-1}G_{t:t+n}$

The above equation could be written as:

(1 - l) * (5.5 + 4.0*l + 4*l^2 + 6*l^3 + 5*l^4 + 5*l^5 + 5*l^6 + 5*l^7 + 5*l^8 + 5*l^9 + 5*l^10   ) = 5

when n goes from 1 to 10. But I want to solve this for sufficiently large value of n such that LHS ~= RHS.

I know the values of LHS and G1 - Ginf but cannot understand how could I compute the value of lambda here.

I tried looking at numpy polynomial functions but could not find a function that is relevant here.

Topic matlab python

Category Data Science


I do not think this equation can be solved in general. Since it is an infinitely long polynomial, it cannot be evaluated. It can only be done if the constants $G_{t:t+n}$ followed a very specific pattern, so that the series becomes equivalent to a known function that we can evaluate. For example:

  • If $G_{t:t+n}$ were equal to $[ 1, {1\over2}!, {1\over3}!, {1\over4}!, ...]$ (where $4!$ is the factorial of $4$), then the sum would be equal to $e^\lambda$
  • If $G_{t:t+n}$ were equal to $[1, 0, {-1\over3}!, 0, {1\over5}!, ...]$ then the sum would be equal to $\sin(\lambda)$

But in general, if $G$ were any random set of constants, the function cannot be evaluated.


You may apply Wolfram Language to your project. There is a free Wolfram Engine for developers and with the Wolfram Client Library for Python you can use these functions.

If you have $G_{t:t+n}$ as a function of n and/or λ then the roots can be found if they exist. No amount of memory can store an infinite number of pre-calculated constants so some formula for $G_{t:t+n}$ must be provided.

Let

g[n_, λ_] := λ/n

An infinite Sum can be evaluated symbolically in the limit. By Assuming some conditions on λ to insure convergence. Then

Assuming[
 0 < λ < 1,
 (1 - λ) Sum[λ^(n - 1) g[n, λ], {n, 1, Infinity}]
 ]
-(1 - λ) Log[1 - λ]

If using Wolfram's notebook interface then there is the option of entering this problem in mathematical notation.

Mathematica graphics

Taking a g from @Paul without assumptions.

g[n_,λ_] := 1/n!
res = Sum[λ^(n - 1) g[n, λ], {n, 1, Infinity}]
((-1+E^λ) (1-λ))/λ

Then use Solve (or NSolve) on res for the family of solutions. Reduce is used to make finding inverse solutions easier.

Solve[Reduce[res == 5], λ]

Mathematica graphics

The family of solutions is return as a ConditionalExpression with $c_{1}$ in the set of integers.

Hope this helps.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.