Statistics

Problem Statement for "FixedPointTheorem"

Problem Statement

The fixed-point theorem is one of those cornerstones of mathematics that reaches towards all disciplines, and oddly enough it is also closely related to the ability of any program to Quine itself (or to print out its own source code). Put simply, the fixed-point theorem states that with certain restrictions on a real-valued function F, there is always a point such that X=F(X). Taking the fixed-point theorem further, you can show that any function that meets certain restrictions will start to cycle through values if you keep on feeding it its own output (doing this with programs and their output is one way of producing programs that Quine themselves).

One simple function that does this is the logistic function F(X)=R*X*(1-X) in the interval [0,1] for certain values of R. For example, if you start with the value X=.25 and feed it into F to get a new X, then feed that value into F to get yet another X, and so on, the values of X that are produced will converge to a small set of values that will eventually repeat forever, called a cycle.

Your program will be given a double R between 0.1 and 3.569 inclusive. Starting with X=.25, generate the first 200,000 iterations of F using the given value of R, which will stabilize values of X. Then generate 1000 more values, and return the range of these values (highest value - lowest value). In other words, you will be finding the range of the values produced between iterations 200,001 and 201,000 inclusive.

Definition

Class:
FixedPointTheorem
Method:
cycleRange
Parameters:
double
Returns:
double
Method signature:
double cycleRange(double R)
(be sure your method is public)

Notes

  • Don't worry about overflow. With the given values it'll never happen.

Constraints

  • R will be a value between 0.1 and 3.569 inclusive.
  • R will always be a value such that the process stated above will produce a result accurate to 1e-9 (absolute or relative).

Examples

  1. 0.1

    Returns: 0.0

    At low numbers, there exists only one point in the cycle, so the answer is 0.0.

  2. 3.05

    Returns: 0.14754098360655865

  3. 3.4499

    Returns: 0.4175631735867292

  4. 3.55

    Returns: 0.5325704489850351

  5. 3.565

    Returns: 0.5454276003030636

  6. 3.5689

    Returns: 0.5489996297493569

  7. 2.34

    Returns: 0.0

  8. 3.49

    Returns: 0.48387181850304856

  9. 2.98

    Returns: 4.9960036108132044E-15

  10. 2.99

    Returns: 8.881784197001252E-15

  11. 3.04

    Returns: 0.13223520554106594

  12. 3.01

    Returns: 0.06652818735715116

  13. 3.541

    Returns: 0.519046049516487

  14. 3.41876

    Returns: 0.39789106661899026

  15. 3.18763

    Returns: 0.2780784826383129

  16. 2.989999

    Returns: 9.43689570931383E-15

  17. 2.999

    Returns: 1.5021317523178368E-13

  18. 3.11

    Returns: 0.2162005848747809

  19. 3.345

    Returns: 0.3660229490599461

  20. 3.35

    Returns: 0.3683272441568087

  21. 2.0

    Returns: 0.0

  22. 1.5

    Returns: 5.551115123125783E-17

  23. 1.13

    Returns: 0.0

  24. 3.14159265

    Returns: 0.24375535949657212

  25. 2.987654

    Returns: 7.216449660063518E-15

  26. 3.1333333

    Returns: 0.23692611504852346

  27. 3.01

    Returns: 0.06652818735715116

  28. 3.005

    Returns: 0.047091419960362035

  29. 3.0005

    Returns: 0.014905567254818064

  30. 3.00005

    Returns: 0.004713996108955176

    Make sure you're iterating 200,000 times.

  31. 3.0005

    Returns: 0.014905567254818064

  32. 3.27

    Returns: 0.3283583517096015

  33. 3.5689

    Returns: 0.5489996297493569

  34. 3.4499

    Returns: 0.4175631735867292


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: