« first day (3845 days earlier)      last day (1332 days later) » 
00:00 - 18:0018:00 - 23:00

Anonymous
00:07
I need a program that should listen and write via Bluetooth to an mobile app, I also need a serial communication that talks to an Arduino. Bott är in separate loops. How should I process these two at the same time, including make them communicate?
Anonymous
Any tips?
Anonymous
00:37
Both are in*
00:51
@CoolCloud nice ;) for the 69 lines
Yea, I edited that in jus for all the nice's :p
your school has good team names, my school used to go with red blue -_-
At line number 93 pastebin.com/asuAaWJF here, I am getting an error IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed, I tried passing only the index, then just the element and I am not able to figure out why am I still getting that error, can someone help out here?
@Warcaith not sure if this will be helpful but if you need "same time" then you need to look at multithreading or multiprocessing in python
nvm solved
 
2 hours later…
02:56
@roganjosh JARs are pretty common in the Java world.
I'm only vaguely familiar with Spring
 
4 hours later…
06:57
@Warcaith One possible architecture: your main program should start two threads, passing them Queue.queue objects through which they can communicate in a synchronised fashion.
07:07
Hi, I am trying to get mean value from transposed data frame. But it throws key error. Does anyone know why it is so ?
@YatShan It's hard to debug problems without knowing anything concrete about them. Can you provide a MCVE?
Yes sure
df_dropped_property = df.drop(columns="Property")
df_transposed = df_dropped_property.T
df_transposed.head(); df_transposed["Training_Time"].mean()
Hi, I just came across this issue.. it worked before...
file_loc = 'C:/Users/Desktop/Sem 4/ENGN8601/PythonCode/DataFiles/BOM/'
for year in range(start_year, end_year+1,1):
    for month in range(1,13,1):
        file_loc1 = file_loc + station_number + '/' + station_number + '_' + str(year) + '_' + str(month).zfill(2) + '.csv'
        file = pathlib.Path(file_loc1)
        if file.exists() and file.is_file():
