MATLAB: Using Solve function for polynomial

factorialsolve

Hi there I want to solve an equation below but i faced a problem.
i tried to solve this with following code but it did not works:
i already have Fc and m , i tried to find nc Please Help

Best Answer

You cannot use solve to solve this because in general there is no exact solution. (And polynomials are still not involved.)
I suppose, if you want to use the extension of factorial into the real line using the special function gamma:
factorial(x) = gamma(x+1)
then you can write it as:
Fc - gamma(m+1)/(gamma(nc+1)*gamma(m-nc+1)) + nc == 0
but even here there will be no analytical solution.
syms nc
m = 5;
Fc = 8;
solve(Fc - gamma(m+1)/(gamma(nc+1)*gamma(m-nc+1))+nc,nc)
Warning: Cannot solve symbolically. Returning a numeric approximation instead.
> In solve (line 303)
ans =
2.7090797227280332212966072765956
I could have used fzero too there. Although there are many values of m for which fzero might fail due to numerical problems. Factorials get really large, really fast. But fzero will work here, using gamma:
fzero(@(nc) Fc - gamma(m+1)/(gamma(nc+1)*gamma(m-nc+1)) + nc,3)
ans =
2.70907972272803
>> fzero(@(nc) Fc - gamma(m+1)/(gamma(nc+1)*gamma(m-nc+1)) + nc,1.5)
ans =
2
It turns out, there are multiple solutions to your problem.
Related Question