• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 03:51
CEST 09:51
KST 16:51
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL19] Finals Recap: Standing Tall10HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Weekly Cups (June 30 - July 6): Classic Doubles4[BSL20] Non-Korean Championship 4x BSL + 4x China9Flash Announces Hiatus From ASL66Weekly Cups (June 23-29): Reynor in world title form?14FEL Cracov 2025 (July 27) - $8000 live event22
StarCraft 2
General
How Esports Is Reshaping the Future of Competitive The GOAT ranking of GOAT rankings Weekly Cups (June 30 - July 6): Classic Doubles The SCII GOAT: A statistical Evaluation Weekly Cups (June 23-29): Reynor in world title form?
Tourneys
RSL: Revival, a new crowdfunded tournament series FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays Korean Starcraft League Week 77
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
i aint gon lie to u bruh... BGH Auto Balance -> http://bghmmr.eu/ ASL20 Preliminary Maps [ASL19] Finals Recap: Standing Tall SC uni coach streams logging into betting site
Tourneys
[BSL20] Non-Korean Championship 4x BSL + 4x China [BSL20] Grand Finals - Sunday 20:00 CET CSL Xiamen International Invitational The Casual Games of the Week Thread
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Path of Exile What do you want from future RTS games? Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Stop Killing Games - European Citizens Initiative Summer Games Done Quick 2025! US Politics Mega-thread Russo-Ukrainian War Thread Summer Games Done Quick 2024!
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
momentary artworks from des…
tankgirl
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 656 users

a fun math puzzle

Blogs > evanthebouncy!
Post a Reply
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
June 25 2015 05:02 GMT
#1
a curious puzzle for those who want to have some fun.
https://gist.github.com/evanthebouncy/bde3e510e562da5db6a2
take a look at this code and try to run it, what it does is it creates some random functions f1,f2,...,f100, and then form a chain by composing them together, and the result is a (random) constant function! how can it be?
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
Xxazn4lyfe51xX
Profile Joined October 2010
United States976 Posts
June 25 2015 07:42 GMT
#2
As far as I can tell, it's not really a constant function. As n grows larger, the function approaches a random, constant value. For the purposes of the interpreter they give us, the point at which the function gives a constant number to the number of digits the output reads is about around n = 16.

I'm not good enough, or at least not patient enough with math to figure out why exactly it is that putting numbers through increasing numbers of random functions tends towards constancy though.
fixed_point
Profile Joined June 2011
Germany4891 Posts
Last Edited: 2015-06-25 09:52:00
June 25 2015 09:27 GMT
#3
By order arguments, one can show that at each value of n, the result of the composition is more dependent on the random numbers you generated rather than the initial x.

This is because at the first iteration f_1 you've already mapped any x to a number between 0 and 1. Then look at the series expansion of 1/(1+e^(-x)) (respectively 1/(1+e^(x)) ) for n=2 onwards and you'll see that the terms depending on x become negligible since the powers of 0 < f_1(x) < 1 vanishes quickly unless f_1(x)=1 is already a constant function.

So yeah, the result is (almost) never a constant function, but damned close to one. Caveat: if your random number at any point is zero the function becomes constant.
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
June 25 2015 11:35 GMT
#4
On June 25 2015 18:27 fixed_point wrote:
By order arguments, one can show that at each value of n, the result of the composition is more dependent on the random numbers you generated rather than the initial x.

This is because at the first iteration f_1 you've already mapped any x to a number between 0 and 1. Then look at the series expansion of 1/(1+e^(-x)) (respectively 1/(1+e^(x)) ) for n=2 onwards and you'll see that the terms depending on x become negligible since the powers of 0 < f_1(x) < 1 vanishes quickly unless f_1(x)=1 is already a constant function.

So yeah, the result is (almost) never a constant function, but damned close to one. Caveat: if your random number at any point is zero the function becomes constant.


it's fitting that someone with a name like "fixed point" should answer this
lol
but yeah I know it's not a constant function, it's just faster to say it that way.

can u elaborate a bit on the derivative argument (serieis expansion)? derivatives and function composition has a strong relationship via the chain rule, so we can take the derivative of the huge chain and get a big multiplications (which approaches 0 in our problem), is that what you were trying to say?
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
June 25 2015 11:37 GMT
#5
On June 25 2015 16:42 Xxazn4lyfe51xX wrote:
As far as I can tell, it's not really a constant function. As n grows larger, the function approaches a random, constant value. For the purposes of the interpreter they give us, the point at which the function gives a constant number to the number of digits the output reads is about around n = 16.

I'm not good enough, or at least not patient enough with math to figure out why exactly it is that putting numbers through increasing numbers of random functions tends towards constancy though.


the way I reasoned with it is consider a pair of numbers x, y
and push the numbers through the chain, i.e.
x, y
f1(x), f1(y)
f2(x), f2(y)
...

and try to prove that in each step the distance between x and y is closer together

once you're done with that, u will be able to show then for any distinct values (x, y) they will converge together after a sufficiently long chain, thus the chain is close to a constant function
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
fixed_point
Profile Joined June 2011
Germany4891 Posts
Last Edited: 2015-06-25 13:18:03
June 25 2015 13:16 GMT
#6
On June 25 2015 20:35 evanthebouncy! wrote:
Show nested quote +
On June 25 2015 18:27 fixed_point wrote:
By order arguments, one can show that at each value of n, the result of the composition is more dependent on the random numbers you generated rather than the initial x.

This is because at the first iteration f_1 you've already mapped any x to a number between 0 and 1. Then look at the series expansion of 1/(1+e^(-x)) (respectively 1/(1+e^(x)) ) for n=2 onwards and you'll see that the terms depending on x become negligible since the powers of 0 < f_1(x) < 1 vanishes quickly unless f_1(x)=1 is already a constant function.

So yeah, the result is (almost) never a constant function, but damned close to one. Caveat: if your random number at any point is zero the function becomes constant.


it's fitting that someone with a name like "fixed point" should answer this
lol
but yeah I know it's not a constant function, it's just faster to say it that way.

can u elaborate a bit on the derivative argument (serieis expansion)? derivatives and function composition has a strong relationship via the chain rule, so we can take the derivative of the huge chain and get a big multiplications (which approaches 0 in our problem), is that what you were trying to say?

Derivatives are unnecessary. I can write more details with greater clarity in latex when I get home.
DucK-
Profile Blog Joined January 2009
Singapore11447 Posts
June 25 2015 15:01 GMT
#7
I thought this was pure math. Seems like I need some programming knowledge to understand :\
TanGeng
Profile Blog Joined January 2009
Sanya12364 Posts
June 25 2015 19:40 GMT
#8
I don't really know how fun that was. If you jam a number through 100 iterations of

shrink_fun(x) = 1 / (1 + e^-x)

You don't leave a lot of information about the original x at the very end.
Moderator我们是个踏实的赞助商模式俱乐部
fixed_point
Profile Joined June 2011
Germany4891 Posts
June 25 2015 21:26 GMT
#9
Heuristically this is why the function converges to a constant one.

PDF file on google drive
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
June 25 2015 23:34 GMT
#10
On June 26 2015 06:26 fixed_point wrote:
Heuristically this is why the function converges to a constant one.

PDF file on google drive


wow that's quite more involved than I expected.
but I'm sure it's second nature to you so good!!
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
Kleinmuuhg
Profile Blog Joined September 2010
Vanuatu4091 Posts
June 26 2015 00:12 GMT
#11
On June 25 2015 20:37 evanthebouncy! wrote:
Show nested quote +
On June 25 2015 16:42 Xxazn4lyfe51xX wrote:
As far as I can tell, it's not really a constant function. As n grows larger, the function approaches a random, constant value. For the purposes of the interpreter they give us, the point at which the function gives a constant number to the number of digits the output reads is about around n = 16.

I'm not good enough, or at least not patient enough with math to figure out why exactly it is that putting numbers through increasing numbers of random functions tends towards constancy though.


the way I reasoned with it is consider a pair of numbers x, y
and push the numbers through the chain, i.e.
x, y
f1(x), f1(y)
f2(x), f2(y)
...

and try to prove that in each step the distance between x and y is closer together

