I just realized fhat programming is just all math...

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

I just realized fhat programming is just all math...

Post by davidthefat »

LOL today we learned functions and mapping in Geometry today, and it looked just like C++ functions and arguments...

Geometry/Algebraic Function:
f(x)=3x+10
x = 10

3(10)+10
C++
void function(int x)
{
x = 3 * x + 10;
};


Interesting... :lol: :lol: :lol: :lol:
User avatar
Moosader
Game Developer
Game Developer
Posts: 1081
Joined: Wed May 07, 2008 12:29 am
Current Project: Find out at: http://www.youtube.com/coderrach
Favorite Gaming Platforms: PC, NES, SNES, PS2, PS1, DS, PSP, X360, WII
Programming Language of Choice: C++
Location: Kansas City
Contact:

Re: I just realized fhat programming is just all math...

Post by Moosader »

Was today your first day in Algebra or something? o_O
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: I just realized fhat programming is just all math...

Post by Falco Girgis »

Pre algebra?
User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

Re: I just realized fhat programming is just all math...

Post by davidthefat »

Moosader wrote:Was today your first day in Algebra or something? o_O
Geometry, and last few weeks of it too :lol:
User avatar
Bakkon
Chaos Rift Junior
Chaos Rift Junior
Posts: 384
Joined: Wed May 20, 2009 2:38 pm
Programming Language of Choice: C++
Location: Indiana

Re: I just realized fhat programming is just all math...

Post by Bakkon »

pretty fhat bro
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: I just realized fhat programming is just all math...

Post by K-Bal »

Your function would not make any difference because you don't use a reference or pointer and you are not returning anything ;)
User avatar
LuciDreamTheater
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 39
Joined: Tue Jan 20, 2009 2:18 am
Location: Southern CA
Contact:

Re: I just realized fhat programming is just all math...

Post by LuciDreamTheater »

I just learned about another link between math and programming too:

In my C++ class back in '07, when talking about cin and cout, my professor mentioned something called a source and a sink. Oddly enough, in my vector calculus class, when we talked about vector fields, the terms source and sink were also used. There really is a strong connection between the two fields, probably more than you even realize.
User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

Re: I just realized fhat programming is just all math...

Post by davidthefat »

K-Bal wrote:Your function would not make any difference because you don't use a reference or pointer and you are not returning anything ;)
I thought you dont have to return anything if its void?
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: I just realized fhat programming is just all math...

Post by Falco Girgis »

davidthefat wrote:
K-Bal wrote:Your function would not make any difference because you don't use a reference or pointer and you are not returning anything ;)
I thought you dont have to return anything if its void?
The point is that mathematical functions have return values.

When you graph a function of one variable, you're saying y = f(x). So f(x) must return something.
User avatar
Bakkon
Chaos Rift Junior
Chaos Rift Junior
Posts: 384
Joined: Wed May 20, 2009 2:38 pm
Programming Language of Choice: C++
Location: Indiana

Re: I just realized fhat programming is just all math...

Post by Bakkon »

davidthefat wrote:
K-Bal wrote:Your function would not make any difference because you don't use a reference or pointer and you are not returning anything ;)
I thought you dont have to return anything if its void?
Though it's not a very useful function in it's current state.

Code: Select all

#include <iostream>
using namespace std;

int main()
{
   cout << "Solve for f(x) when x = 5." << endl;
   cout << funcMe(5) << endl;

   return 0;
}

int funcMe(int x)
{
   return 3 * x + 10;
}
K-Bal was saying it would do nothing to the remainder of the program as the solution would disappear after leaving the scope of the function. ;)
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: I just realized fhat programming is just all math...

Post by MarauderIIC »

Yeah I can double-major in CS and math with like three more classes.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Re: I just realized fhat programming is just all math...

Post by dejai »

Kinda off topic but it is so weird to me how yanks call it math. When did you guys drop the plural? Its called Mathematics after all it would sound absurd to call it Mathematic. I suppose its a bit like an conversion from a double to an int you just lose all decimal points.
User avatar
wtetzner
Chaos Rift Regular
Chaos Rift Regular
Posts: 159
Joined: Wed Feb 18, 2009 6:43 pm
Current Project: waterbear, GBA game + editor
Favorite Gaming Platforms: Game Boy Advance
Programming Language of Choice: OCaml
Location: TX
Contact:

Re: I just realized fhat programming is just all math...

Post by wtetzner »

dejai wrote:Kinda off topic but it is so weird to me how yanks call it math. When did you guys drop the plural? Its called Mathematics after all it would sound absurd to call it Mathematic. I suppose its a bit like an conversion from a double to an int you just lose all decimal points.
Hmm, I always thought math was short for mathematics. Mathematic is an adjective, not the singular form of mathematics (http://dictionary.reference.com/browse/mathematic).
The novice realizes that the difference between code and data is trivial. The expert realizes that all code is data. And the true master realizes that all data is code.
User avatar
Bakkon
Chaos Rift Junior
Chaos Rift Junior
Posts: 384
Joined: Wed May 20, 2009 2:38 pm
Programming Language of Choice: C++
Location: Indiana

Re: I just realized fhat programming is just all math...

Post by Bakkon »

dejai wrote:Kinda off topic but it is so weird to me how yanks call it math. When did you guys drop the plural? Its called Mathematics after all it would sound absurd to call it Mathematic. I suppose its a bit like an conversion from a double to an int you just lose all decimal points.
Correct, it is a truncation. But when you truncate, you take off everything at the end, not all but one, right? ;)
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: I just realized fhat programming is just all math...

Post by MarauderIIC »

Except that truncation of a noun is a noun, and truncation of an adjective is an adjective. And since math is a truncation of mathematics, not a truncation of mathematical (mathematic seems to only be a word according to some), it's a noun.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Post Reply