Show newer

@Zest

Yea, the thing to remember about relativity that is really the trippy part is that you arent just seeing things in the past because light takes longer to reach you (though that is how we talk about it)... but rather things far away from you are literally farther back in time.. with lightening we know the lightening hit much sooner than we hear it, and we think the same way about light. But in reality its that time is warped (or at least this is how I think about it, you wont usually hear scientists describe it this way)

Just think about it in simple terms, if im on a planet around a star that goes super nova and my clock was synced with the clock on a spaceship that is 1 light year away.. if i see the star go supernova on 2020 the space ship according to its internal clock (its stationary by the way) will record the event as happening at 2021 because it took a year for the light to get to him. We usually say its just time delay of light propagation as its easier.. but in a sense it literally didnt happen for that guy on the spaceship until 1 year later.

When you think of "what you see is literally the truth" and not just some optical illusion when it comes to special relativity then it all starts to make sense.

Its no different with the other stuff, one could say that time dilation isnt really happening but instead explain it by the fact that its like a doppler effect where things appear slowed only as an optical illusion because the thing is moving away from you as it produces the image so the "video" gets "stretched" out (like it would with sound).. but that isnt really the case, it is **actually** happening... that is true of everything, including simultaneity.

Once you understand all this weird things you see that you want to dismiss as optical illusions are literally real, then it all makes way more sense.

@Science

@Zest

Its actually not that surprising you see this happen every day with other things, you just never see it happen at such short distances (which is only possible due to the high speeds)...

Imagine sound instead of light, which travels slow enough you can actually see the delays and therefore is easier to conceptualize. if you are right in the middle of two lightening strikes then you would hear them at the exact same moment, assuming you only used your hearing and not sight you would assume they were simultanious.

Likewise imagine you are much closer to one than the other, you would hear that one almost immediately and might not hear the other for a few seconds. Even if they happened at the same time it would seem to you, with your different frame of reference, as if they happened at significantly different points in time.

That's all that is happening here, just in a more confusing way because it isnt due to you being in a physically different location but because time and space itself is warped. But in principle its the same thing.

@Science

@freemo @Science woah! but why though? that's actually really perplexing, I don't know of any reason why it would happen that way

@Zest

Its actually not that surprising you see this happen every day with other things, you just never see it happen at such short distances (which is only possible due to the high speeds)...

Imagine sound instead of light, which travels slow enough you can actually see the delays and therefore is easier to conceptualize. if you are right in the middle of two lightening strikes then you would hear them at the exact same moment, assuming you only used your hearing and not sight you would assume they were simultanious.

Likewise imagine you are much closer to one than the other, you would hear that one almost immediately and might not hear the other for a few seconds. Even if they happened at the same time it would seem to you, with your different frame of reference, as if they happened at significantly different points in time.

That's all that is happening here, just in a more confusing way because it isnt due to you being in a physically different location but because time and space itself is warped. But in principle its the same thing.

@Science

@pganssle do you know of any sort of atomic-float or atomic-int implementations, sometimes called thread safe counters?

I am not talking about jsut implementing my own lock around it, thats what I'm about to do. Some languages make the "+=" and "++" operators atomic at a low level so youc an do it without needing to lock and thus getting performance improvements... im not seeing anything like that in python.

@Zest

The idea is called simultaneity. What that means is that two events that appear simultaneously to one observer (in one frame of reference) is not necessarily simultaneous in another frame of reference.

In this case the two events are the closing and re-opening of each of the barn doors. While that occurs simultaneously from the perspective of the barn and the person doing it, from the perspective of the ship they are not. So while the ship's perspective looks like it cant fit into the barn, and in reality it cant fit in the barn from its perspective, it doesnt have to. From the ships perspective the doors are never closed at the same time. one door closes, then opens, then the other door closes and opens, all at the right time to ensure the ship passes through without crashing through a door.

So while from the ships perspective the ship was never enclosed (both doors shut with it inside) in the too-small-to-fit barn, from the barns perspective where it is more than big enough the ship was, in fact, enclosed inside for a moment.

@Science

@Zest

The idea is called simultaneity. What that means is that two events that appear simultaneously to one observer (in one frame of reference) is not necessarily simultaneous in another frame of reference.