once you're done with that, u will be able to show then for any distinct values (x, y) they will converge together after a sufficiently long chain, thus the chain is close to a constant function

sounds like a typical contraction to me
This is our town, scrub
fixed_point
Profile Joined June 2011
Germany4891 Posts
Last Edited: 2015-06-26 06:05:54
June 26 2015 06:00 GMT
#12
On June 26 2015 09:12 Kleinmuuhg wrote:
Show nested quote +
On June 25 2015 20:37 evanthebouncy! wrote:
On June 25 2015 16:42 Xxazn4lyfe51xX wrote:
As far as I can tell, it's not really a constant function. As n grows larger, the function approaches a random, constant value. For the purposes of the interpreter they give us, the point at which the function gives a constant number to the number of digits the output reads is about around n = 16.

I'm not good enough, or at least not patient enough with math to figure out why exactly it is that putting numbers through increasing numbers of random functions tends towards constancy though.


the way I reasoned with it is consider a pair of numbers x, y
and push the numbers through the chain, i.e.
x, y
f1(x), f1(y)
f2(x), f2(y)
...

and try to prove that in each step the distance between x and y is closer together

once you're done with that, u will be able to show then for any distinct values (x, y) they will converge together after a sufficiently long chain, thus the chain is close to a constant function

sounds like a typical contraction to me

If the domain is two fixed numbers, the functions are contractions. Generally you'll need a fixed constant 0 \leq \lambda < 1 for which the distance between any two f_1(x),f_2(y) is less than \lambda |x-y| for all x,y \in R. I'm not sure we have that here, but then again my brain doesn't work at this hour (need to take a look at the behaviour near x=0)
manicmessiah
Profile Joined June 2015
United States107 Posts
June 26 2015 07:33 GMT
#13
I have a feeling I should know what is going on, but I have no idea
fixed_point
Profile Joined June 2011
Germany4891 Posts
Last Edited: 2015-06-26 11:21:08
June 26 2015 10:59 GMT
#14
On June 26 2015 15:00 fixed_point wrote:
Show nested quote +
On June 26 2015 09:12 Kleinmuuhg wrote:
On June 25 2015 20:37 evanthebouncy! wrote:
On June 25 2015 16:42 Xxazn4lyfe51xX wrote:
As far as I can tell, it's not really a constant function. As n grows larger, the function approaches a random, constant value. For the purposes of the interpreter they give us, the point at which the function gives a constant number to the number of digits the output reads is about around n = 16.

I'm not good enough, or at least not patient enough with math to figure out why exactly it is that putting numbers through increasing numbers of random functions tends towards constancy though.


the way I reasoned with it is consider a pair of numbers x, y
and push the numbers through the chain, i.e.
x, y
f1(x), f1(y)
f2(x), f2(y)
...

and try to prove that in each step the distance between x and y is closer together

once you're done with that, u will be able to show then for any distinct values (x, y) they will converge together after a sufficiently long chain, thus the chain is close to a constant function

sounds like a typical contraction to me

If the domain is two fixed numbers, the functions are contractions. Generally you'll need a fixed constant 0 \leq \lambda < 1 for which the distance between any two f_1(x),f_2(y) is less than \lambda |x-y| for all x,y \in R. I'm not sure we have that here, but then again my brain doesn't work at this hour (need to take a look at the behaviour near x=0)

Nevermind, I'm an idiot. y=f_1(x) is between 0 and 1 and so f_100(f_99(...f(2(y)))) is a contraction. Therefore you can definitely use the contraction mapping/Banach fixed point theorem to prove that the composition/chain converges to a fixed point (i.e. constant number) for sufficiently large compositions. Pretty ironic, given my name...

However, I still think the series expansion is perhaps more intuitive for one unfamiliar with this theorem, since the original question asks for a finite sequence of compositions. (Of course from an abstract point of view, this is just a specific case of the fixed point theorem).
Dagobert
Profile Blog Joined July 2009
Netherlands1858 Posts
June 26 2015 12:11 GMT
#15
Having trouble with Berkeley homework?
fixed_point
Profile Joined June 2011
Germany4891 Posts
June 26 2015 12:42 GMT
#16
On June 26 2015 21:11 Dagobert wrote:
Having trouble with Berkeley homework?

