Only seven lines of code, the program runs continuously without any results when solving the equation
1 view (last 30 days)
Show older comments
wei zeng
on 12 May 2023
Commented: Walter Roberson
on 13 May 2023
This is my code
syms I A
B = 0.02;%blocking probability
N = 800;%number of channels
FN = factorial(N);
ACell = solve((A^N)/FN == B*symsum(A^I/factorial(I),I,0,N),A);
A = double(ACell);
A = A(end)
6 Comments
VBBV
on 13 May 2023
The sym method did not solve your actual problem equation, Walter modified the equation by applying log on both sides and then solved it. That's simplified the problem
Walter Roberson
on 13 May 2023
The log makes it much much much faster !
Just one of those "tricks of the trade"
Accepted Answer
Walter Roberson
on 12 May 2023
syms I A
B = sym(0.02);%blocking probability
N = sym(800);%number of channels very huge
FN = factorial(N);
eqn = (A^N)/FN == B*symsum(A^I/factorial(I),I,0,N);
ACell = vpasolve(log(lhs(eqn))==log(rhs(eqn)),A);
A = double(ACell)
2 Comments
Walter Roberson
on 13 May 2023
factorial(sym(800))
When you use factorial() of a symbolic number, you can get a full precision answer up to about 999; and functions can reason about the value of factorial() of larger integers even if larger values have delayed calculation.
More Answers (0)
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!