I have the following questions. I have a few more on using Legendre polynomials but I will read 4.3 first before asking

a) what does selecting independently with P(x) mean? In earlier homework, we selected the points at random from [-1,1] which was clear to me - I used a random function with min = -1 and max = +1 but I am not clear what to do with P(x)

b) is clear since it is f(). Should we generate random numbers for each ? If so, what are the min and max values for the random numbers?

a) what does selecting independently with P(x) mean? In earlier homework, we selected the points at random from [-1,1] which was clear to me - I used a random function with min = -1 and max = +1 but I am not clear what to do with P(x)

In this problem P(x) is the uniform probability distribution on [-1,+1] and so what you did in the earlier homework is exactly what this means -- generate a random number between -1 and +1. In general, the way to generate may not be uniformly random over [-1,+1]. It is that specifies the input probability distribution. For example, if is the Gaussian distribution with mean 0 and variance 1, then you would generate each from that Gaussian distribution.

Quote:

b) is clear since it is f(). Should we generate random numbers for each ? If so, what are the min and max values for the random numbers?

Note . Each should be an independent Gaussian random number with mean 0 and variance 1 (you then multiply this random number by ).

Thank you for the reply! How can I generate Gaussian random numbers with mean 0 and variance 1? I am programming in C#.

This is a common task for which standard algorithms exist in most numerical packages. For example, in matlab there is a function . You can also do this using the Box-Muller transform. You may find this thread useful:

The contents of this forum are to be used ONLY by readers of the Learning From Data book by Yaser S. Abu-Mostafa, Malik Magdon-Ismail, and Hsuan-Tien Lin, and participants in the Learning From Data MOOC by Yaser S. Abu-Mostafa. No part of these contents is to be communicated or made accessible to ANY other person or entity.