0
$\begingroup$

I have been trying to solve the equation in the image below, using the code:

Solve[(Sum[(195 + 1)!/(n! (195 + 1 - n)!) (x^n) (1 - x)^(195 + 1 - n), {n, 0, 3}]) == 0.84]

enter image description here

but this returns multiple solutions, only 1 of which gives the correct answer when plugged back in the original equation (~0.010702509925484938).

I'm new to mathematica, so I'm not too sure what may be going wrong in my approach. Any help is appreciated!

$\endgroup$

1 Answer 1

1
$\begingroup$

You have a precision problem. Rationalize your constant and you will get an accurate answer:

sum = Sum[(195 + 1)!/(n! (195 + 1 - n)!) (x^n) (1 - x)^(195 + 1 - n), {n, 0, 3}]
sol=Solve[sum == 84/100, x];

This give you an answer in root objects (look it up in the help). You may get an numerical answer using "N". This answer will be correct up to n digits e.g. a 16 digit answer:

N[sum, 16]

To check if the result is correct (up to 16 digits):

N[sum /. sol, 16]
$\endgroup$
3
  • $\begingroup$ This works, thank you so much :) $\endgroup$
    – xylo
    Commented Dec 14, 2022 at 15:02
  • 1
    $\begingroup$ @HibatuNoor - And if you only want real solutions use sol = Solve[Sum[(195 + 1)!/(n! (195 + 1 - n)!) (x^n) (1 - x)^(195 + 1 - n), {n, 0, 3}] == 84/100, x, Reals] Or, if desired, restrict the domain to NonNegativeReals or PositiveReals $\endgroup$
    – Bob Hanlon
    Commented Dec 14, 2022 at 15:12
  • $\begingroup$ Can also use NSolve and get accurate results provided input is higher precision, e.g. as solbig = NSolve[sum == 0.84100, x];` $\endgroup$ Commented Dec 14, 2022 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.