10.1 PARTICIPATION: Function plotter This PARTICIPATION zyLab should be treated like a reading chapter in the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
10.1 PARTICIPATION: Function plotter This "PARTICIPATION" zyLab should be treated like a reading chapter in the other parts of the zyBook. Solutions are available to you. You are supposed to look at solutions. You should try to solve the zyLab by yourself but when you have tried, look at the solution and you can copy and paste the solutions you get the points for reading the existing code and learning from it. You are not cheating when you copy and paste the solution that is shown to you into your submission. I expect you to get all points on the PARTICIPATION zyLabs. In this lesson you will plot a function, namely a Gaussian (or "bell curve"). Make use of numpy and matplotlib. All plotting starts with importing the pyplot functionality of matplotlib: import matplotlib.pyplot as plt and import numpy with import numpy as np Gaussian Plot the Gaussian "bell curve" with mean 0 and standard deviation 1 1 2 g(x) = over the range - 5 x 5 with 101 regularly spaced intervals. In the file gaussian.py, write code that does the following: (-/1/2) exp 1. define a function gaussian (x) that computes the Gaussian function. (Hint: use the numpy, module, which contains numpy.pi, numpy.sqrt, and numpy.exp) 2. generate the x values X (using numpy.linspace(.)) 3. generate the y values Y (If you write your gaussian () function with numpy functions then it should work as a "ufunc" so you should be able to do Y = gaussian (X)) 4. plot with plt.plot (X, Y) (see plot()). 4. plot with plt.plot(X, Y) (see plot()). 5. add labels to the axes: "x" to the x-axis and "y" to the y-axis: plt.xlabel ("x") plt.xlabel ("y") 6. save the figure in PNG format to file gaussian.png with plt.savefig ("gaussian.png") In Develop Mode you will be able to see the image that you produced. You can change the color and the style, as shown in the previous module. The resulting image should be similar to the following: 0.40 0.35 0.30 0.25 0.20 0.15 0.10 0.05 0.00 -4 -2 0 X 0.10 0.05 0.00 459736.2734824.qx3zqy7 LAB ACTIVITY if 10.1.1: PARTICIPATION: Function plotter #gaussian.py --- 2 gaussian.py "bell curve" with mean 0 and standard deviation 1 import matplotlib.pyplot as plt import numpy as np # add your function definition for gaussian (x) here name == "____main___": #add your plotting code here 0/10 Load default template... 10.1 PARTICIPATION: Function plotter This "PARTICIPATION" zyLab should be treated like a reading chapter in the other parts of the zyBook. Solutions are available to you. You are supposed to look at solutions. You should try to solve the zyLab by yourself but when you have tried, look at the solution and you can copy and paste the solutions you get the points for reading the existing code and learning from it. You are not cheating when you copy and paste the solution that is shown to you into your submission. I expect you to get all points on the PARTICIPATION zyLabs. In this lesson you will plot a function, namely a Gaussian (or "bell curve"). Make use of numpy and matplotlib. All plotting starts with importing the pyplot functionality of matplotlib: import matplotlib.pyplot as plt and import numpy with import numpy as np Gaussian Plot the Gaussian "bell curve" with mean 0 and standard deviation 1 1 2 g(x) = over the range - 5 x 5 with 101 regularly spaced intervals. In the file gaussian.py, write code that does the following: (-/1/2) exp 1. define a function gaussian (x) that computes the Gaussian function. (Hint: use the numpy, module, which contains numpy.pi, numpy.sqrt, and numpy.exp) 2. generate the x values X (using numpy.linspace(.)) 3. generate the y values Y (If you write your gaussian () function with numpy functions then it should work as a "ufunc" so you should be able to do Y = gaussian (X)) 4. plot with plt.plot (X, Y) (see plot()). 4. plot with plt.plot(X, Y) (see plot()). 5. add labels to the axes: "x" to the x-axis and "y" to the y-axis: plt.xlabel ("x") plt.xlabel ("y") 6. save the figure in PNG format to file gaussian.png with plt.savefig ("gaussian.png") In Develop Mode you will be able to see the image that you produced. You can change the color and the style, as shown in the previous module. The resulting image should be similar to the following: 0.40 0.35 0.30 0.25 0.20 0.15 0.10 0.05 0.00 -4 -2 0 X 0.10 0.05 0.00 459736.2734824.qx3zqy7 LAB ACTIVITY if 10.1.1: PARTICIPATION: Function plotter #gaussian.py --- 2 gaussian.py "bell curve" with mean 0 and standard deviation 1 import matplotlib.pyplot as plt import numpy as np # add your function definition for gaussian (x) here name == "____main___": #add your plotting code here 0/10 Load default template...
Expert Answer:
Related Book For
Contemporary Financial Management
ISBN: 9780324289114
10th Edition
Authors: James R Mcguigan, R Charles Moyer, William J Kretlow
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Portray in words what transforms you would have to make to your execution to some degree (a) to accomplish this and remark on the benefits and detriments of this thought.You are approached to compose...
-
What is the equal payment series for 12 years that is equivalent to a payment series of $25,000 at the end of the first year, decreasing by $1,200 each year over 12 years? Interest is 7% compounded...
-
Husky Energy Inc. is one of Canada's largest integrated energy companies. It is headquartered in Calgary, Alberta, and its shares are traded on the Toronto Stock Exchange under the symbols HSE. Husky...
-
Marks and Spencer (M&S) is a British company that sells clothing, home and furniture items, home electronics, food, and other items from retail stores and over the Internet. The cost of Internet...
-
How is the concept of encapsulation applied to database management?
-
What if you conducted a PAQ analysis that indicated that the Wonderlic was a valid test for this job? Do you believe that this result establishes the legality of the Wonderlic? Given that the...
-
What is the duration (in years) of an 8% 2yr bond, with semi-annually compounded interest and a ytm of 10%? What is the modified duration (in payment periods) of an 8% 2yr bond with semi-annual...
-
Describe the three most well-known types of ethical decision making and the four dilemmas that each engender. Why do these matter to the leader in his or her own ethical perspectives?
-
In the replica-plating experiments of the Lederbergs, bacterial colonies appeared at the same locations on each of two secondary plates because a. T1 phage caused the mutations to happen. b. the...
-
Which of the following DNA repair systems may involve the removal of a segment of a DNA strand? a. Base excision repair b. Nucleotide excision repair c. Mismatch repair d. All of the above
-
Which of the following may be used as a vector in a gene-cloning experiment? a. mRNA b. Plasmid c. Virus d. Either b or c
-
In an EMSA, the binding of a protein to DNA a. prevents the DNA from being digested with a restriction enzyme. b. causes the DNA to migrate more slowly through a gel. c. causes the DNA to migrate...
-
The Oviedo Company is considering the purchase of a new machine to replace an obsolete one. The machine being used for the operation has a book value and a market value of zero. However, the machine...
-
Compare two different forms of government What do they have in common How are they different You should write one paragraph showing what they have in common, and one paragraph showing how they are...
-
In Exercises 516, find the focus and directrix of the parabola with the given equation. Then graph the parabola. y 2 = 4x
-
In the context of the constant growth dividend valuation model, explain what is meant by a. Dividend yield b. Price appreciation yield
-
Is it possible for a firm to have a high degree of combined leverage and a low level of total risk? Explain.
-
Clovis Industries had sales in 2006 of $40 million, 20 percent of which were cash. If Clovis normally carries 45 days of credit sales in accounts receivable, what are its average accounts receivable...
-
You are the product manager of Lexcon Fitness and are considering the production of new elliptical trainers. You feel you can sell 5,500 of these per year for 6 years (after which time this project...
-
At present, Global Skateboards Limited is considering expanding its product line to include solar powered skateboards; however, it is questionable how well they will be received by skateboarders....
-
Decathlon Stores is expanding operations with the introduction of a new distribution center. Not only will sales increase but investment in inventory will decline due to increased efficiencies in...
Study smarter with the SolutionInn App