Question
How do I implement this method in java. I will include, both the test and the api to implement. Will upvote the best answer Computes
How do I implement this method in java. I will include, both the test and the api to implement. Will upvote the best answer
Computes the standard Gaussian distribution probability density function (see * the lab document for the actual formula) with scale parameter. * * @param x * a value * @param sigma * scale parameter * @return the standard Rayleigh distribution probability density function * evaluated at x */ public static double gaussian(double x, int sigma) { }
Test Case:
public void test03_gaussian() { final double[] x = { -3.0, -1.0, 0, 1.0, 3.0}; final double[] exp = {0, 0.1468, 0.3989, 0.1468, 0 }; int sigma=1; for (int i = 0; i < x.length; i++) { String error = String.format("normal(%s) failed ", x[i]); assertEquals(error, exp[i], lab0.gaussian(x[i], sigma), 1e-1); } }
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