what mistake am i makeing
the path files exist
And the issue you came across is... what?
it just treats it as if the file doesn't exist
07:17
Well, if python says it doesn't exist then I'm sure it doesn't exist.
it works for the second function I made.. I'm not sure what changed.
is it anything to do with the '/' as opposed to '\'
nope, python doesn't care which one of the two you use
Okay, small correction: On Windows, python doesn't care which one you use
@YatShan That's not really complete, so I'm left guessing. Does it by any chance throw a KeyError on the "Training_Time" part? Did you check whether df_transposed is as expected?
@cmk101010 How did you check that? Does the path actually point to a file?
lesson 101, when your mind says something and python says something else - the only way forward is to assume python was right. you need to pretend you could be wrong, and then start investigating. Start printing out the path that's being formed at the end, see if it's correct or not
you can check if path exists with os.path.exists()
07:36
Note by the way that Path objects have a very nice / operator overload that makes path munging much more robust than manually formatting the entire path. Making the initial file_loc a Path allows you to do file_loc1 = file_loc / station_number / f"{station_number}_{year}_{month:>02}.csv" for example.
I found my issue... basically by station number identifier from my csv file had leading zeros and I stored it explicitly as a text
but for some reason it got converted to a number
any fool proof ways to save the leading zeroes?
you already know about zfill. if you want to save leading zeros, make strings with leading zeros
ah, some identifiers have double 0's and some don't//.. I think this is a csv issue
suggestion: do you really need leading zeros? just use the numbers and let all leading zeros go poof
actually i think xlsx saves it without issues.. maybe I use pd.read_excel
07:46
If your format isn't reliable, a simple glob might be more adequate than trying to replicate every error.
no its not my format.. these are the database identifiers used by the meteorology dept
Ah, science...
08:01
oh wow I never knew stack had a chat area. This is amazing aha
@MisterMiyagi Yes I checked df_transposed and it displays the transposed data frame.
Did the column you are trying to get mean for occur as index before? only then would your code work, else try doing df_transposed.loc["Training_Time"].mean() if it were columns before (because transposed)
08:16
@anky Thanks for the tip. The column I am trying to find mean is not indexed.
Sorry I don't follow. Try to create a MCVE
@anky The code that i wrote was
df_transposed = df_dropped_property.T
df_transposed.head(); df_transposed["Training_Time"].mean()
But it throws an error saying 'raise KeyError(key)'
Its hard to say what were your index before transposing or columns after you transpose. You get a key error which means the key you are trying to access isn't available , check if Training_Time is in df_transposed.columns or not
You are correct. The transposed data frame is not showing Training Time as a column. Instead, it lists down 0, 1, 2, 3...
It is the second row of transposed data frame which has the correct column names .
Did you try the loc method I suggested then?
08:30
@anky Yes it didn't work
The second row of the transposed data frame has only column names
The first row has ..0, 1, 2, 3.... values
In this case, do you know how to take the mean value of training time column?
No sorry.. cannot imagine further
I will type the transposed data frame here
08:49
foo = Foo()
foo_command_to_function_call = {
	"start": foo.start,
	"stop": foo.stop,
}
I catch myself writing these kind of dicts which seems like a bad idea tm. But how else do you convert some string which you get over the network to a function call?
Uuuh, is this a sgood idea or whacky?
result = getattr(foo, 'bar')()
getattr seems perfectly fine as long as the object does not have any nasty methods.
09:11
hello, everybody, i have a question that how to reload a so module in python? can Anyone give me any ideas?
it seems that reload does not take effect.
importlib.reload seems to cover this, but note the documented caveats
in many cases, "reloading a module" is not well-defined and it is better to restart the application.
hey, can you help me pls?
```
CONSTRAINTS = []
for x1 in grouped.keys():
        for x2 in grouped[x1]:
            CONSTRAINTS.append(Constraint([str(x1), str(x2)], lambda x: x[str(x1)][0] != x[str(x2)][0]))
```
I have such part in my code. The problem is that function (lambda) always gets the last iteration of the loop. It's similar to javascript's closures. How can I avoid overriding x1 and x2 in python?
@MisterMiyagi Thanks, I'll have a try.
BTW, I just using reload function for test.
@entithat in order to capture by value, bind the variables as arguments: lambda x, x1=x1, x2=x2: x[str(x1)][0] != x[str(x2)][0]
oh, great
yeah. Works fantastic. thanks
 
1 hour later…
10:23
Wonder whether they're planning a remote update to 3.10 ...
Remote?
ah
oh thats dope
cbg
It's probably python 2.1 because old tech is more resilient to conditions in space.
ouch
i was thinking 3.6
Spaaaaace!
10:28
recbg
@Code-Apprentice Indeed. The problem was that the last time my colleague and I made changes to the code, we could press play and run the server inside IntelliJ to test the changes. Since then, the engineer had changed the code in a way that suddenly this broke for both of us and he was off with Covid so there was a lot of fumbling around trying to understand that it was then designed to build JARs
Send NASA a FOIA request asking them for the contents of sys.version
@holdenweb just told our Jr he's doing world class tech. Video processing with FFMPEG too [✓]
@Kevin they should be able to answer in 32 minutes
32 minutes plus the Government Bureaucracy Constant, which is 30 days
Ok, less than that on average. the FOIA website says the 2020 average was "12 working days for simple requests" and "35 working days for complex requests". Is printing one string a simple request or a complex request if the computer is on another planet?
10:36
@Kevin You might find out in 35 working days.
New line added to website, "... And more than 35 days for astronomically complex requests"
they first need to send an auditor to Mars
guys any idea why changing the permissions of the geckodriver on linux would result in a killed process error?
docs.github.com/en/github/… implies that CPython 3.9.2 is involved with the Ingenuity probe, but no firm indication that it's running inside Ingenuity or Perserverance itself
The flight control framework F Prime has a minimum Python requirement of 3.5. If the whole framework gets loaded onto the probe, that means flask is on Mars :-)
Perhaps there's more pressure to use more modern library versions because Ingenuity's primary mission is essentially "generate good PR". "Since Ingenuity is classified as a technology demo, JPL is willing to accept more risk [...] JPL is willing to try new ways of doing things. So we essentially went out and used a lot of off-the-shelf consumer hardware."
Not a good look if NASA says "yeah if you want the same tech stack as us you'll have to go four menus deep into the Python website. The old versions archive is behind the door with the sign saying 'beware of leopard'"
11:02
Cbg, and morning
@Kevin You mean not like what the rest of science still does often?
Bewaring the Leopard is the default state, you need federal funding to do better
Before F Prime's public release it was apparently quite "bespoke", i.e. full of leopards
@CoolCloud I thought you were from India (where it is too late to be morning now)?
@python_user Well I am, but dont live there. And I just woke up now, so it's typically my morning now :p
time is relative after all ;)
11:14
Sure it is :p
 
