Only seven lines of code, the program runs continuously without any results when solving the equation

1 view (last 30 days)
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
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

Sign in to comment.

Accepted Answer

Walter Roberson
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)
A = 789.3325
  2 Comments
wei zeng
wei zeng on 13 May 2023
Thank you for your answer. But I want to know why the sym method can solve the problem of the large number 800?
Walter Roberson
Walter Roberson on 13 May 2023
factorial(sym(800))
ans = 
771053011335386004144639397775028360595556401816010239163410994033970851827093069367090769795539033092647861224230677444659785152639745401480184653174909762504470638274259120173309701702610875092918816846985842150593623718603861642063078834117234098513725265045402523056575658860621238870412640219629971024686826624713383660963127048195572279707711688352620259869140994901287895747290410722496106151954257267396322405556727354786893725785838732404646243357335918597747405776328924775897564519583591354080898117023132762250714057271344110948164029940588827847780442314473200479525138318208302427727803133219305210952507605948994314345449325259594876385922128494560437296428386002940601874072732488897504223793518377180605441783116649708269946061380230531018291930510748665577803014523251797790388615033756544830374909440162270182952303329091720438210637097105616258387051884030288933650309756289188364568672104084185529365727646234588306683493594765274559497543759651733699820639731702116912963247441294200297800087061725868223880865243583365623482704395893652711840735418799773763054887588219943984673401051362280384187818611005035187862707840912942753454646054674870155072495767509778534059298038364204076299048072934501046255175378323008217670731649519955699084482330798811049166276249251326544312580289357812924825898217462848297648349400838815410152872456707653654424335818651136964880049831580548028614922852377435001511377656015730959254647171290930517340367287657007606177675483830521499707873449016844402390203746633086969747680671468541687265823637922007413849118593487710272883164905548707198762911703545119701275432473548172544699118836274377270607420652133092686282081777383674487881628800801928103015832821021286322120460874941697199487758769730544922012389694504960000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
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.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!