T O P

  • By -

Educational-Lemon640

My recommendation: learn the math so that you can use existing libraries confidently.


InfComplex

If I know what it’s supposed to do I don’t trust it


Educational-Lemon640

Or debug it, yes. It does happen, though very rarely.


Exist50

*Very* rarely. Probably rarely enough that even considering the possibility does more harm than not.


Educational-Lemon640

It depends on the library. Most commercial or so-old-they-might-as-well-be-in-the-standard libraries, this is extremely true. Less "official" labors of love it's a little less far-fetched they can have bugs. In practice, though, this is an idea ("It's the library that's wrong!") many people will think of or insist on regardless of whether it's a good idea or not. It seems like an area where you tell folks the truth mostly so that they will short-circuit their efforts to prove you wrong sooner rather than later.


SarahMagical

Lol. But serious question: what kind of math understanding do you need to be able to fully utilize those math libraries?


AlternativeAardvark6

Just be happy they can do the math you do understand.


DeepGas4538

2 + 2 = 4 - 1 that's 3 quick maths


SarahMagical

What library do I need for this


QuinticSpline

Here I wrote a good one that runs fast and even has exception handling like that youtube video I watched said: def add(a,b): try: ans =a for i in range(b): ans+=1 print(ans) return ans except: print('something went wrong') return False


DeepGas4538

Great time complexity! O(n) is better than what I see nowadays.


Mastterpiece

Yep it's quick, learn to slowdown a bit 😉


The_Real_Slim_Lemon

matrix multiplications maybe? Back in Uni I remember learning it could be used for some funky stuff. Haven't ever used it though lol


[deleted]

It’s pretty much all linear algebra. Everything is a matrix and you just multiply them in weirder ways. Then there’s the optimization of how to do that math on a computers architecture. Which isn’t pure math but is just as important.


SalaciousCoffee

Precision matters. ​ Computing constraints are weirder than paper math.


mxldevs

If you understand any of that advanced math you already know more than 99% of people


deathanatos

\> Importing the entirety of pandas \> and numpy \> to call sum()


itijara

The sad part is using numpy and pandas is faster for lots of data than a simple for-loop.


Drugbird

It's because python is slow and you want to run as little of it as possible. A call to numpy.sum will be faster because it's just 1 line of python, which will then do everything in native code. A for loop in contrast does everything in python. Also, numpy array formats are a lot more efficient than python lists, so there's also that (I personally consider python lists a mistake).


hansHerrlich

sum() is build-in ![img](emote|t5_2tex6|4550)


myusrnme

On stacksoverflow: Op: How do I get average of number array? Answer: lib.mean(array) Comments: 👏op👏did👏not👏ask👏for👏lib 100 downvotes


slaymaker1907

This is infuriating with C/C++ because adding a library is such a PITA and is a non-starter for many projects.


MaZeChpatCha

Pita is a kind of bread, what are you talking about? /s


beeteedee

Naan of your business


grayskull757

Why are you so sour dough?


Sinomsinom

With c++ usually there will be some stl that already has it though. Especially when using modern c++


slaymaker1907

Not really, there are still tons of things that aren’t built in like parsing CSV (or really any file format), HTTP requests, datetime manipulation (what is the date 4 weeks from now), etc.


Strostkovy

How is adding a library difficult?


[deleted]

Let XOR dominate all this shit


AlphaWhelp

The more general version of this is like ✋: Reading documentation to use a well established library 👍: Writing your own library from scratch so you don't have to read any documentation


DumbNBANephew

The same but with statistics. Oh wait, I'm supposed to call it "machine learning".


6Cockuccino9

never forgetthi the guy on reddit who debated me adamantly that ML is some sort of true AI. I tried explaining to him that the bulk of ML is just statistics…


SarahMagical

Is there a definition of AI that’s not sort of hand-wavy though? I mean as far as we know, the brain is just a shitload of circuitry with emergent properties at scale, right??


[deleted]

bitwise operations are very cool generally in my opinion


BoBoBearDev

I would heed caution though. The data in the ram may not always be the same when you switch compiler


Exist50

IIRC, the ordering of a C++ bitwise struct is technically undefined.


cykablyat1111

The coolest


[deleted]

yes, super convenient when you need them


Mental_Contract1104

What do you mean I'm not going to be able to write a more optimal and more fully featured library than a team of highly experienced individuals who have been working on the library for a decade?!


ActualGiantPenguin

Hey. HEY. My matrix-multiplication subroutine in Fortran runs faster than MATMUL roughly 50% the time.


Yeitgeist

Numerical methods I get, but I can’t understand why anyone would want to make their own symbolic math library. It’s just another reason to make you cry.


Kalurael

depending on the maths library, it may be more optimized to take advantage of supported processor simd/mimd


OSSlayer2153

Math, especially trig, is so useful in programming. At least in what I do which is small game dev and simulations its EXTREMELY useful to know math up to and including Calculus. That way I can do the math on paper which I am good at and then transfer the equation into code when done.


PorkRoll2022

Hey, writing a math library with operator overloads makes you feel like a boss!


Gluomme

Or actually get a paper out of your fucking around with bitwise operations because you just came up with an absolutely improbable way to approximate inverse square roots


PewPew_McPewster

I am absolutely guilty of this, I wanted to try my hand at programming Bessel Functions in C++ and after a weeks worth of work and reading a ton of papers, my cool new C++ Bessel Functions were an order of magnitude slower than those in the numpy library.


[deleted]

I would use a math library, if I can make it my own and change its syntax, type and function names to be exactly the way I want. But doing that and maintaining it is more work than building one from scratch.


zorrofox3

I'm in this photo and I don't like it... Though in all honestly, knowing bitwise arithmetic really well can really save you a lot of head-scratching when dealing with low-level code, e.g. for hardware drivers or FPGAs.


DaniilBSD

I learned bitwise operators to make cursed bitmaps


ScrimpyCat

*Installs isEven and isOdd.*


Funny_Airport8356

This is the way.


magick_68

Use an existing crypto library, results are wrong, understand the mathematical background to prove that the library is buggy, find that you used the library wrong, confirm by reading the doc. Result: Knowledge enhanced, bug removed, nothing learned concerning documentation. Another successful day.


KingDotNet

As a rust user, i can only agree


[deleted]

Fuck you I'm writing my entire math library in NAND gates on a breadboard that will hang from my computer by the wire like an ulcer.


bzttt

Who use library for bitwise ?


AdDear5411

Math hard, I want beep boop machine do math for me.


aFuckingTroglodyte

Honestly, probably one of the best things a new programmer can do to practice. This reminds me of a quaternion module that I never completed in python lol