Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,25 @@
|
|||
object Feigenbaum1 extends App {
|
||||
val (max_it, max_it_j) = (13, 10)
|
||||
var (a1, a2, d1, a) = (1.0, 0.0, 3.2, 0.0)
|
||||
|
||||
println(" i d")
|
||||
var i: Int = 2
|
||||
while (i <= max_it) {
|
||||
a = a1 + (a1 - a2) / d1
|
||||
for (_ <- 0 until max_it_j) {
|
||||
var (x, y) = (0.0, 0.0)
|
||||
for (_ <- 0 until 1 << i) {
|
||||
y = 1.0 - 2.0 * y * x
|
||||
x = a - x * x
|
||||
}
|
||||
a -= x / y
|
||||
}
|
||||
val d: Double = (a1 - a2) / (a - a1)
|
||||
printf("%2d %.8f\n", i, d)
|
||||
d1 = d
|
||||
a2 = a1
|
||||
a1 = a
|
||||
i += 1
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
object Feigenbaum2 extends App {
|
||||
private val (max_it, max_it_j) = (13, 10)
|
||||
|
||||
private def result = {
|
||||
|
||||
@scala.annotation.tailrec
|
||||
def outer(i: Int, d1: Double, a2: Double, a1: Double, acc: Seq[Double]): Seq[Double] = {
|
||||
@scala.annotation.tailrec
|
||||
def center(j: Int, a: Double): Double = {
|
||||
@scala.annotation.tailrec
|
||||
def inner(k: Int, end: Int, x: Double, y: Double): (Double, Double) =
|
||||
if (k < end) inner(k + 1, end, a - x * x, 1.0 - 2.0 * y * x) else (x, y)
|
||||
|
||||
val (x, y) = inner(0, 1 << i, 0.0, 0.0)
|
||||
if (j < max_it_j) {
|
||||
center(j + 1, a - (x / y))
|
||||
} else a
|
||||
}
|
||||
|
||||
if (i <= max_it) {
|
||||
val a = center(0, a1 + (a1 - a2) / d1)
|
||||
val d: Double = (a1 - a2) / (a - a1)
|
||||
|
||||
outer(i + 1, d, a1, a, acc :+ d)
|
||||
} else acc
|
||||
}
|
||||
|
||||
outer(2, 3.2, 0, 1.0, Seq[Double]()).zipWithIndex
|
||||
}
|
||||
|
||||
println(" i ≈ δ")
|
||||
result.foreach { case (δ, i) => println(f"${i + 2}%2d $δ%.8f") }
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue