#python pythagoras was here
Explore tagged Tumblr posts
goldenpythontwins · 29 days ago
Note
. Who. Are you.
( - @lemonboynotcavetown )
Oh- HI HELLO!!! I'm Python, one of the shapes that run this blog. The other one is Gold, my twin brother. Though for some reason he reaaaally didn't want to introduce himself. So I did instead!
9 notes · View notes
parafrazerofhistory · 3 months ago
Text
Where the Gods Are Buried
“The grave of Zeus, the great god of Greece, was shewn to visitors in Crete as late as about the beginning of our era. The body of Dionysus was buried at Delphi beside the golden statue of Apollo, and his tomb bore the inscription, ‘Here lies Dionysus dead, the son of Semele.' According to one account, Apollo himself was buried at Delphi; for Pythagoras is said to have carved an inscription on his tomb, setting forth how the god had been killed by the python and buried under the tripod. The ancient god Cronus was buried in Sicily, and the graves of Hermes, Aphrodite, and Ares were shewn in Hermopolis, Cyprus, and Thrace.”
—J. G. Frazer, The Dying God (The Golden Bough, vol. IV, 1914, pp. 3-4)
Tumblr media
Mid-4th-cent. BCE grave stele from Athens, carved in Pentelic marble. Now in the National Archaeological Museum of Athens.
(Source: George E. Koronaios, CC BY-SA 4.0 https://creativecommons.org/licenses/by-sa/4.0, via Wikimedia Commons)
13 notes · View notes
author-morgan · 5 years ago
Text
Kryptic ↟ Deimos
one - the first trial
masterlist
But the great leveler, Death: not even the gods can defend a man, not even one they love, that day when fate takes hold and lays him out at last.
      Death submits to no one, not even Dread and Destruction.
      They are both weapons of flesh and bone, of warm blood and beating hearts, and they cannot be controlled.
BRONZE DROPLETS OF venom hang from the fangs of a great serpent coiled around stalactites and stalagmites in the Cave of Gaia. Its scales glinting gold in the dim light of the braziers. Beneath the Python's open mouth is a golden pyramid, pulsating with light. It draws Lesya toward it like a moth to a flame. Elpenor explains it is a powerful artifact of ancient origin —only those descended from or gifted by the gods can use it effectively. The last person to be gifted a vision from the pyramid had been Pythagoras.
The antechamber Elpenor leads her to has burning sconces lined around the smoothed walls —the flickering flames cast light on five children of a similar age all wearing the same grey exomis. Standing above them is a woman with greying hair and a wrinkled face, her jowls already beginning to sag. She extends a spindly hand in the direction of her newest daughter, bidding her step forward. Elpenor presses his hand to her back, urging Lesya forward. The woman's smile is something haunting —a cage of teeth that reminds the girl of a smiling shark. "Come and meet your brothers and sisters."
I already have brothers, Lesya bites her tongue as she looks at the three boys and two girls staring at her. They're all bigger and leaner than she is —each of them has a hungry glint in their nigh-hollow eyes. Leysa glances over her shoulder, but Elpenor is already gone. Her frightened gaze returns to the crone and her children. The woman motions to those standing before her and rattles off their names. "This is Deimos, Polyas, Kyberniskos, Elena, and Syntyche."
Chrysis steps in front of Lesya and takes hold of her chin, turning her thin face toward the light —scrutinizing her high cheekbones and the dusting of freckles. The girl has the face of a priestess or a hetaera, not a warrior. "And what is your name?" It's both a simple question and a test.
"Enyo," Lesya responds, remembering what Elpenor had told her.
Lesya sits away from the fire as the other children laugh and speak of battles —their own victories. She curls into herself, neglecting the small plate of food at her feet, despite how her belly groans and rumbles and silently begins to weep. This is not where she belongs. She was meant to continue her womanly lessons under Kalanthe —weaving, sewing, playing the lyre, and even pottery. From between her fingers, she can see the others looking at her and knows now their laughter is directed toward her.
Someone sits next to her, weary Lesya raises her head and finds the largest and meanest looking of the boys at her side. Deimos, Chrysis named him. His dark brown hair is shorn just above his ears —his face a solemn mask as he doesn't share in the other's amusement. "Don't let Chrysis see you crying," Deimos mutters. Tears are a mark of weakness, and weakness cannot thrive in this place.
Her hair —a mix of chestnut and copper— clings to her damp cheeks. "I want to go home," she tells the boy. His other brothers and sisters were much younger when Chrysis took them under her care —it was easy for a child of two or three to forget their names and family, but she has already endured eight hard summers. Forgetting will not come easy, if it comes at all. Deimos looks over her —thin arms and legs with knobby knees and unsettling eyes the shade of a fresh laurel wreath.
Giving in to the pitiful cries of her stomach, Lesya reaches for the plate of food —fresh nectarines, olives, brown flatbread, and two clumps of roasted red meat. "Here," Deimos says, offering her his ration of roast meat. "You need it more than I do."
"AGAIN," A HARSH voice barks. Alektor circles the two girls, hands behind his back and disappointment on his scrunched-up face. He is an ostracized Spartan who now serves the Cult of Kosmos —instructing Chrysis' children in matters of combat and war. Alektor is a cruel man and enforces that every bruise, bloody nose, cut, and broken bone is a lesson —weakness leaving the body. Enyo rolls onto her back and looks up at Syntyche through a swollen eye, the other obscured by blood trickling down from a gash at her hairline. She kicks her legs up and out, springing to her feet.
Syntyche steps around Enyo and lands a quick blow to her already sore ribs. She blocks the next blow intended for her face with her forearms and pushes back —grunting with exertion but making no progress. Her opponent laughs and shoves Enyo back. A fist connects with her jaw, and blood fills her mouth. The sudden jolt of pain is enough distraction for Syntyche to crouch low and swing her leg around —knocking Enyo to her back for what feels like the millionth time.
"Again," Alektor roars, swatting both girls' legs with a supple switch. It whistles through the air in warning before snapping against Enyo's thigh. She rolls onto her hands and knees, expelling a combination of dark blood and bile. AGAIN!" Sweat stings her eyes and the cut on her forehead, but she stands again —left shoulder hanging limp.
Enyo comes for Syntyche wildly swinging her right arm. She lands a lucky blow, striking the other girl's cheek. The small victory only brings more pain. A hand rips at her hair, twisting near the scalp —her shrill cry is enough to bring everyone in the training grounds to a standstill. Tears prick at her eyes as she drops to her bloody knees. The pressure disappears and a sharp, bony elbow collides with the side of Enyo's head. Specks of black and white flood her vision as she slumps over. Syntyche spits red-tinged saliva at Enyo's side.
"Enough," Alektor snaps, tired of the incompetence of Chrysis' new champion. Enyo feels blood pooling under her cheek, dripping from her mouth and nose. Her body is screaming for her to stay down, but she presses her hands to the gravel and pushes herself back to stand on uneasy legs —clenching her bony fingers into tight fists.
Chrysis hides a reserved smile at the girl's perseverance.
"DEIMOS?" ENYO KNOWS it is him. He's the only one besides Polyas that is nice to her. Neither Syntyche nor Elena like her —Polyas says it's because they're jealous of how rapidly she'd become Deimos and Chrysis' new favorite even though she was weak. Kyberniskos, on the other hand, despises everyone equally.
He passes her a stone cup of cool water and lowers himself next to her, noticing the knob of bone protruding from her bruised shoulder. Without warning, he grips onto Enyo's arm and presses onto her side. The quick jerking motion is followed by soft pop. She immediately clutches her shoulder. "It gets easier," Deimos says, tilting her face toward him. Both her eyes are blackened, her top and bottom lips swollen and busted, and a crusted scab fades back into her hairline —somehow her upturned nose was unscathed.
"What?" Enyo asks. "Getting beat?" The boy doesn't answer.
They sit next to each other for a long moment, staring at the dancing flames and listening to the sound of water bubbling up from the underground spring. "Polyas and I can help you get better," Deimos mutters, his quiet tone still managing to echo in the depths of the cave. Enyo looks at him —eyes wide. "Meet us after sundown," he tells her before leaving.
Polyas and Deimos are waiting in the training grounds after the sun sets and the moon begins to rise. "You're fast," Deimos remarks —he's seen her fight with the other girls and Enyo can easily evade predictable blows, but tires too quickly and fails to deliver any damage to her opponents. Elena and Syntyche walk away from sparring sessions nigh unscathed while Enyo is left bloody and bruised. "But you need to be stronger," he tells her.
He nods to Polyas and the other boy lifts a pair of oenochoai filled with ingots of iron and sand then lunges forward. He holds the stance with his torso straight and knees bent for three long breaths before rising and stepping forward with his other foot. Polyas sets the pair of oenochoai down in front of Enyo —removing the added weight of the iron and several large rocks from each. "You try," he says, motioning toward the vases.
Spindly fingers wrap around the glazed handles —she heaves them off the ground and lunges forward as Polyas had, though her arms are almost too short to keep the oenochoai off the ground. On the third repetition, her shoulders start to shake, her back curving forward. "Keep your shoulders back," Deimos tells her, his voice is lower and rougher than Polyas's. Enyo listens and pushes forward until her knees collapse —unable to carry on.
The training session is not over yet, though. Deimos disappears and returns in a trice carrying a thick branch as long as Enyo is tall. He threads the branch through the handles of the oenochoai, tying them together with a thin leather baldric so they won't slip off and break. Then he lifts the weight from the ground. He curls the barbell toward his chin several times before offering it to Enyo to do the same.
She mimics Deimos's motions, though her movements are not as fluid as his. Polyas and Deimos both correct her form when it falters and after several sets of repetitions, Deimos catches the barbell when it slips from her trembling hands. "One of us will be here every night," Deimos announces and Polyas nods in agreement. They will help Enyo find her strength. After all, no one could become Achilles or Herakles overnight.
9 notes · View notes
t-baba · 8 years ago
Photo
Tumblr media
Speeding Up Python With Cython
Cython is a superset of Python that lets you significantly improve the speed of your code. You can add optional type declarations for even greater benefits. Cython translates your code to optimized C/C++ that gets compiled to a Python extension module. 
In this tutorial you'll learn how to install Cython, get an immediate performance boost of your Python code for free, and then how to really take advantage of Cython by adding types and profiling your code. Finally, you'll learn about more advanced topics like integration with C/C++ code and NumPy that you can explore further for even greater gains.
Counting Pythagorean Triples
Pythagoras was a Greek mathematician and philosopher. He is famous for his Pythagorean theorem, which states that in a right-angled triangle, the sum of squares of the legs of the triangles is equal to the square of the hypotenuse. Pythagorean triples are any three positive integers a, b and c that such that a² + b² = c². Here is a program that finds all the Pythagorean triples whose members are not greater than the provided limit.
import time def count(limit): result = 0 for a in range(1, limit + 1): for b in range(a + 1, limit + 1): for c in range(b + 1, limit + 1): if c * c > a * a + b * b: break if c * c == (a * a + b * b): result += 1 return result if __name__ == '__main__': start = time.time() result = count(1000) duration = time.time() - start print(result, duration) Output: 881 13.883624076843262
Apparently there are 881 triples, and it took the program a little less than 14 seconds to find it out. That's not too long, but long enough to be annoying. If we want to find more triples up to a higher limit, we should find a way to make it go quicker. 
It turns out that there are substantially better algorithms, but today we're focusing on making Python faster with Cython, not on the best algorithm for finding Pythagorean triples. 
Easy Boosting With pyximport
The easiest way to use Cython is to use the special pyximport feature. This is a statement that compiles your Cython code on the fly and lets you enjoy the benefits of native optimization without too much trouble. 
You need to put the code to cythonize in its own module, write one line of setup in your main program, and then import it as usual. Let's see what it looks like. I moved the function to its own file called pythagorean_triples.pyx. The extension is important for Cython. The line that activates Cython is import pyximport; pyximport.install(). Then it just imports the module with the count() function and later invokes it in the main function.
import time import pyximport; pyximport.install() import pythagorean_triples def main(): start = time.time() result = pythagorean_triples.count(1000) duration = time.time() - start print(result, duration) if __name__ == '__main__': main() Output: 881 9.432806253433228
The pure Python function ran 50% longer. We got this boost by adding a single line. Not bad at all.
Build Your Own Extension Module
While pyximport is really convenient during development, it works only on pure Python modules. Often when optimizing code you want to reference native C libraries or Python extension modules. 
To support those, and also to avoid dynamically compiling on every run, you can build your own Cython extension module. You need to add a little setup.py file and remember to build it before running your program whenever you modify the Cython code. Here is the setup.py file:
from distutils.core import setup from Cython.Build import cythonize setup( ext_modules = cythonize("pythagorean_triples.pyx") )
Then you need to build it:
$ python setup.py build_ext --inplace Compiling pythagorean_triples.pyx because it changed. [1/1] Cythonizing pythagorean_triples.pyx running build_ext building 'pythagorean_triples' extension creating build creating build/temp.macosx-10.7-x86_64-3.6 gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/gigi.sayfan/miniconda3/envs/py3/include -arch x86_64 -I/Users/gigi.sayfan/miniconda3/envs/py3/include -arch x86_64 -I/Users/gigi.sayfan/miniconda3/envs/py3/include/python3.6m -c pythagorean_triples.c -o build/temp.macosx-10.7-x86_64-3.6/pythagorean_triples.o gcc -bundle -undefined dynamic_lookup -L/Users/gigi.sayfan/miniconda3/envs/py3/lib -L/Users/gigi.sayfan/miniconda3/envs/py3/lib -arch x86_64 build/temp.macosx-10.7-x86_64-3.6/pythagorean_triples.o -L/Users/gigi.sayfan/miniconda3/envs/py3/lib -o pythagorean_triples.cpython-36m-darwin.so
As you can see from the output, Cython generated a C file called pythagorean_triples.c and compiles it a platform-specific .so file, which is the extension module that Python can now import like any other native extension module. 
If you're curious, take a peek at the generated C code. It is very long (2789 lines), obtuse, and contains a lot of extra stuff needed to work with the Python API. Let's drop the pyximport and run our program again:
import time import pythagorean_triples def main(): start = time.time() result = pythagorean_triples.count(1000) duration = time.time() - start print(result, duration) if __name__ == '__main__': main() 881 9.507064819335938
The result is pretty much the same as with pyximport. However, note that I'm measuring only the runtime of the cythonized code. I'm not measuring how long it takes pyximport to compile the cythonized code on the fly. In big programs, this can be significant.
Adding Types to Your Code
Let's take it to the next level. Cython is more than Python and adds optional typing. Here, I just define all the variables as integers, and the performance skyrockets:
# pythagorean_triples.pyx def count(limit): cdef int result = 0 cdef int a = 0 cdef int b = 0 cdef int c = 0 for a in range(1, limit + 1): for b in range(a + 1, limit + 1): for c in range(b + 1, limit + 1): if c * c > a * a + b * b: break if c * c == (a * a + b * b): result += 1 return result ---------- # main.py import time import pyximport; pyximport.install() import pythagorean_triples def main(): start = time.time() result = pythagorean_triples.count(1000) duration = time.time() - start print(result, duration) if __name__ == '__main__': main() Output: 881 0.056414127349853516
Yes. That's correct. By defining a couple of integers, the program runs in less than 57 milliseconds, compared to more than 13 seconds with pure Python. That's almost a 250X improvement.
Profiling Your Code
I used Python's time module, which measures wall time and is pretty good most of the time. If you want more precise timing of small code fragments, consider using the timeit module. Here is how to measure the performance of the code using timeit:
>>> import timeit >>> timeit.timeit('count(1000)', setup='from pythagorean_triples import count', number=1) 0.05357028398429975 # Running 10 times >>> timeit.timeit('count(1000)', setup='from pythagorean_triples import count', number=10) 0.5446877249924
The timeit() function takes a statement to execute, a setup code that is not measured, and the number of times to execute the measured code.
Advanced Topics
I just scratched the surface here. You can do a lot more with Cython. Here are a few topics that can further improve the performance of your code or allow Cython to integrate with other environments:
calling C code
interacting with the Python C API and the GIL
using C++ in Python
porting Cython code to PyPY
using parallelism
Cython and NumPy
sharing declarations between Cython modules
Conclusion
Cython can produce two orders of magnitude of performance improvement for very little effort. If you develop non-trivial software in Python, Cython is a no-brainer. It has very little overhead, and you can introduce it gradually to your codebase.
Additionally, don’t hesitate to see what we have available for sale and for study in the marketplace, and don't hesitate to ask any questions and provide your valuable feedback using the feed below.
by Gigi Sayfan via Envato Tuts+ Code http://ift.tt/2gDF5W5
15 notes · View notes
gottagobackintime · 8 years ago
Note
3, 11, 30 for the identity ask.
Thank you :D
3. List your fandoms and one character from each that you identify with.So it’s obviously not all of my fandoms because some I don’t have a character that I particularly identify with. Anyway here goes:
MCU: Steve Rogers. Sometimes feel out of place and feel like people don’t “get you“ because they don’t know what you’ve been through. I would also protect Bucky Barnes with my life.Atlantis: Pythagoras. The friend that’s always in the background and is clumsy but who is actually capable of great things (omg that sounds like I’m boosting my ego but I hope you know what I mean )Monty Python: Brave Sir Robin. He’s scared of everything but he still tries which I relate to.Cabin Pressure: Martin Crieff. That feeling of being inadequate and trying to do too much to prove that you are capable.  Grantchester: Leonard Finch. That fear of your own feelings, more specifically, acting on those feelings.Sherlock: John Watson. I too am a grumpy bisexual person. No but in all seriousness. Thinking you want one thing and strive after that only to find out that it wasn’t what you were looking for.Downton Abbey: Thomas Barrow. There’s something in him that I connect with but I don’t know exactly what it is. I think it’s the whole ‘putting on a brave face and hiding your true feelings’ thing that I identify with.Call the Midwife: Chummy. Clumsiness. And a general sense of not fitting in, being too loud, being too much me.Not Going Out: Lee. Being in love with someone that you think you can never have and never intend to tell about your feelings. Been there done that. But also the joking as a defence mechanism (yes I went there, I know it’s a comedy but still).Doctor Who: Amy Pond. I too pretend to be super strong all the time and I hide when I’m actually hurt.Star Wars: C-3PO. We both talk far too much about things that doesn’t matter and worry constantly.Harry Potter: Severus Snape. We both were victims of bullying and I do see parts of myself in him. I’ve never forgiven my bullies, while I’m civil if I meet them that underlying hatred is there, always. And I sometimes lie awake and think about who I’d have been if I hadn’t been bullied or if I’d been bullied and didn’t have a supportsystem. He reminds me of what I could become if I let it consume me.Gilmore Girls: Rory Gilmore. I’ve always identified with her (the early pre-Yale seasons). The reading and listening to music instead of having lunch with people you don’t know and don’t want to know could have been taken from my life. And then there’s her family situation (with her grandparents and mother. Not absent father/single mother thing) that too is almost too close to home for me.Coupling: Steve Taylor. I too like to rant about things that upsets me.Grace and Frankie: Sol Bergstein. I know that a lot of people find him annoying but I relate to a lot of the things he does and says. He fears rejection, as do I. He wants people to get along and hates it when people are angry at him. Same here.Whitechapel: Emmerson Kent. I too have a crush on Joseph Chandler. We both just want the approval of the people that matter the most and cries when people are being angry/mean/disappointed. Wow that was kind of sad. I swear that I’m a happy person!
11. Describe your ideal day.Waking up fairly early and being well rested. Lie in bed for an hour with my loved one and our German Shepard. Get up, get breakfast. Pancakes (Swedish pancakes) go to the stable, go for a ride in the woods. Go for a swim in a lake maybe. Get back home, have a nice lunch. Watch a movie, cuddling on the sofa for the rest of the day. I don’t know. Something like that.Anyone up for the task ;P
30. Pick one of your favorite quotes.“Ibland är en lögn det finaste man har” (Sometimes a lie is the most beautiful thing you have)- Håkan Hellström. It’s from a song, I hope that counts!
2 notes · View notes
goldenpythontwins · 29 days ago
Text
Uh, hi, hello. I'm gold pythagoras.
AND IM PYTHON PYTHAGORAS!
I use he/they, and I drew the profile picture and header image.
And I use they/them!
We are in-fact, seperate shapes. And as our blog @ suggests, we are twins.
WOOOOOO THEYRE HERE EVEEYBODY!!!
Hi! Blog runner here! @rocky-clouds!
These two come from the yellow² au, where Gold was born with a twin sibling, Python, who only he could see and hear until entirely post-story. If you ask them the right questions, you might get some key events that set this au apart more than just the twin thing!
Also, as you might have noticed, these two use different typing styles to set them apart.
Gold Pythagoras uses Bold when typing
Python Pythagoras uses italics when typing
Here's python's ref btw:
Tumblr media Tumblr media Tumblr media
2 notes · View notes
goldenpythontwins · 19 days ago
Text
I saw a neat lil beetle today, not one we normally see either!
It was weirdly all grey and also I think the little thing has some strong bite force to it! Put the bug in a makeshift terrarium until I can convince dad to get a proper one.
It's hiding rn so I can't get a picture... neat lil thing though!
0 notes
goldenpythontwins · 22 days ago
Text
Do ya ever think that soulmates are actually real but instead of it being the tree that chose that shape for you it's actually because the magic that makes you and your soulmate up was extremely close to eachother in the beginning of paradise before the trees made everything that it just wants to be together again?
1 note · View note
goldenpythontwins · 23 days ago
Text
To be honest I think it's weird how random shapes I meet immediately assume I'm going to give them something or just from me existing around them that were friends. I know they're doing it to try and seem cool but please. Leave me alone. :[
0 notes
goldenpythontwins · 26 days ago
Text
Being physical is still not fun. I've slammed face-first into like ten fucking walls today because I forgot I can't phase through them any more.
0 notes
goldenpythontwins · 28 days ago
Text
To be honest, I have... no idea who that guy was that accused Gold of being an impersonator was. I think I should've been a little more mad about my brother being accused of being an impersonator when he quite literally isn't impersonating anyone.
I think that random shape might end actually been an impersonator trying to frame my twin. If that was you, and you're reading this, that's not nice!!!! >:[
0 notes
goldenpythontwins · 28 days ago
Text
Gold seemed panicked so I grabbed my guitar and started singing, recorded at some point. Got permission to post it here.
[[A video file. Playing it reveals two shapes, both yellow triangles. The one on the left is Python, playing a guitar. Their eyes are closed. The one of the right is Gold, though he looks different to the one you may know; his lower left leg seems to now be a prosthetic, with pink scarring just above where it's holstered visible, he also seems to have corrupted scarring on his face that resembles freckles. He seems to have been crying, if the red in his eyes is anything to go by. The two of them are singing the end half of Soldier, Poet, King by the Oh Hellos]]
0 notes
goldenpythontwins · 29 days ago
Text
Posted the last thing and immediately slammed face first into a door as it closed. Ow.
1 note · View note
goldenpythontwins · 29 days ago
Text
Being physical is weird. I'm so used to being able to phase through walls because I was just yknow. A soul without a body of its own that happened to be hitchhiking on Gold. So I just. Slam into walls sometimes.
1 note · View note
goldenpythontwins · 29 days ago
Note
HHIIIIII HENLOOOO :3
Oh, uh... hi I guess?
HELLOO!!!!!!!
1 note · View note
goldenpythontwins · 5 days ago
Text
I'm still squinting at these other blogs that I'm very certain are just alternate versions of shapes I and Python know.
Like. The fuck is going on over there.
0 notes