MATLAB: Generate analytical solutions using MATLAB

analytical solutionsMATLABSymbolic Math Toolbox

I have a dynamic system of the form below and I am trying to find the general solution of f(n) and g(n) in terms of n and p, where n is an integer, from 1,2,…N and p is from 0 to 1.
f(n) = (f(n-1))^2*p^2/[f(n-1)*p+g(n-1)*(1-p)] + ...
(f(n-1))^2*(1-p)^2/[f(n-1)*(1-p)+g(n-1)*p]
g(n) = f(n-1)*g(n-1)*p*(1-p)/[f(n-1)*p+g(n-1)*(1-p)] + ...
f(n-1)*g(n-1)*p*(1-p)/[f(n-1)*(1-p)+g(n-1)*p]
where
f(1) = p^2+(1-p)^2
g(1) = 2*p*(1-p)
I am not able to solve it analytically myself. Would anyone have a clue on how I could do that in MATLAB?

Best Answer

What kind of answer were you hoping for? Looks like f would have to be something like the product of n-1 binomial terms raised to some integral power whose value is not immediately obvious to me.
f(10) calculated "raw" is over 100000 characters long, and simplifying it post-facto chewed right through the 2 Gb available on my system. Simplifying after each step would help a lot, at least if the polynomial representation is desired instead of a mass of nested fractions.
Related Question