Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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!

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions