代做 numerical-methods-montecarlointeg、R编程设计代做
numerical-methods-montecarlointegrati
on-exercise
In this exercise, you should implement classes that provide a reasonably flexible framework for Monte-Carlo integration.
The framework should be flexible enough to allow
• integration of different functions f : Rn → R
• flexible specification of the integration domains using a transformation from
[0,1]n to a subset of Rn
• flexible use for different random number generators
For convenience, we provide the interfaces that define the framework. You can find these interfaces in the package
info.quantlab.numericalmethods.lecture.montecarlo.integration
Interfaces (provided)
• Integrand
• IntegrationDomain
• Integrator
• MonteCarloIntegratorFactory
The MonteCarloIntegratorFactory's method requires a class implementing
a RandomNumberGenerator. This interface and some classes implementing this interface can
be found in the package
info.quantlab.numericalmethods.lecture.randomnumbers
Integrand and IntegrationDomain
• Objects implementing Integrand provide a function f : A
ightarrow R defined on a domain A.
• Objects implementing IntegrationDomain provide a bijective function g : [0,1]^{n}
ightarrow A that transforms the integration domain and the determinant of the derivative (Jacobi matrix) dg/dx.
• Objects implementing Integrator provide the integral int_A f(z) dz using substitution z = f(x).
Classes
You may use the classes providing random number generators that will be or were developed during the lecture, e.g.,
• RandomNumberGeneratorFrom1D • MersenneTwister
Task
The exercise consists of two separate tasks.
Task 1: A MonteCarloIntegrator
To complete your task:
•
•
•
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.
ii. Implement a class implementing the interface MonteCarloIntegratorFactory that allows creating an object of the class that you have implemented in 1). Note: the MonteCarloIntegratorFactory simply calls the constructor of your class.
ii. To allow us to test you implementation, complete the implementation of the
method getMonteCarloIntegratorFactory of MonteCarloIntegrationAssignmentSolutio
n. This allows the creation of an object of your MonteCarloIntegratorFactory. Our unit tests will use this to test your code.
•
ii. Feel free to create your own UnitTests and JavaDoc documentation.
final long seed = 3141;
RandomNumberGenerator randomNumberGenerator = new RandomNumberGeneratorFrom1D(new MersenneTwister(seed), domain.getDimension());
Suggestion: you may test your integrator with different random number generators, e.g. MersenneTwister via
or a HaltonSequence.
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.
Tasks 3: Implement a SimpsonsIntegrator for the general Simpson's rule in d dimension
To complete your task:
•
•
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 domain 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.
•
•
Hints
vii. To allow us to test you implementation, complete the implementation of the
method getSimpsonsIntegratorFactory of MonteCarloIntegrationAssignment. 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.
• Note that your Simpsons integral and your Monte-Carlo integral only operator on [0,1]^d (the object implementing 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 numberOfValuationPointsPerDimension = 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 entry runs from 0 to numberOfSamplePointsPerDimension-1.
Unit Tests
We encourage you to write your own unit tests.
Further Research
This project offers the opportunity to explore Monte-Carlo integration in more detail for those interested. Here are a few suggestions:
• Explore the dependency on the dimension: Consider the integration of x → product(i=0,...,d-1) sin(xi) for 0 < xi < π. The value of the integral is 2^d. This is an d-dimensional integral. For this function, compare the accuracy of Monte-Carlo integration and Simpsons integration with d = 1, 2, 4, 8 using for example n =
5^8 = 390625 sample points.
• Explore the dependency on the smoothness of the function: Consider the integration of (x0,x1) → x02 + x12 < 1.0 ? 1.0 : 0.0 for 0 < xi < 1. The analytic value of this integral π. For this function, compare the accuracy of Monte-Carlo integration and Simpsons integration using n = 101^2 = 10201 sample points.
请加QQ:99515681 邮箱:99515681@qq.com WX:codinghelp
- 在国际市场上 WhatsApp拉群营销工具 是你事业成功的国际通行证
- 代写ENG3015、R编程设计代做
- Instagram自动吸粉引流神器,Ins全新营销工具现已推出!
- iOS首次出现木马病毒 苹果“安全”神话破灭?!
- 新点软件荣获上海市大数据中心2023年度软件开发优秀服务商奖
- 业务推手:成功博主分享,WhatsApp如何简化流程,轻轻松松提升效果!
- WhatsApp价格优势协议号,ws群发协议号特点/ws混合号购买指导
- 代写COMP7250、Python语言编程代做
- Instagram群发助手 - ins采集软件/ig采集助手/ins定位采集
- Instagram营销软件,ins如何采集粉丝/博主进行私信群发
- Telegram超好用的批量群发营销软件,电报群发工具推荐
- 营销新时代,选择 WhatsApp群发协议号轻松推广!让您的品牌消息脱颖而出!
- 助力独立站掘金韩国市场,光子易PhotonPay上线KakaoPay电子钱包收单服务
- 在国际市场 没有WhatsApp拉群工具 就像是无剑之侠 这是每位海外营销专家的绝对利器
- 同有科技全新一代自主可控全闪分布式存储震撼发布
- WhatsApp群发工具,ws协议号特价信息/ws频道号购买途径
- Telegram/TG群发拉群自动化软件,电报/TG精准营销软件,TG/纸飞机全自动注册
- 确立两大厨电解决方案,华帝发布多款创新性“三好”新品
- Ins引流新高度!Instagram自动聊天软件,多功能群发器震撼上线
- 磁化水器:引领健康饮水新风尚
- Instagram怎么自动群发私信,ins群发引流教学/测试联系大轩
- 刷爆朋友圈,AlphaGPT在法律ai圈子火了,案件仅需3分钟搞定
- 一根针穿起基层治理千条线,万科物业首次公开管家服务标准
- AI应用启示录:资本为何钟情药物研发?
- 电报拉群神器!Telegram营销软件助你实现社交爆发!
- WhatsApp协议号购买攻略,ws协议号详解/ws劫持号优势/ws频道号应用
- 趋势先锋WhatsApp工具让你在商务领域中轻松抓住每个潮流机会
- 科技感官奇兵,WhatsApp拉群工具
- EG25H4代做、代写Python/c++程序
- Instagram营销软件 - ins私信博主/ig批量养号/ins自动登录
推荐
- 丰田章男称未来依然需要内燃机 已经启动电动机新项目 尽管电动车在全球范围内持续崛起,但丰田章男 科技
- 升级的脉脉,正在以招聘业务铺开商业化版图 长久以来,求职信息流不对称、单向的信息传递 科技
- 老杨第一次再度抓握住一瓶水,他由此产生了新的憧憬 瘫痪十四年后,老杨第一次再度抓握住一瓶水,他 科技
- B站更新决策机构名单:共有 29 名掌权管理者,包括陈睿、徐逸、李旎、樊欣等人 1 月 15 日消息,据界面新闻,B站上周发布内部 科技
- 智慧驱动 共创未来| 东芝硬盘创新数据存储技术 为期三天的第五届中国(昆明)南亚社会公共安 科技
- 创意驱动增长,Adobe护城河够深吗? Adobe通过其Creative Cloud订阅捆绑包具有 科技
- 苹果罕见大降价,华为的压力给到了? 1、苹果官网罕见大降价冲上热搜。原因是苹 科技
- 如何经营一家好企业,需要具备什么要素特点 我们大多数人刚开始创办一家企业都遇到经营 科技
- 疫情期间 这个品牌实现了疯狂扩张 记得第一次喝瑞幸,还是2017年底去北京出差的 科技
- 全力打造中国“创业之都”名片,第十届中国创业者大会将在郑州召开 北京创业科创科技中心主办的第十届中国创业 科技