1. Homepage
  2. Programming
  3. Monte Carlo Integrator and Simpsons Integrator

Monte Carlo Integrator and Simpsons Integrator

Engage in a Conversation
JavaMonte Carlo IntegratorSimpsons Integrator

Classes

You may use the classes providing random number generators that will be or were developed during the lecture, e.g., • RandomNumberGeneratorFrom1D • MersenneTwister CourseNana.COM

Task

The exercise consists of two separate tasks. CourseNana.COM

Task 1: A MonteCarloIntegrator

To complete your task: CourseNana.COM

i. Implement a class implementing the interface Integrator that performs a general Monte -Carlo integration of arbitrary functions on general domains. The function to integrate will be provided to the integrator's method integrate as an object implementing the interface Integrand . The integration domain will be provided to the integrator's method integrate as an object implementing the interface IntegrationDomain . CourseNana.COM

ii. Implement a class implementing the interface MonteCarloIntegratorFactory that allows creating an o bject of the class that you have implemented in 1). Note: the MonteCarloIntegratorFactory simply calls the constructor of your class. CourseNana.COM

ii. To allow us to test you implementation, complete the implementation of the method getMonteCarloIntegratorFactory of MonteCarloIntegrationAssign mentSolution . This allows the creation of an object of your MonteCarloIntegratorFactory . Our unit tests will use this to test your code. CourseNana.COM

ii. Feel free to create your own UnitTests and JavaDoc documentation. Suggestion: you may test your integrator with different random number generators, e.g. MersenneTwister via final long seed = 3141; RandomNumberGenerator randomNumberGenerator = new RandomNumberGeneratorFrom1D(new MersenneTwister(seed), domain.getDimension( )); or a HaltonSequence . CourseNana.COM

Task 2: Using your MonteCarloIntegrator to calculate the integral of a DoubleBinaryFunction

v. Complete the method getIntegral of MonteCarloIntegrationAssignmentSolution . Use your Monte -Carlo integrator with approximately 1 million sample points to calculate the integral. CourseNana.COM

Tasks 3: Implement a SimpsonsIntegrator for the general Simpson's rule in d dimension

To complete your task: CourseNana.COM

vi. Implement a class implementing the interface Integrator that performs a general (composite) Simpson's rule integration in d dimension of arbitrary functions on general domains. The function to integrate will be provided to the integrator's method integrate as an object implementing the interface Integrand . The integration doma in will be provided to the integrator's method integrate as an object implementing the interface IntegrationDomain . vii. Implement a class implementing the interface IntegratorFactory that allows creating an object of the class that you have implemented in 1). Note: the IntegratorFactory simply calls the constructor of your class. vii. To allow us to test you implementation, complete the implementation of the method getSimpsonsIntegratorFactory of MonteCarloIntegrationAssignme nt. This allows the creation of an object of your IntegratorFactory . Our unit tests will use this to test your code. vii. Feel free to create your own UnitTests and JavaDoc documentation. CourseNana.COM

Hints

• Note that your Simpsons integral and your Monte -Carlo integral only operator on [0,1]^d (the object i mplementing the Domain will provide you with the transformation). • Your Simpsons integrator should accept the numberOfValuationPoints as an argument. This should be the minimum total number of valuation points . Since the Simpsons rule uses an odd number of points in every dimension, you may use the following code to round this number appropriately to numberOfSamplePointsEffective , using numberOfSamplePointsPerDimension per dimension. • int dimension = integrationDomain.getDimension(); • int numberOfV aluationPointsPerDimension = 2 * (int) (Math.ceil(Math.pow(numberOfValuationPoints, 1.0/dimension))/2) + 1; • int numberOfValuationPointsEffective = (int) Math.pow(numberOfValuationPointsPerDimension, dimension) • You might realise that you need to think a bit to find a short algorithm to implement the Simpsons integration in arbitrary dimensions. It is possible to create a fairly short implementation if you implement a multi -index index - an array of length dimension where each ent ry runs from 0 to numberOfSamplePointsPerDimension -1. CourseNana.COM

Unit Tests

We encourage you to write your own unit tests. CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Java代写,Monte Carlo Integrator代写,Simpsons Integrator代写,Java代编,Monte Carlo Integrator代编,Simpsons Integrator代编,Java代考,Monte Carlo Integrator代考,Simpsons Integrator代考,Javahelp,Monte Carlo Integratorhelp,Simpsons Integratorhelp,Java作业代写,Monte Carlo Integrator作业代写,Simpsons Integrator作业代写,Java编程代写,Monte Carlo Integrator编程代写,Simpsons Integrator编程代写,Javaprogramming help,Monte Carlo Integratorprogramming help,Simpsons Integratorprogramming help,Javaassignment help,Monte Carlo Integratorassignment help,Simpsons Integratorassignment help,Javasolution,Monte Carlo Integratorsolution,Simpsons Integratorsolution,