Height = input(\'Enter height of liquid: \'); PI=3.142 R1=3; R2=2; volume=PI*(R1
ID: 3624349 • Letter: H
Question
Height = input('Enter height of liquid: ');
PI=3.142
R1=3;
R2=2;
volume=PI*(R1^2-R2^2)*Height;
Volume
A "yard" is a traditional English container. It is 36 inches long, and can be approximated by a 4-inch diameter glass sphere attached to a conical section whose narrow end is 1 inch in diameter, and whose wide end is 6 inches in diameter. Write a script to do the following: ask the user for the height of the liquid in the yard, and calculate the volume of liquid needed to fill the yard to that level. Now that you're comfortable with iteration, you're going to have to solve an interesting problem. It seems that the Math department at UGA once again dropped the ball, and forgot the value of pi. You are to write a function called aypi which consumes a number that specifies the required accuracy and approximates the value of pi to that accuracy. You are going to use the following algorithm based on geometric probability. Think about a quarter circle inside of a unit square (the quarter circle has area pi/4). You pick a random point inside the square. If it is in the quarter circle, you get a "hit" and if not, you get a "miss". The approximate area of the quarter circle will be given by the number of hits divided by the number of points you chose. Your function should repeat the process of counting hits and misses until at least 10,000 tries have been made, and the successive estimates of pi are within the prescribed accuracy. It should return the estimated value of pi.Explanation / Answer
% Calculation of PI Answer to Question number 7. Nrand = 10000; % input('How Many Random Numbers '); NInside = 0; for nloops=1:10000 Xrand = rand; % Generate Random XY Point Yrand = rand; Rrand = Xrand^2 + Yrand^2; % Find its distance from origin if (RrandRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.