Jump to content

Why is math involved with programming?


Mechagoober

Recommended Posts

Why does my college campus want you to have several calculus classes for computer science? When do you use math when you program? Do you advanced scripts involve math in your scripts? All math talk allowed here

Thanks

 

Most of the math involved with computer science is based on pure mathematics rather than applied math. Such as branches of pure mathematics are  discrete math, graph theory, number theory, combinatoric optimization etc..  which is different than applied mathematics which is along the lines of calculus or algebra. Why? Because any proof of statement is such topics can be programmed. Pure mathematics  is essentially programming but without the language barrier.

 

Most likely like you I am a college student, I finished my freshman year last year and took calc 1-3. It is more or less taught so you have some wiggle room if you change majors. It is also good to know in general for a stem major who will most likely come in contact with calculus in their lifetime. Topics like derivatives and integrals are very good to know as they have many applications.

Edited by Qubit
  • Like 4
Link to comment
Share on other sites

Why does my college campus want you to have several calculus classes for computer science? When do you use math when you program? Do you advanced scripts involve math in your scripts? All math talk allowed here

Thanks

In programming, advanced maths are required in 3D programming (integrals and derivatives). Take the problem of generating an infinite terrain for a 3D game. You can't just open a 3D modeling program like any artist would do and start manually modeling the mesh, instead you will have to write a function that generates blocks of terrains and loads them as the user approaches the end of the current terrain block. Your function will have to generate smooth terrain, height values can't vary too much as that's not going to look real at all. After you generated the mesh it will be time to paint it. That's generally done depending on the value of your height function and its first and second derivatives which provide the slope and convexity of your terrain at a given point.

 

There is another large domain in the IT industry called cryptography which is pretty much all based on maths. It's about the information you send and receive through any network, represented as a sequence of 0's and 1's called codes. These codes all have extra 0's and 1's (extra information) which is not part of the actual data you send or receive, they only provide mechanisms to determine whether the data was successfully transmitted or not and these methods are generally based on matrixes, hence you require algebra.

 

Also if you decide to take a GPU programming course you will be surprised that's all about maths. The GPU programming languages Cg, HLSL, GLSL don't require much programming knowledge but a lot of maths. GPUs differ from CPUs because they are specially designed to perform fast floating point number arithmetic.

 

Maths don't have many applications in scripts but you could try to write a method that generates a "suitable" instant buy price for any item knowing their previous buy/sell/overall prices from online APIs such as osbuddy, the official runescape site or the market price stored in config 1151 when offering the item. A general solution to the "suitable" price problem is one that pays more than any previously recorded prices, is above the market value, has a lower bound dependent on quantity and its monotonicity being characterized by a polynomial function. However it has to provide real prices, not 4m for a 2.3m whip and at the same time offer 500gp for a bread that costs 70gp. So you can actually write it as a derivative polynom instead of just a simple function to provide better results.

  • Like 4
Link to comment
Share on other sites

Math is something you use in every profession no matter what so you're better off learning it. My brother was only required to take calc 1-3 for his major but he sacrificed a summer to take multi-variable calculus. And your look on the daily world completely changes once you learn certain things. 12 times 15 is 12+12+12 etc., or its (12x10)+(12x5).

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...