1 hour later…
12:18
Made things more dry is such a funny git message :)
Hi, all. If I use PyList_New api to creat a list name _list. and then add all kinds of new created python object to the list, if there is any error occured, I should call PY_DECREF to decrease _list's refcount. But how about the objects that I added into _list? should I call PY_DECREF for all the objects which in the _list? if there are some container objects such as other list, set, or dict, should I call PY_DECREF recursively for all the objects?
The rule of thumb is to call PY_DECREF for every PY_INCREF you did before.
If you didn't increment the refcount, it's not your responsibility to decrement it.
The exception being of course APIs that explicitly lift this constraint in their docs.
I was just typing out that rule of thumb. Additionally I suggest testing both ways and seeing which one produces sensible ref counts
I am decently sure, without having looked at the C API lately, is that the list (and set, dict, ...) own their items. It is the container's responsibility to DECREF its items. It is especially not your responsibility to DECREF into recursive containers.
the object in the list '_list' were all create by Pyxxxx_Fromxxx API or PyXXX_New API
12:27
question is how those objects were aded to the list :P
PyList_Append
If the outer object is dict, I used PyDict_SetItem Api to add these objects to the container.
decrefing the list (to 0) should destroy it which should handle decrefing its contents
Refcount tests in numpy work like this: you take the original refcount, do the questionable operation 100 times and then check the final refcount. It should be "close" to the original, say, within 50.
... But even if GVR descended from the clouds on a wingéd chariot and told me it definitely does that, I would still write a test
12:33
ok, thank you all. I'll read these docs carefully.
13:13
It seems that PyList_Append and PyDict_SetItem api will call PY_INCREF internally, so all these objects which added to this two container are managed by the container. So if the contanier I created is out of lify cycle, I just call PY_DECREF for the container, and do not need to call PY_DECREF recursively for the objects which are in the container, is it right?
Sounds right to me. (But write tests anyway)
I will, and thanks again.
that's what we've been saying, yes
13:30
Thank you so much, it's really helped me a lot. ^_^
It's nice stumbling back in here after lunch and seeing yet another wild guess turning out to be helpful. Warms the chicken.
13:59
How is this course about algorithms ? udemy.com/course/…
morning cabbages, folks
Morning
@python_user Curiously, where are you from?
I'm not willing to spend money on a programming resource that doesn't perfectly format its description
"Introduction- Part 2" and "Introduction Part 3": inconsistent use of hyphens, automatic fail
Why yes, this is incredibly petty. I reserve the right to have ludicrous standards when cash is on the line
@Kevin inconsistent—and incorrect!
True that. But let us assume that this is not paid;) What about the course structure? Does it look good
@Kevin Okay that hyphen hit my OCD!!!
14:07
The "Array" lesson collection better not talk about lists, except when describing how lists are not arrays
@Kevin I hope so
Does anyone know a reputed course or something? So that I get a good base in algorithms.
Stack, linked list, tree... Ok, he's covering some of the classics, that's good
He is Indian, so that a plus point right 😛
I'm neutral, but you may have whatever opinion you like
I wonder what "Magic Framework" is. First google hit takes me to Angular's web page.
@Kevin I meant to refer to the joke that "Indian people on youtube teach better"
@Kevin Yea it got me wondering too
14:13
The lessons after that don't look very data structure related IMO, but I guess you can't get mad at a little off-topic bonus content
@CoolCloud TN, India, not the busiest place out there :D
@Kevin Hmmm okay then, I'll give this course a try :D
@AndrasDeak I did notice a small bug here. Once you edit a message and then click the send button, it deletes the message completely. Pressing Enter key after editing works though.
@python_user Thats nice, I am south of you ;)
If I needed to learn about data structures, and if I was a visual learner, and if this cost 0$, and if I didn't see any obvious deal breakers in the first couple reviews... I'd check out a video or two
Cool Cloud you can try the MIT / Harvard Open Courseware, they usually are a lot linear
@Kevin You mean check out 1 or 2 videos from this right? I have it here ready to be played, just wanted to make sure it was worth watching before wasting time
14:17
Yeah
@Kevin Let me give this a try then
@python_user Sure, Ill search for those
they are free but they are taught to actual college students, so it may not be what you want, but MIT algorithm course is on YouTube for anyones viewing
Is there a way to go from one comment to the next in bitbucket? Without having to scroll large amounts of code? Like f7 in pycharm for diffs in files
@CoolCloud the original price (6400 INR) is not something I would pay for any course, its 455 on discount though :D
14:21
@AnushKamble Hi
does anybody know about opencv python
@python_user Udemy courses are expensive. But I am not paying any money here ;)
@python_user Hmmm I guess no harm in trying!
@AnushKamble I have it installed and have gone through one and a half tutorials
@AnushKamble You can ask your doubt/question? If someone know they will surely help :D
@Kevin I once went thru 1/4 course then took a looong break, then had to redo the 1/4 part again then again took a long break xd and then stopped. All because had to no time to focus on school and this work parallelly.
Re: "Indian people on youtube teach better", quite possibly depending on how you measure it. I wouldn't be surprised if the 1% most popular tutorial videos have more Indian authors than any other nationality. Simply because they're the #1 most populous nationality on Youtube, which increases the odds that one Indian supergenius will record the world's best tutorial.
This is true even if programming skill is 100% independent of geography
14:26
Hmmm true
Kevin, you passed 69,420 already?? When was it? Apr 19-24?
I wish I knew, but I wasn't keeping track :-I
Maybe I can figure it out from my activity chart
I mean, I went and checked your reputation list. Seems like somewhere between april 19-24
April 19, if my arithmetic is right
"+15 | 05:41 | accept | Trying to replace a list of strings with another list of strings in a bigger string?" put me from 407 to 422
Not sure if that time is in UTC or not. It may have been 4/20 somewhere B-)
Hmm, I think the math doesn't fall in my favor actually, because both EST and UTC are too close to the international date line
(yes, even though UTC is antipodal to the IDL, it counts as too close. Unless UTC+19 exists, it wasn't 4/20 anywhere)
What does socket.setdefaulttimeout(60) do?
It's used in Python services
Without double checking, I'm going to guess that it makes any socket network request raise an Exception if it goes 60 seconds without getting a ressponse
Or possibly 60 ms
14:42
@Kevin is it needed in services?
If you don't want the requests to hang forever waiting for a response that will never come, then yes
@Kevin what do u mean by "requests"? I'm writing my own service. I don't think anyone would want to send any request to it.
What was if 0 == foo["bar"] called again? I remember I asked here and people didn't like it and gave a good name for this kind of comparison and a nice wikipedia article
@Milad In that case, I recommend not importing socket at all. Then you won't need to set the default timeout, or do anything else with it for that matter
@Hakaishin Yoda condition, I believe
14:46
ah right thanks :)
@Aran-Fey believe well, you do
@Kevin thanks
Ah PR reviews are fun. Checklists are fun :)
Also my raspberry pi camera crashes my nano jetson, which is super weird and now I have to use a serial cable to get the logs, hackermaaaaaan puts on sunglasses
Love to debug on hardware that doesn't have a monitor
user13727121
15:01
Is there a difference between round() and Decimal()? The only difference I notice is that Decimal() returns value in a form of a string while round() returns the same type. Example:
user13727121
from decimal import Decimal

