Fun
Only logged in members can reply and interact with the post.
Join SimilarWorlds for FREE »

This is why I hate having dyscalculia.

Pi is an irrational number, which means it can’t be expressed as a simple fraction. Therefore, pi has an infinite number of decimal places, but it can be approximated as 22/7, or 3.141.

Who the fvck thinks of numbers as irrational vs rational, are they irrational because the numbers are mad and they're being irrational or what? Then since they're angry, they're a simple fraction (whatever that means) and this irrational behavior leads Pi to suddenly spawning an infinite number of decimal places which make out to be exactly 22 slash 7.

This is how read math concepts as a dyscalculic person.

💁‍♀️

https://realpython.com/python-math-module/
I prefer 355/113 as an approx. of pi.

Why worry about rational numbers? There are good reasons when you are doing long extensive calculations.

If you are writing software that attempts to maintain exact values, then it's very useful to store numbers as lowest terms fractions.

Why would you care about exact values in software? Well, it's like this. Most computers can only compute rapidly with so-called double precision floating point numbers. These are accurate to 16 decimal places (52 bit mantissa), far more than enough accuracy for almost any engineering or scientific calculation.

BUT! when you start chaining calculations together, the last bit can err randomly either high or low. It would be nice if these last-bit errors canceled out, but what they do is a random walk in one bit steps from the true value.

The expected distance of a random walk is the square root of the number of steps. So after 10^10 = 10 billion chained calculations, you can expect to be 10^5 = 100,000 last bit steps from the true value. Your 16 bit accuracy has just dropped to 11 bits. And how long does it take to do 10 billion chained double precision calculations? As little as 3 seconds (with 3Ghz clock; half the time if "fused multiply add" ops are used).

One million seconds is 12 days. So a four day run (not unusual for some calculations) can do 10^16 chained calculations, and the last bit random walk loses you 8 of your original 16 digits of accuracy.

It can get worse, because most big computations are calculating thousands or millions of numbers in parallel. So the worst case random walk can be several times worse than the expected random walk. And some calculations that are not "well conditioned" can magnify the errors far more.

There are ways to estimate whether a calculation is "well conditioned" and for those cases your code might want to use rational number and/or pay the price for simulating higher precision in software.
SatanBurger · 36-40, FVIP
@ElwoodBlues @MethDozer Well that makes me feel a bit better, I just get intimidated at first glance because it sounds confusing when looking ahead at the modules. I got a course that is apparently 200 designed experiments in python to allow me to learn but looking at it I don't understand anything terminology wise and other things. I plan on still learning though... python is kind of the gateway language for a lot of other things and if I can learn it, I feel confident going into other programming concepts.
@SatanBurger The terminology sounds intimidating at first, but there isn't really that much of it, and google can be your friend. You can type "explain difference between function and subroutine" or "explain local variables in python" or whatever.

Another useful thing to know about coding at least for most of us, is that it's a process of managing frustration. It really is. You write a program, try to run it, and it throws some syntax errors. So you fix your typos, and it's still throwing errors. Or maybe it runs but doesn't behave properly. And you realize you have some "think-os" - conceptual errors. Those are the frustrating ones.

And you have to stick with it, re-think parts of your code, print out certain intermediate info to see if it's behaving like you expect. And you have to know when you're spinning your wheels and you should turn your mind away from it for a while. In college, many of my bugs I finally solved by quitting for the night and walking back to my dorm. And with my mind off the problem, suddenly I'd see my mistake.

Managing frustration. We all make lots of programming mistakes, especially in the early days, and they're hard to identify. It can help to be part of a community; to have fellow students to bounce your bugs off of, or a mentor you can turn to in extremis. If there's even 1 other person you can convince to take your course at the same time it can be a big help. I've seen online resources like forums where people can ask for help, but I don't know how good they are.
@SatanBurger

Here's the definition:

irrational
ĭ-răsh′ə-nəl
adjective
Not endowed with reason.
Affected by loss of usual or normal mental clarity; incoherent, as from shock.
Marked by a lack of accord with reason or sound judgment.

You gave *a* definition, not the technical definition in mathematics.

Numbers which can be represented as a ratio (p/q, with p & q both integers) are "rational". Those which cannot be so represented are "not rational" = "irrational".

Any normal integer can be represented as itself over 1:

3 = 3/1 (rational), 7 = 7/1, etc.

Non-repeating decimals are rational:

1.75 = 175/100 = 7/4 (rational)

Even repeating decimals:
_
0.3 = 1/3 (rational)

π is irrational; it is NOT 22/7 OR ANY ratio of two integers. Those are approximations.

 
Post Comment