Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Number of bins = 1 + ceil ( log 2 ( n ) ) ( 1 ) where log 2 is log base 2 (

Number of bins =1+ ceil(log2(n))(1)
where log2 is log base 2(search google for help on how to do log of 2 in Python). As the sample
size increases so does the number of bins. The ceiling function (ceil) ensures that the result of the
logarithm is an integer. Then the width of each bin is estimated as
Bin Width =(Max - Min)-: (Number of bins)(2)
where Max and Min are respectively, the maximum and the minimum values.
Consider the following iterative process used to generate a dataset X
(+1)=()(3)
with
(+1)=()+()(())^3(4)
Your task consists of creating a python function called HW2p1_Task1_UCusername that works
as follows
To call your function, the user will type in the Python Shell, the name of the function
HW2p1_Task1_UCusername and the arguments variables a, b, and n (sample size).
UCusername is what you use to login to CANVAS.
Your function will then
o Set the initial value of X to 0.1 and the initial value of Y to 0.2.
o Compute and store the successive values of X in a list using Equations (3) and (4). This
should be done using a repetition structure (for or while loop) and Pythons append
built-in function for adding on to lists.
o Compute the number of bins based on the sample size and using the Equation (1)
o Compute the width of each bin using Equation (2)
ENED 1120 HW 2.1 Spring 20242
o Store the frequency distribution in Python as a list, i.e the number of elements of X in
each bin. Complete this step using repetition structures (for or while loop) and Pythons
append built-in function. The goal is to generate a repetition structure that will adjust
based on the number of bins, see the third hint below for more guidance.
o Print the list with the frequency distribution to Python Shell

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions

Question

Dont smell (i.e., too much perfume/cologne).

Answered: 1 week ago