I wish
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
June 26 2015 23:19 GMT
#17
On June 26 2015 21:11 Dagobert wrote:
Having trouble with Berkeley homework?


nah i graduated 3 yrs ago lol i'm doing a phd now.
this problem actually came up when i tried to run a randomly initialized neural network of 10 layers w/o training, and noticing it is always the constant function, so I thought it was really cool so I abstracted away the non-essentials and hope people would find the simplified problem interesting to look at.
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
Last Edited: 2015-06-26 23:22:51
June 26 2015 23:20 GMT
#18
On June 26 2015 19:59 fixed_point wrote:
....
Pretty ironic, given my name...
....





that was my thought the entire time lawl
fffffffffffffffffffffffffffffffff(uck)
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
Dagobert
Profile Blog Joined July 2009
Netherlands1858 Posts
June 27 2015 07:15 GMT
#19
Oh, that's more interesting than the problem here. What are you trying to get the neural network to do?
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
June 27 2015 23:24 GMT
#20
On June 27 2015 16:15 Dagobert wrote:
Oh, that's more interesting than the problem here. What are you trying to get the neural network to do?

nothing. just want to play with one for fun (cuz people kept talking about their fantastic learning properties). Just want to run it on the mnist dataset. Couldn't do back propagation on the deep one unfortunately, so i trained a shallow one with 94% accuracy, which is not bad i think.
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
Please log in or register to reply.
Live Events Refresh
Next event in 2h 9m
[ Submit Event ]
Live Streams
Refresh
StarCraft: Brood War
GuemChi 1326
actioN 1262
Tasteless 273
PianO 245
Leta 174
EffOrt 164
Soma 149
ToSsGirL 131
Hyuk 114
Dewaltoss 85
[ Show more ]
Sacsri 40
Movie 32
Barracks 30
Free 26
yabsab 25
Bale 17
Sharp 13
Dota 2
XcaliburYe403
League of Legends
JimRising 578
Counter-Strike
Stewie2K1088
shoxiejesuss370
Other Games
ceh9294
Liquid`RaSZi275
Mew2King76
Pyrionflax2
Organizations
Other Games
gamesdonequick20148
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Berry_CruncH423
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2174
League of Legends
• Rush1364
• Lourlo1085
• HappyZerGling116
Upcoming Events
Sparkling Tuna Cup
2h 9m
WardiTV European League
8h 9m
MaNa vs sebesdes
Mixu vs Fjant
ByuN vs HeRoMaRinE
ShoWTimE vs goblin
Gerald vs Babymarine
Krystianer vs YoungYakov
PiGosaur Monday
16h 9m
The PondCast
1d 2h
WardiTV European League
1d 4h
Jumy vs NightPhoenix
Percival vs Nicoract
ArT vs HiGhDrA
MaxPax vs Harstem
Scarlett vs Shameless
SKillous vs uThermal
uThermal 2v2 Circuit
1d 8h
Replay Cast
1d 16h
RSL Revival
2 days
ByuN vs SHIN
Clem vs Reynor
Replay Cast
2 days
RSL Revival
3 days
Classic vs Cure
[ Show More ]
FEL
3 days
RSL Revival
4 days
FEL
4 days
FEL
4 days
CSO Cup
4 days
BSL20 Non-Korean Champi…
4 days
Bonyth vs QiaoGege
Dewalt vs Fengzi
Hawk vs Zhanhun
Sziky vs Mihu
Mihu vs QiaoGege
Zhanhun vs Sziky
Fengzi vs Hawk
Sparkling Tuna Cup
5 days
RSL Revival
5 days
FEL
5 days
BSL20 Non-Korean Champi…
5 days
Bonyth vs Dewalt
QiaoGege vs Dewalt
Hawk vs Bonyth
Sziky vs Fengzi
Mihu vs Zhanhun
QiaoGege vs Zhanhun
Fengzi vs Mihu
Liquipedia Results

Completed

BSL Season 20
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
CSL Xiamen Invitational
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.