In this case the two events are the closing and re-opening of each of the barn doors. While that occurs simultaneously from the perspective of the barn and the person doing it, from the perspective of the ship they are not. So while the ship's perspective looks like it cant fit into the barn, and in reality it cant fit in the barn from its perspective, it doesnt have to. From the ships perspective the doors are never closed at the same time. one door closes, then opens, then the other door closes and opens, all at the right time to ensure the ship passes through without crashing through a door.

So while from the ships perspective the ship was never enclosed (both doors shut with it inside) in the too-small-to-fit barn, from the barns perspective where it is more than big enough the ship was, in fact, enclosed inside for a moment.

@Science

@pganssle It certainly is 90% of why I am critical of the language.. Its also my biggest gripe with haskell... breaking backwards compatibility is one thing I expect my languages not to do and if they do it im very hesitant to use them ever again, at least if its a major break.

@pganssle fair, but then all the more reason that my original assertion that it should have been fixed when they moved to python 3, before all the third party apps were rewritten holds true. Trying to fix it after the case, as I said, is anotehr backwards compatability nightmare by the sound of it.

@Zest

No it is something new we haven't discussed, though not of the same nature as the other things. Basically you are making an assumption that doesn't hold true anymore, but it isnt any sort of "dilation" of anything.

@Science

@pganssle Are you saying the issue is that it would break third party libs (if so i suppose you are also saying that third party libs dont tend to work with non-standard python interpreters either?)?

@Zest

> so, from the ships perspective the barn shrinks, which causes a problem, but from the barns perspective the ship shrinks, which doesn't cause a problem, or if it doesn't fit in the first place solves a problem but not from the ships perspective...

Correct

> if it still works when the ship wouldn't fit normally but does at near light speed than it's not like they compensate for each other right?

There is something that compensates for the problem and makes it a non-issue. but your use of the term "for each other" suggests it is the length of one or the other compensating to make the situation work. That is not the case, the lengths as you and i have described them are correct as is and do not change in any way to resolve this paradox.

> maybe... the ship is shrinking for real but it can't tell from it's own perspective?

Well from the ships perspective it isnt shrinking, the barn is, from the barns perspective the ship is shrinking. Both of these are "real" from that perspective. To the barn the ship is really smaller, literally and truthfully. From the ships perspective the barn is literally shorter.

> I don't know, at this point either a hint or you could tell me because I think that's the best I can do lol

Does that count as a hint or shall I give the answer now?

@Science

@pganssle I wouldnt doubt that the GIL is a non trivial problem to fix, especially after the fact.. But it has been done in non-standard python interpriters and franky when it comes to the developers of core languages I do have an expectation that they be the best and are capable of solving really hard problems. If they werent then the language probably isnt a great language as it wont live up to its potential.

@pganssle

Actually I came up with a rather simple solution early on that does work... it costs me a little in performance but nothing too major and keeps the code elegance I would like.. Im mostly just grumpy that it was needed and that i had to take that performance hit, minor as it is.

My solution was to just write an array caching class that wraps any array-like object and cashes the results so calling the same index a second time doesnt hit the underlying object. I needed a sense of caching anyway even without multiprocessing because the whole architecture is basically a stack of wrapped array-like objects each level doing additional operations (for example one layer when wrapped around an array provides a "view" of the array as its moving average, without itself containing any internal variables, it calculates on the fly and pass through). So even without multi processing there was a need to write a type of wrapper that caches at specific layers because the layer above it might re-read several values many times and dont want to re-calculate every time.

All I did was make it so these caches have a drop-in equivalent that uses shared memory arrays rather than plain arrays when in multithreaded mode and now the whole object can pass across multithreading boundaries without needing any special nonsense. It works well enough for now.

@nate_river

@Zest

I was in exactly your shoes for many years, almost exactly. I had all the basic ideas but they never fit together just right and no one who knew enough came along (until far too late) to help me put the pieces together. I'm glad I could do that for you.

@Science

@pganssle I didnt realize you were an actual python dev... in that case I understand why your earlier response to my statements were taken personally and seen as rude. I apologize for that. As I said i should have kept it to the technicals.

