Zelaron Gaming Forum

Zelaron Gaming Forum (http://zelaron.com/forum/index.php)
-   Science and Art (http://zelaron.com/forum/forumdisplay.php?f=344)
-   -   Look out man, 5-0! (http://zelaron.com/forum/showthread.php?t=58417)

Chruser 2020-07-18 06:21 PM

Look out man, 5-0!
 
print(*[round((((5**0+5**.5)*.5)**O-((5**0+5**-.5)*.5)**O)*5**-.5) for O in range(0,50)])

Obviously you could do a lot worse in terms of obfuscation, but I like how that one-liner turned out anyway. What's your favorite obfuscated and/or confusing code?

Demosthenes 2020-07-19 06:55 PM

Quote:

Originally Posted by Chruser (Post 711189)
print(*[round((((5**0+5**.5)*.5)**O-((5**0+5**-.5)*.5)**O)*5**-.5) for O in range(0,50)])

Obviously you could do a lot worse in terms of obfuscation, but I like how that one-liner turned out anyway. What's your favorite obfuscated and/or confusing code?

Not at all what I expected. Then I looked closer at your statement and discovered all the golden ratios. Always knew that the ratio of successive terms in the fibonacci sequence tended to the golden ratio, but didn't realize that you could actually generate fibonacci terms that way. Pretty cool.

Chruser 2020-07-20 12:08 PM

Quote:

Originally Posted by Demosthenes (Post 711203)
Not at all what I expected. Then I looked closer at your statement and discovered all the golden ratios. Always knew that the ratio of successive terms in the fibonacci sequence tended to the golden ratio, but didn't realize that you could actually generate fibonacci terms that way. Pretty cool.


I'm glad you liked it! Yes, linear recurrence relations like lend themselves well to explicit solutions by the transformation , but to be fair, there aren't really that many examples of them of order that are interesting. Nonlinear ones, such as the logistic map become very interesting and intractable very quickly, though:

https://www.youtube.com/watch?v=ovJcsL7vyrk


Personally, I think the weird connections between recurrence relations, differential equations, generating functions and derivatives are particularly fascinating. For example, the Legendre polynomials (which have a very large number of applications in physics, probability theory, etc) can be defined in either of the following four ways:

1. In terms of a recurrence relation (with ):




2. In terms of n-th derivatives:




3. As coefficients of a series expansion (from electrostatics):




4. As polynomial solutions of an ordinary differential equation (which you get from solving Laplace's equation in spherical coordinates):




If you play around with various polynomial sequences for a while (particularly orthogonal sequences), it becomes "obvious" that there's some sort of space or operator that connects all of the above. In other words, it's a bit like there "has to be" some algorithm to convert a differential equation to a recurrence relation, or vice versa, but the general theory for that is very poorly understood.


Also, as a cool sidenote, you can use the zeros of the n-th Legendre polynomial for numerical integration of many "nice" functions :



Gauss himself came up with that one, obviously...

Chruser 2020-07-23 04:52 PM

I guess I should have referred to one of my recent posts as well, on the topic of the golden ratio ...


Chruser 2020-08-26 06:31 AM

Apparently I managed to find a new (?) series for the n-th Fibonacci number somehow, which looks surprisingly terrible:

http://zelaron.com/urusai/fn.png

Presumably the summand can be simplified further, but I'm not seeing any obvious way of doing it.


All times are GMT -6. The time now is 12:08 AM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.