test = 0.2 + 0.69
print(round(test, 2))

test_2 = Decimal('0.2') + Decimal('0.69')
print(test_2)

# Output: 0.89
# Output: Decimal('0.89')
Yes, there is a difference between round and Decimal. round returns a float, and floats cannot exactly represent all numbers with a finite decimal representation, for example 0.01. Decimal can.
It might look like the float value 0.1 is exactly equal to one divided by ten, but in actuality the computer sees it as 0.1000000000000000055511151231257827021181583404541015625. It just doesn't bother to display the entire digit sequence when you print it.
Sometimes when you do arithmetic on floats, it doesn't matter if they're off by point zero zero zero (etc) one. Sometimes you'll get a correct answer anyway -- for example, ten times not-quite-0.1 equals exactly 1. That's because* 1.000000000000000055511151231257827021181583404541015625 also can't be exactly represented by a float, so it rounds to the nearest number that can, which happens to be 1.
@CoreVisional there is a significant difference. See round doesn't return 0.89. Actually it returns
>>> test = round(0.2 + 0.69, 2)
>>> test
0.89
>>> f'{round(test, 2):.64f}';
'0.8900000000000000133226762955018784850835800170898437500000000000'
15:11
(* I don't know the exact specifics of the floating point multiplication algorithm, so I may be oversimplifying)
that's the exact value. So it doesn't really round.
I agree with Antti
Rule of thumb: if you need exact precision while working with numbers that have exactly two digits after the decimal point, either 1) multiply everything by 100 and use ints; 2) use Decimal
round with precision finds the binary number closest to the decimal number for which all fraction digits _after_ the decimal point are zeroes
Change your price_in_dollars = 9.99 to price_in_cents = 999 and save yourself hours of headache later
it cannot in all cases find the binary floating point number that is exactly that number, because it does not exist.
the Python float stringification algorithm tricks you.
it will pick the one number with shortest fractional part that still maps to the same floating point value.
so because 0.89000000000000001332267629550187848508358001708984375 and 0.89 are too precise to be used as floating point values and latter will be rounded to 0.89000000000000001332267629550187848508358001708984375, then from that follows that 0.89000000000000001332267629550187848508358001708984375 will be rounded to 0.89 when converted to a string.
15:19
Among the one hundred numbers between 0 and 1 that have two or fewer digits after the decimal point, only four can be exactly represented as a float: 0.00, 0.25, 0.50, 0.75. All of the others are imprecise.
i.e. only those values that have 2 as the divisor 1 or 2 times.
more exactly only 1/(2^k) where k <= n can be represented in n
frantically takes notes TIL
lies, damned lies, and float!
I wonder how hard it would be to write an illustrative example that performs grade school arithmetic on "reasonable" floats, and produces seemingly incorrect output. Where "reasonable" is any float you can get by writing a literal with an integer part and two digits after a decimal place. e.g. 1.0, 0.33, 1234.56, etc
user13727121
15:31
Holy, this is a lot to digest, but yeah, I'm taking notes too. So in short, use Decimal() if I want my value to be precise, like, the exactness of it, and use round() if I just want to set the number of decimals I want or perform a quick round operation without caring much about the precision of the value?
Bonus points for having a real world application. Multiplying 0.99 by a vigintillion and getting 990000...001 illustrates the problem, but an intermediate programmer is not likely to actually write an application that multiplies by a vigintillion for a practical purpose.
@Kevin Hmmm noice!
@CoreVisional Essentially, yes.
@Aran-Fey That's a nice name
A nice name, that's
15:36
Hmmmm, I wonder what the reason is though
@CoreVisional 1) Don't compare floats using '=='. 2) Use round for pretty display only. 3) To compare floats, use math.isclose, or multiply by 10**(number of digits) and compare as ints. 4) Use Decimal.
user13727121
@AnttiHaapala I'm trying to understand this point. So basically what you're saying is that because 0.89...4375 is too precise to be used as floating-point (so as 0.89), when converted to string, Python just returns 0.89 instead of the exactness of 0.89?
@CoolCloud Guess what the reason is, I cannot possibly.
IDK? Because Yoda is crazy? lol
Oh okay this makes sense
> The name for this programming style is derived from the Star Wars character named Yoda, who speaks English with a non-standard syntax.
Non standard syntax, it is
One of the famous and catchy things I remember Yoda saying is: youtube.com/watch?v=BQ4yd2W50No
Lately I've been selectively employing Yoda conditions if the ordinary style would put a very complicated expression on the left of the "==", and a very simple expression on the right. I find 1 == <500 characters of arithmetic goes here> more digestible than <500 characters of arithmetic goes here> == 1, especially if the line scrolls off the end of my text editor.
15:42
Sometimes its handy
Perhaps this is one of the reasons that PEP 8 recommends not having ridiculously long lines. If I can break the arithmetic down into simpler expressions in multiple statements, I do. Unless it's some "classic" formula like the quadratic formula.
(but even then I may make temporary a, b, c variables for it)
That seems better
The next time I come across a usage that I can't easily refactor, I'll post it in here for everyone to scrutinize
If anyone can find in the transcript the time that I wrote the formula for an ellipse rotated by N degrees, now there's a nasty expression that doesn't split up into meaningful segments
You can divide it into arbitrary segments, but it displeases me
@Kevin Sure, lol
@Kevin I've found that this works better for asserts also - unittest (and to a lesser degree pytest) will format error diagnostics assuming that the values are given as expected_value == observed_result, so assert 1 == len(list_with_expected_length_of_1) or the unittest form assertEqual(1, len(etc.)) will give better messages when the test fails.
15:49
Mm hmm, and you're allowed to get weird with asserts because they're not "real" code. </half serious>
@Kevin you mean like 0.1 + 0.2 == 0.3?
user13727121
@PaulMcG If you don't mind, may I have an example regarding rule 3 of multiplying the value by 10**(number of digits) and then compare it as ints? I tried to create an example out of it but it returns a bool instead. Many of the posts used abs()
user13727121
or did I do it correctly: 0.1 + 0.2 * 10 ** 2 == 20.1
>>> a = 0.1 * 3
>>> b = 0.3
>>> a == b
False
>>> # compare to 2 decimal places
>>> int(a*100) == int(b*100)
True
15:55
@CoreVisional what do you think the point of that would be?
@PaulMcG you mean round(), right?
Note that this truncates - Kevin's suggestion will do this for you implicitly, by having you work with cents instead of dollars.
Except that gets back to the original issue, that round returns a float, not an int.
@PaulMcG a float containing an int
You should be fine until 1e15 pr something
round with 1 argument returns an int, actually
Whereas "it truncates" implies that 0.3-eps and 0.3+eps compare as unequal
Hmm, I'll award a 95% to 0.1*3 == 0.3 since it quickly prompts a "wait, what?" in readers not acquainted with our secret ways. 96-100% is reserved for snippets that do simple arithmetic and the final print(round(reasonable_float, 2)) produces an obviously wrong answer
print(round(0.3 - 0.1*3, 2)) prints -0.0, which is... Weird, but not obviously wrong.
>>> world_gdp = 87_550_000_000_000.00
>>> x = world_gdp + 0.01
>>> y = x - world_gdp
>>> print(round(y,2))
0.02
16:08
@Aran-Fey Unexpected, to get different return types depending on the input args. Would generally lose points in API Design class, but in terms of what people actually want to use it for, probably the correct choice 99% of the time
>>> a
0.30000000000000004
>>> round(a)
0
>>> round(a, None)
0
>>> round(a, 0)
0.0
Something like this. Although I'm hard-pressed to think of a practical reason to add and immediately subtract the world gdp to/from one penny.
@CoreVisional exact opposite :P
Oh hey, there's an example of a builtin function whose return type depends on its arguments. I wondered if there were any, when we were talking the other day about possible feature enhancements to max, for example returning a list of ties
user13727121
man floating-point is a little complex than I thought it'd be ...
floats are complex as heck
16:10
cbg
@CoreVisional actually floats are simple.
they're just binary numbers with binary rounding
they're complex only because you're so accustomed to decimal numbers.
hm, no kevin im not satisfied with an int vs float :P
zero = 0.3 - 3*0.1
nan = zero/zero
print(round(nan, 2))
"Floats are simple [if you're Antti]" ;-) ;-) ;-)
@Kevin It's more accurate to say "complex are floats as heck"
16:12
@CoreVisional It's not just you. See this in the Python docs: docs.python.org/3/tutorial/floatingpoint.html#tut-fp-issues
complexes are exactly twice as floaty as floats
@PaulMcG What's your favorite piano song to play?
And yes, that's 2x, not 2.00000000000013322676295501878485083x
@CupOfJava Bethena, but I am way out of practice. Also, Maple Leaf Rag.
@CoreVisional decimal fraction [0, 1) is precise in n digits if it is form Σ ci * 10^(1/i) for i going from 1 to n and 0 <= ci < 10
16:15
>>> complex(float("nan"),float("nan"))
(nan+nanj)
Hmm, I didn't know it worked with notNumbers.
@Kevin now if only python used i instead of j for complex numbers.
a binary number is the same: Σ ci * 10^(1/i) for i going from 1 to n and 0 <= ci < 10, but with 10 being binary 10, i.e. 2 :D
I spot a glitch in the matrix
@ParitoshSingh True, I was disappointed that I could not get it to print "nani"
@ParitoshSingh it was me who accidentally reloaded the page
@Kevin because i is a number and nan is not.
16:17
nanj is a... I don't know what it is
It requires infinite imagination
@PaulMcG Interesting! I was thinking about if I knew any ragtime music and I think the only song I can play of that style is the entertainer. That's probably only because of how popular it is. I enjoy the style, I wish I had time to practice it more.
@CoreVisional consider this. 0.3 is exact because it is a finite fraction. 0.333333333333333333333333333333333333333333333333333333333333333333333333... is infinite repeating fraction, it means it is a rational number but you cannot represent it exactly in 15 digits.
While engaged in an anime-style battle with my opponent, I teleport behind him.
"How is this possible?", he asks.
"With quaternion magic, I can take one infinitely long step into the complex plane, and then one step elsewhere into real space"
"nani???"
"... Yes, exactly. Now you're getting it"
only those that are some multiple of 1 divided by a power if ten can be represented in base ten in finite number of digits.
only those that are some multiple of 1 divided by a power of to two can be presented in base two in finite number of digits.
16:23
My non-affine transformation technique is unbeatable, I'm about to translate the haters six feet under the ground
@Kevin they also work independently
>>> np.complex128(2 + 0j)/0
<ipython-input-345-7e92f5c08f9d>:1: RuntimeWarning: invalid value encountered in cdouble_scalars
  np.complex128(2 + 0j)/0
