Question: Plz provide with python code! thanks! Q3. Binomial coefficients (20 points) The binomial coefficient (nk) is an integer equal to PHY3115 Introduction to Computational Physics

Plz provide with python code! thanks!

Plz provide with python code! thanks! Q3. Binomial coefficients (20 points) The

Q3. Binomial coefficients (20 points) The binomial coefficient (nk) is an integer equal to PHY3115 Introduction to Computational Physics 2022/23 Semester B (nk)=k!(nk)!n!=12kn(n1)(n2)(nk+1) where k1, or (n0)=1 when k=0. It tells us the number of ways to choose k objects from a set of n objects when the order is not important. It appears very often in statistical physics. (a) Using this form for the binomial coefficient, write a Python user-defined function that calculates the binomial coefficient for given n and k. Make sure your function returns the answer in the form of an integer and gives the correct value of 1 for the case where k=0. (b) Using your function in (a) write a program to print out the first 20 lines of "Pascal's triangle." The Pascal's triangle is a triangular array of the binomial coefficients. The nth line of the Pascal's triangle contains n+1 numbers, which are coefficients (n0),(n1),(n2), and so on up to (nn). The first few lines of the Pascal's triangle are shown below. 11121133114641 (c) The probability that an unbiased coin, tossed n times, will come up heads k times is given by (nk)/2n. Write a program to calculate (i) the probability that a coin tossed 100 times comes up heads exactly 70 times, and (ii) the probability that it comes up heads 70 or more times

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!