Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is not a mathematical problem, per se, so shields down. Design this program and turn in your design artifacts prior to starting to code.
- This is not a mathematical problem, per se, so shields down.
- Design this program and turn in your design artifacts prior to starting to code.
- This program will read a list of numbers and determine if they adhere to Benford's law. We will demonstrate this by plotting the data and visually determining if it fits the pattern.
- From Wikipedia: Benford's law...is an observation that in many real-life sets of numericaldata, theleading digitis likely to be small.In sets that obey the law, the number 1 appears as the leading significant digit about 30% of the time, while 9 appears as the leading significant digit less than 5% of the time. If the digits were distributed uniformly, they would each occur about 11.1% of the time.
- You will write a program to do the following:
- Read a list of data from a data file specified by the user. The first line of the data file is the header to put on the graph, the remining lines are the data items. Sample data files are provided in the Programming assignment module. Not all data adheres to Benford's Law.
- Count the number of data items from the file that have a first digit of '1', then '2', up to '9'. For example, if the number from the file was "3871", it would be counted as a '3' because the first digit is a '3'.
- Output the data header, followed by a plot showing the number of data items in each category '1' - '9'.
- The graph below shows the expected pattern of data that adheres to Benford's Law. You will be plotting it horizontally, so it will look something like this:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started