(inf+nanj)
There are some geometrical applications for representing points at infinity. 3d rendering programs often put light sources there. However, I'm guessing complex can't distinguish inf+j*inf from inf + j*2*inf, which is a meaningful distinction when deducing the angle of light sources.
Yes, because that's not actually a math distinction. It's a hack.
Python devs, please bend over backwards to support my very silly use case
Isn't there a name for a particular kind of non-euclidean geometry where points at infinity aren't hacks? I feel like I've seen that somewhere
Projective plane? Hyperbolic geometry?
Inf is the number of natural numbers. But there are twice as many natural numbers as even positive numbers (give or take). So there must be inf/2 even positive numbers. But if you can divide each even positive number to get every natural number. Therefore inf == inf/2.
16:29
It might be the projective wossname, yeah
Wikipedia article is ringing bells
it's called hyperbolic because you shouldn't take it seriously
@AndrasDeak Now divide by inf, and 1 == 1/2... Hmm, maybe let's not mix numbers and infinity any more.
Or did you mean the other one? It's called projective because it's about what you would like to be true but isn't.
Ah, I'm good at that
user13727121
@AnttiHaapala Sorry for the delayed response, I was going through each replies trying to understand and analyze each given examples. Anyways, if such recursion occurs, I assume I'd need to use int on it, right?
16:32
"[In projective geometry,] Idealized directions are referred to as points at infinity, while idealized horizons are referred to as lines at infinity. In turn, all these lines lie in the plane at infinity. However, infinity is a metric concept, so a purely projective geometry does not single out any points, lines or planes in this regard—those at infinity are treated just like any others. "
This is 99% likely what I was thinking of
@AndrasDeak Can I now argue that all numbers have equal value given that all numbers are greater than an infinite amount of numbers and all numbers are smaller than an infinite amount of numbers? They all have the same relative position on an infinite number line.
@Kevin 1 + 2 + 3... anyone? :)
@CoreVisional yes I guess. Or use decimal
@CupOfJava This is a nice collection. My brother bought me this record when I was learning piano, and I was hooked.
you asked what's the difference between round and Decimal
Decimal does what you'd think it does, and round does something that you wouldn't think it does. In addition round does not round
user13727121
16:40
Alright, thank you guys :D I guess I got some more reading to do now, especially the Python doc which you've linked it to me @AnttiHaapala
If the only thing you get out of this conversation is a vague sense of unease when using floats, then that is a rousing success
:P
@CoreVisional floats are meant for stuff like metres, kilograms, whatever measurements of physical world which you cannot measure exactly, so it doesn't matter if they're not very precise - they're still more precise than your measurements.
Simply knowing which elements of your program are the worst troublemakers, can increase your bug hunting abilities tenfold
user13727121
@Kevin Yes, that and I had alot of "what?.." moments
Understanding that there are things you don't understand, is the next best thing to understanding things
16:43
step 1, never use floats for financial calculations. step 2, realise that everyone uses floats for financial calculations. step 3.. ?? step 4, cry.
@CoreVisional the double precision float is precise enough that you can measure Earth's circumference to nanometre precision.
I am pretty sure whatever the method you're using is not as precise.
also sufficient to count number of microseconds in a century.
Hot take: since the actual buying power of the US dollar constantly fluctuates and can only be measured in hindsight, you may as well go ahead and use floats anyway ;-P
Just make sure to use math.floor and save the extra bits in an off-shore account you have access to.
The Bureau of Weights and Measures needs to define a Bg SI currency unit, and keep the prototype Basket Of Goods in a high security climate controlled vault
"How much to buy the prototype basket of goods?"
"Impossible, it's priceless"
[sirens begin to go off through the compound as money loses all meaning as a concept]
"... I should not have said that"
user13727121
@AnttiHaapala Basically, in terms of preciseness, it's not as precise as I thought it is and double-precision float is sufficient to measure most things?
16:50
physical measurements yes...
eng1: How many digits of pi did you use?
eng2: 16.
eng1: So how come the spacecraft isn't on track? It's off by several tens of metres already, and we just launched.
eng2: Meters?
@CoreVisional when you get to rounding, look up Decimal.quantize.
@PaulMcG Thanks, I'll check it out. :)
17:21
@AnttiHaapala Time observations are being made at much greater resolution nowadays, and exchanges were starting to time events with nanosecond resolutions. Physics also requires supra-53-bit levels of precision in many areas nowadays, I believe.
[financial events, I meant, even back when I worked in fintech four years ago]
I recall a college math course which was basically entirely about how small sources of error in seemingly reasonable inputs can cause huge error in the result
Partial differential equations, I think. We learned a series of increasingly convoluted techniques for predicting at time T the heatmap of a metal plate being warmed from one side
All I remember from 3 months of study is "try doing runge kutta to it"
In our numerical analysis course there were a few entry questions for the exam, a list of about 10 short questions handed out before exam season. One of the questions was "what is Kutta's first name?", because one of the pet peeves of the lecturer was people thinking that "Runge Kutta" is one person. (To this day I know that the gentlemen were called Carl David Tolmé Runge and Martin Wilhelm Kutta.)
17:44
This kind of thing never happened to Einstein and Rosen
Although perhaps the latter was occasionally introduced at parties as Rosenbridge
...bridge parties?
OK, that doesn't work in English
Like the card game? I think I've heard that term before, but it's not common vernacular
duckduckgo concurs, alas
(but yes, like the card game)
Bridge seems quite interesting, from what little I know of it. It's at the top of my list of Old People Activites I want to try, provided both I and civilization continue to exist for long enough
Maybe I should pick up a deck of cards and a beginner's guide now, to keep in my apocalypse kit
Otherwise I'll have to travel through the mad max wasteland to the last existing library and souvenir shop
You can repurpose your 56 nerfiest MtG cards. 52 if bridge doesn't use jokers.
17:58
Let's see, no jokers, just the basic 52
@AndrasDeak I think it would have, if you'd just capitalized "Bridge" tbh. The language would support it, but I don't suppose it'd be common knowledge in the new youth
00:00 - 18:0018:00 - 23:00

« first day (3845 days earlier)      last day (1332 days later) »