@fluiddyn@pythondevs.social

yes moving to a non-GIL locked python implementation of JITC is being considered. But you have to remember my **entire** code base is pretty much one big cpu limited algo that runs in real time... so if i really had to export the CPU intensive parts outside of python proper then very little of what is left would even be python... Good advice for most apps I am sure, but in this case if that is really the end result then I'd likely be better off just coding in a different language.

> In any case try to share a simple code which has the issues that you talk about, next time!

Since this is algorithmic trading i sadly can not share the code as the algo is top secret due to how successful it has been for me. thankful I am not hitting any issues I cant solve. I have so far been able to see how to use python to solve most of my issues and in doing so have managed to continually improve performance.

My complains are not so much about how/if I can achieve the result I want, its more so that I just do not like the way python makes me do it to get there.

@pganssle

@pganssle Not really forced to use python, no.. there was some pressure to use it simply because there were more python libraries for algorithmic trading (specifically to access the broker APIs themselveS) than other languages.. but if i was really against python that would not have stopped me, especially considering that most of the project is hand rolled anyway (algorithms of my own design).

> I think you may have a better experience if instead of complaining about why it doesn't fit your preconceptions you asked, "How do people do X?" Usually if other people complain, "Oh yeah that's basically impossible", then yeah it's a sore spot

That would depends on the intended goal of complaining... If you are talking about how people might respond to me, then yes, I agree. If i were in a IRC room asking for python help, for example, my tone would be very different and i wouldnt complain so directly. On here however my goal isnt really to get help (though advice and help is always welcome and considered).. its mostly me complaining because it makes me laugh, starts some decent conversations,and it feels good to vent to my friends.

Now if what you mean is that my own mentality might be different if i didnt complain and i might be more productive.. well I'd agree with you if we were talking about an all encompassing mentality. but generally thats not how it tends to play out with me... sure I complain but in the same breath im googling how to do shit in python the right way, looked at 20 different examples, and pulling those that appear most elegant. I've rewritten this code probably 5 times in various ways as I do that. So trust me, while complaining might be off putting to you and others who might be more able or willing to help (and that is an unintended side effect), it isnt really slowing me down when it comes to learning the pythonic way of doing things.

@Zest

This moment right here is what I live for...

Give it time though you will start to have questions againa nd feel like it stops making sense. Dont let that win, you got the idea, it does make sense, and when you realize the "gotchas" it doesnt mean you dont really understand, it just means there are some unusual scenarios that require one other piece of the puzzle to understand and incorperate...

I dont want to break up your tears of joy but take this curve ball (again don't think it means your thinking about it wrong, i promise you aren't), i will give you the answer if you'd like but its kinda the only time piece you haven't considered so worth exploring...

Remember that ship looks short to you and the universe looks short to the ship... so take this class paradox of that scenario and consider how you might resolve it logically... You have a barn that normally is more than large enough to hold the ship. The barn has two huge doors on opposite sides. Normally the ship is small enough to fit inside. Now as a ship flying at 98% the speed of light flys past you and flys through the barn (the doors are initial open) you very quickly in the instant it is inside the barn close both the doors, containing it inside, then open them again before the ship crashes intot he door, and it flys away.

Now because the ship is going 98% the speed of light it is 19.9% its normal length. This isnt a problem because the ship could fit inside at full size anyway. However from the ships perspective the universe is 19.9% shorter and the ship is normal size. So that means from the perspective of the people on the ship the barn is 19.9% its normal length and they should not be able to fit inside it and have both doors closed at the same time. Yet somehow from their perspective it all works out.. how is this possible?

You can also flip this around and presume that at normal lengtht he ship is too big to fit in the barn but when it is traveling at speeds and is 19.9% its normal length it can fit inside just fine, therefore to the stationary person they can still close the doors safely when it is at speed, but couldnt otherwise, and to the ship there is still an apparent paradox (it isnt really but there is something you need to realize to understand why)...

Let me know if you have any ideas as to how this is answered, or if you just want me to answer it for you I Can do that too.

@Science

@freemo @Science oh my god! it all makes sense now I'm actually literally crying thank you so much for explaining all this!

Show older
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.