Skip to content

Instantly share code, notes, and snippets.

View mvw's full-sized avatar

Marc van Woerkom mvw

  • Germany, European Union
View GitHub Profile
#!/usr/bin/env ruby
class Fspace
# single iteration
def f(x)
if x < 0
return 0.5
elsif x <= 0.5
return x + 0.5
elsif x <= 1.0
@mvw
mvw / output-f10.txt
Created May 24, 2014 03:57
main output from f10.rb
first try
n = 2, h = 0.5
x0 = 0.0, y0 = 0.5
x1 = 0.5, y1 = 1.0
FP #1 around 0.6666666666666666 = 2/3
x2 = 1.0, y2 = 0.0
1: 2/3 = 0.6666666666666666 -> 0.6666666666666667 (delta = 1.1102230246251565e-16)
found 1 fixed points
A = { 2/3 }
$A = \left\{ \frac{2}{3} \right\}, \, |A| = 1$
# range of random N_i
$range = 20
# parameter L
$l = 10
$debug = false
# go!
$i_max = 4 * $l
l = 10
n = [8, 19, 14, 12, 4, 15, 8, 17, 1, 3, 15, 9, 3, 4, 8, 17, 14, 13, 15, 3, 1, 8, 17, 13, 4, 16, 8, 14, 6, 11, 7, 12, 15, 7, 10, 19, 4, 19, 5, 9]
change dir after c = 20
=> c = 1, t = 3936, dt = 0, dt_opt = 0, dt_opt2 = 0, q = 0
=> c = 2, t = 3953, dt = 17, dt_opt = 17, dt_opt2 = 17, q = 17
=> c = 3, t = 3992, dt = 39, dt_opt = 39, dt_opt2 = 39, q = 56
=> c = 4, t = 4025, dt = 33, dt_opt = 33, dt_opt2 = 33, q = 89
=> c = 5, t = 4056, dt = 31, dt_opt = 31, dt_opt2 = 31, q = 120
=> c = 6, t = 4087, dt = 31, dt_opt = 31, dt_opt2 = 31, q = 151
=> c = 7, t = 4116, dt = 29, dt_opt = 29, dt_opt2 = 29, q = 180
l = 10
n = [11, 1, 14, 5, 15, 12, 11, 12, 1, 1, 3, 9, 5, 10, 3, 17, 19, 3, 11, 15, 11, 17, 6, 14, 2, 3, 8, 18, 6, 2, 3, 1, 16, 9, 17, 12, 9, 2, 14, 6]
change dir after c = 20
=> c = 1, t = 3659, dt = 0, dt_opt = 0, dt_opt2 = 0, q = 0
=> c = 2, t = 3657, dt = -2, dt_opt = -2, dt_opt2 = -2, q = -2
=> c = 3, t = 3623, dt = -34, dt_opt = -34, dt_opt2 = -34, q = -36
=> c = 4, t = 3605, dt = -18, dt_opt = -18, dt_opt2 = -18, q = -54
=> c = 5, t = 3569, dt = -36, dt_opt = -36, dt_opt2 = -36, q = -90
=> c = 6, t = 3559, dt = -10, dt_opt = -10, dt_opt2 = -10, q = -100
=> c = 7, t = 3567, dt = 8, dt_opt = 8, dt_opt2 = 8, q = -92
l = 10
n = [19, 2, 19, 12, 13, 5, 6, 6, 12, 9, 13, 14, 8, 4, 12, 11, 15, 12, 18, 2, 13, 13, 20, 10, 9, 17, 11, 15, 10, 15, 1, 15, 12, 13, 15, 17, 7, 16, 12, 5]
change dir after c = 20
=> c = 1, t = 4661, dt = 0, dt_opt = 0, dt_opt2 = 0, q = 0
=> c = 2, t = 4707, dt = 46, dt_opt = 46, dt_opt2 = 46, q = 46
=> c = 3, t = 4731, dt = 24, dt_opt = 24, dt_opt2 = 24, q = 70
=> c = 4, t = 4753, dt = 22, dt_opt = 22, dt_opt2 = 22, q = 92
=> c = 5, t = 4779, dt = 26, dt_opt = 26, dt_opt2 = 26, q = 118
=> c = 6, t = 4813, dt = 34, dt_opt = 34, dt_opt2 = 34, q = 152
=> c = 7, t = 4823, dt = 10, dt_opt = 10, dt_opt2 = 10, q = 162
@mvw
mvw / table.rb
Created February 10, 2015 17:56
def is_guy(s)
if s == 'a' or s == 'b' or s == 'c' or s == 'd'
return true
end
return false
end
def two_guys(p)
9.times do |i|
if is_guy(p[i]) and is_guy(p[i+1])
@mvw
mvw / abcde.rb
Last active August 29, 2015 14:16
ctr = 0
100000.times do |k|
s = sprintf("%05d", k)
a = s[0].to_i
b = s[1].to_i
c = s[2].to_i
d = s[3].to_i
e = s[4].to_i
@mvw
mvw / abcde.log
Last active August 29, 2015 14:16
1. 1 0 0 0 1
10001 % 1 = 0 10001 / 1 = 10001
10001 % 01 = 0 10001 / 01 = 10001
10001 % 001 = 0 10001 / 001 = 10001
10001 % 0001 = 0 10001 / 0001 = 10001
2. 1 0 0 0 2
10002 % 2 = 0 10002 / 2 = 5001
10002 % 02 = 0 10002 / 02 = 5001
10002 % 002 = 0 10002 / 002 = 5001
10002 % 0002 = 0 10002 / 0002 = 5001
00: 1, l=01, di=01
01: 1, l=01, di=01
02: 2, l=01, di=01
03: 6, l=01, di=01
04: 24, l=02, di=02
05: 120, l=03, di=03
06: 720, l=03, di=03
07: 5040, l=04, di=03
08: 40320, l=05, di=04
09: 362880, l=06, di=05