Create a plot of $\sin(2x)$ and $\sin(x)$ from $0$ to $2\pi$ with the following properties:
Make sure you have downloaded the Excel spreadsheet for this week's homework and it is the same folder as this worksheet. The data in the spreadsheet is from a 4-plate hydrogen fuel cell. The cell below loads the data. Run the cell and then write your own python code in subsequent cells.
for
loop, calculate the sample mean of Power of the fuel cell.mean
function, calculate the sample mean of the Power of the fuel cell.for
loop to calculate the standard deviation of the Power of the fuel cell.var
function, calculate the standard deviation of the Power of the fuel cell.
In [2]:
%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn
seaborn.set_context("poster")
#load the fuel cell data
fuel_data = pd.read_excel('fuel_cell.xlsx')
#show the columns
for i in fuel_data.columns:
print '\'{}\''.format(i)
In [4]:
#This is how you access data
print fuel_data['Time']
Write what quantity the question asks for symbolically, write the equation you need to compute symbolically (if necessary) and compute your answer in Python.
You accidentally open youtube while doing your homework. After watching one video, you find another interesting video you must watch with probability 75%. What is the probability you return to your homework after 1 video?
What is the probability you return to your homework after exactly 5 videos?
What is the expected number of videos you will watch? You may use any method to compute this.
Answer the following problems in Python
for
loop, sum the squared integers and break
if your sum is greater than 1000. Print the integer which causes your sum to exceed 1000.for
loop. It should be 1 out to many decimal places.for
loop from 4.3 and print the number of videos when the sum is greater 0.95. What does that represent?for
loop into while
loop, so that you do not need to guess how big your array will need to be and turn it into a function. Your function should take two arguments: the probability of success and the confidence level (default 5%) for a geometric distribution. It should return a number of trials for which there is $>=$ 95% probability of success before reaching that trial number. Hint: Test your function with problem 4.4Write what quantity the question asks for symbolically, write the equation you need to compute symbolically and compute your answer in Python.
The probability that you go on a second date is 10%. If you go on 8 first dates this weekend, what's the probability you'll have 3 second dates next weekend? State the distribution, its parameters and the question being asked symbolically and answer the problem in Python.
What is the probability of having more than 3 second dates for next weekend? State the question being asked symbolically and answer the problem in Python. Hint: consider using the np.sum
function to make it easy, but to answer 6.4 you might want to try it with a for loop.
To better understand your dating agenda, make a plot of the probability of the number of second dates. It should span the entire sample space.
Caclulate the expected number of second dates with the parameters above using a for
loop. Do not just use the expected value equation for the binomial distribution.
In [ ]: