Hello, I want to create and simplify a symbolic fraction, but dont now how. My fraction has the following form:
I want to repeat that fraction for n times, with beeing symbolic Variables, to work with and maybe simplify the function (or similar functions).
It seems to me now, that the question I want the answer to is:
Is it possible to define and simplify a function in MATLAB which form depends on a parameter?
The function above has no fixed form, since the repetitions of depend on n, which shall be and stay a symbolic variable. In the end I would like a simplified form of . This may not be possible with the function I gave as an example here, but this is not the first time I had this problem, and I would be really glad if there is something I can do here... :)
I dont know if this is possible in MATLAB, two things would help me to find a way:
- Is there a way to have recursion in symbolic functions? I want to define something like:
syms f(n) n x
f(n) = 1/f(n-1) + x;
this does not result in an error but does also not return the solution when I substitue n with a numeric value.
- Is there a smart way to define the fraction above with n beeing not a symbolic variable? I could print my fraction n times in a string, and convert that string to a symbolic function, but that does not seem smart to me...