- Cuchulainn
**Posts:**60518**Joined:****Location:**Amsterdam-
**Contact:**

Quote double min_ = System.Convert.ToDouble( (*m_nativeClass).min() ); double max_ = System.Convert.ToDouble( (*m_nativeClass).max() );This means your png class needs min() and max()? ??

Last edited by Cuchulainn on December 14th, 2013, 11:00 pm, edited 1 time in total.

http://www.datasimfinancial.com

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

- Cuchulainn
**Posts:**60518**Joined:****Location:**Amsterdam-
**Contact:**

1. I am getting very small rns e-209 etc. when I call C+ from C#. I added Min() and Max() to prng and cal them from C# i.e.(BTW what's the range of values [L,U] of rng()) C++ // new djd //double min() conflict with your result_type!!! double Min() { return std::numeric_limits<double>::min(); } double Max() const { return std::numeric_limits<double>::max(); }C# I // [0,1)double NextDouble(){ double min_ = (*m_nativeClass).Min() ; double max_ = (*m_nativeClass).Max() ; double rng_ = (*m_nativeClass)(); return (rng_ - min_) / (max_ - min_ + 1);}C#, IIpublic class PolarMarsaglia<T> : Rng<T>{ private SitmoWrapper.ManagedWrapper rand; public PolarMarsaglia() { rand = new SitmoWrapper.ManagedWrapper(); } // Seed is from system clock public override T GenerateRn() { dynamic u, v, S; do { u = 2.0 * rand.NextDouble() - 1.0; v = 2.0 * rand.NextDouble() - 1.0; Console.Write(", {0}", rand.NextDouble()); S = u * u + v * v; } while (S >= 1.0); dynamic fac = Math.Sqrt(-2.0 * Math.Log(S) / S); return (T)(u * fac); }}

Last edited by Cuchulainn on December 14th, 2013, 11:00 pm, edited 1 time in total.

http://www.datasimfinancial.com

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

- Cuchulainn
**Posts:**60518**Joined:****Location:**Amsterdam-
**Contact:**

Gotcha! Your C# pseudocode confused me min() --> minAnyways; 1st MC test Pexact = 5.84585NT = 500, NSim = 10^6SitmoBoxMuller = 5.847601.NET BoxMuller = NaNCongrats!Keep tuned!

Last edited by Cuchulainn on December 14th, 2013, 11:00 pm, edited 1 time in total.

http://www.datasimfinancial.com

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

- Cuchulainn
**Posts:**60518**Joined:****Location:**Amsterdam-
**Contact:**

Edited: error

Last edited by Cuchulainn on December 16th, 2013, 11:00 pm, edited 1 time in total.

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

- Cuchulainn
**Posts:**60518**Joined:****Location:**Amsterdam-
**Contact:**

QuoteI must say I think the first result is a bit strange? How come different fdm methods don't give different results? I think1. the methods are close in accuracy anyways2. large NT, NSI can take NT = 100 and then see ....

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

- Cuchulainn
**Posts:**60518**Joined:****Location:**Amsterdam-
**Contact:**

QuoteOriginally posted by: outrunQuoteOriginally posted by: CuchulainnQuoteI must say I think the first result is a bit strange? How come different fdm methods don't give different results? I think1. the methods are close in accuracy anyways2. large NT, NSI can take NT = 100 and then see ....Ah, ok. And the "methods" in 1. are SDE discretization schemes like Euler, Milstein?Yes, it's the FDM part.

Last edited by Cuchulainn on December 15th, 2013, 11:00 pm, edited 1 time in total.

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

- Cuchulainn
**Posts:**60518**Joined:****Location:**Amsterdam-
**Contact:**

Let's take Box Muller. For all NT, NS I get the same anwers for all FDM schemes for Sitmo, but .NET answers are different. So, it does not seem to matter if I use Euler or PC etc.Any ideas why?(ditto for Polar, but the values are less good than Box Muller).

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

GZIP: On