Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use python E4.3 Programming: Sampling algorithms (40 points) Consider the unit square [0, 1]2 in the plane. Pick and arbitrary k and do:, for number

Use python

image text in transcribed

E4.3 Programming: Sampling algorithms (40 points) Consider the unit square [0, 1]2 in the plane. Pick and arbitrary k and do:, for number of samples, write formulas for the coordinates of (i) (5 points) write formulas for the n k sample points in the uniform Sukharev center grid, (ii) (5 points) write formulas for the nmple points in the uniform corner grid, where sample points are placed at the corners of each squarelet (instead of at centers), (ii) write the following programs (representing a grid with n entries in 0, 1 by an array with n rows and 2 columns): computeGridSukharev (10 points) Input: the number of samples n (assuming n for some number k) Output: the uniform Sukharev center grid on [0, 1]2 with lVn samples along each axis. computeGridRandom (10 points Input: the number of samples T Output: a random grid on 0, 1]2 with n uniformly generated samples computeGridHalton 10 points) Input: the number of samples Ti, two prime numbers b and b2 Output: a Halton sequence of n samples inside [0, 1]2 generated by the two prime numbers bi and b2 For each function, do the following: (i) explain how to implement the function, possibly deving analytic formulas, and characterize special cases, (ii) program the function, including correctness checks on the input data and appropriate error messages, and (ii) verify your function is correct by plotting the three grids for r 100. 3. E4.3 from the Lecture Notes on Robotics Planning and Kinematics Programming guidelines: The name of your python file should be python program.py with the first line in the file having your PID as a comment, Ex: # A432443 The function names must be adhered to as mentioned in the problem. All the assumptions mentioned in the proble such as for a Sukharev grid and the two prie mbers for a Halton series will be accounted for when testing the code i.e. you w not have to check for prime numbers or perfect squares for your inputs. Example: X, Y comput eGridSukharev(n) X, Y comput eGrdSukharev (4) X 0.25, 0.25, 0.75,0.75] Y = [0.25, 0.75, 0.25, 0.75] The points are (Xi,Yi]) : (0.25,0.25), (0.25,0.75), (0.75,0.25), (0.75, 0.75) Similarly X, Y = computeGridRandom(n) X, Y = comput eGridRandom(4) X, Y-computeCridHalton(n, bl , b2) X, Y = comput eGridHalton(4, 2, 3) The order of the noints in the list X and Y do not matter Note: For this assignment you will be evaluated by plotting the sampled points in a unit square as shown below. For you to plot in python you can use a library called matplotlib. The plotting functions in this library is very similar to MATLAB. Ensure to set a limit for the x an y axis from 0 to 1 Example: import matplotlib.pyplot as plt plt.scatter(X, Y, color'r', marker-'o) plt.title ("Sukharev Grid") plt.xlim((0,1)) plt.yln( (0,1)) plt.showC)

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

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions

Question

When can a research project be deemed researchable?

Answered: 1 week ago

Question

What are the attributes of a technical decision?

Answered: 1 week ago

Question

How do the two components of this theory work together?

Answered: 1 week ago