Alright so creating some sort of function for random sets of numbers is usually one of my strong points, but this one has me (sort of) stumped. I need to determine y when given x and get the following results:
x | y
======
2 = 25
3 = 20
4 = 15
5 = 10
6 = 5
Here is what I have right now, but there must be a way to simplify it:
y = ( ( x - 1 ) * 25 ) - ( 5 * ( x - 2 ) )
[random]
If I remember correctly I could distribute and simplify ( not really any simpler :P ) it to:
y = (25x - 25) - (5x - 10)
At least I think that's right. (EDIT: Nevermind this doesn't work for anything other than x = 2 lol )
[/random]
The result when x = 1 is irrelevant as 1 will be a special case where y will equal 50. Is my function as simple as it gets or did I miss something?
Simple Algebra Problem
Moderator: Coders of Rage
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Simple Algebra Problem
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: Simple Algebra Problem
It's simple linear equations (Edit: BTW this is crap they're teaching the high math class in MY school -_-'); the equation is:dandymcgee wrote:Alright so creating some sort of function for random sets of numbers is usually one of my strong points, but this one has me (sort of) stumped. I need to determine y when given x and get the following results:
x | y
======
2 = 25
3 = 20
4 = 15
5 = 10
6 = 5
Here is what I have right now, but there must be a way to simplify it:
y = ( ( x - 1 ) * 25 ) - ( 5 * ( x - 2 ) )
[random]
If I remember correctly I could distribute and simplify ( not really any simpler :P ) it to:
y = (25x - 25) - (5x - 10)
At least I think that's right. (EDIT: Nevermind this doesn't work for anything other than x = 2 lol )
[/random]
The result when x = 1 is irrelevant as 1 will be a special case where y will equal 50. Is my function as simple as it gets or did I miss something?
y = 35 - 5x
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
- KuramaYoko10
- Chaos Rift Cool Newbie
- Posts: 55
- Joined: Fri Oct 31, 2008 8:02 pm
Re: Simple Algebra Problem
If the equation you want to simplify is "y = (25x - 25) - (5x - 10)", then you have:
y = 25x - 25 - 5x + 10 //after distributing the - sign on the second parenthesis, then
y = 20x - 15
To check it is right...
x = 2 give y = 25
y =( 20 * 2) - 15
y = 40 - 15
y = 25
So the simplified equation is corect
y = 25x - 25 - 5x + 10 //after distributing the - sign on the second parenthesis, then
y = 20x - 15
To check it is right...
x = 2 give y = 25
y =( 20 * 2) - 15
y = 40 - 15
y = 25
So the simplified equation is corect
I am afraid this is not the right answer then ...Ginto8 wrote:It's simple linear equations (Edit: BTW this is crap they're teaching the high math class in MY school -_-'); the equation is:
y = 35 - 5x
Type a message here!!
[b][color=#BF0000]MarauderIIC[/color][/b] wrote:"Never" is never true in programming.
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Simple Algebra Problem
Haha thanks Ginto works perfectly :PGinto8 wrote: It's simple linear equations (Edit: BTW this is crap they're teaching the high math class in MY school -_-'); the equation is:
y = 35 - 5x
y = -5x + 35
I knew I had to use a negative since they have an inverse relationship.. just didn't know where, how did you do it?
Yeah it only works for x = 2 :P Thanks for trying to help though.KuramaYoko10 wrote: y = 20x - 15
To check it is right...
x = 2 give y = 25
y =( 20 * 2) - 15
y = 40 - 15
y = 25
So the simplified equation is corect
I am afraid this is not the right answer then ...
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: Simple Algebra Problem
I figured out y when x = 1, and x = 0, based on the pattern. At x = 0, y = 35. At x = 1, y = 30. Which meant the equation was y = 35 - x(35 - 5), or y = 35 - 5x. Logic + algebra = awesomeness. =Pdandymcgee wrote:Haha thanks Ginto works perfectly :PGinto8 wrote: It's simple linear equations (Edit: BTW this is crap they're teaching the high math class in MY school -_-'); the equation is:
y = 35 - 5x
y = -5x + 35
I knew I had to use a negative since they have an inverse relationship.. just didn't know where, how did you do it?
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Simple Algebra Problem
You asked ginto how he got it. Here's how I would have simply thought/observed about it:dandymcgee wrote:x | y
======
2 = 25
3 = 20
4 = 15
5 = 10
6 = 5
You're clearly losing 5 every time you increase x, starting from...
(1, 30)
(0, 35)
so
y = -5x + 35
But again if you had extended out to the y-intercept, you would have gotten slope = rise/run = (-5)/(1) = -5, (could have gotten slope w/o y-intercept) y-intercept 35:
y = mx + b
y = -5x + 35
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
- KuramaYoko10
- Chaos Rift Cool Newbie
- Posts: 55
- Joined: Fri Oct 31, 2008 8:02 pm
Re: Simple Algebra Problem
dandymcgee wrote:Haha thanks Ginto works perfectly :PGinto8 wrote: It's simple linear equations (Edit: BTW this is crap they're teaching the high math class in MY school -_-'); the equation is:
y = 35 - 5x
y = -5x + 35
I knew I had to use a negative since they have an inverse relationship.. just didn't know where, how did you do it?
Yeah it only works for x = 2 :P Thanks for trying to help though.KuramaYoko10 wrote: y = 20x - 15
To check it is right...
x = 2 give y = 25
y =( 20 * 2) - 15
y = 40 - 15
y = 25
So the simplified equation is corect
I am afraid this is not the right answer then ...
Sorry about that...
I followed your equation and di just one checking.. the problem foolished me xD
Here is how I would have get:
y - y0 = m(x - x0)
m = deltaY / deltaX
putting the values from your chart in...
y - 25 = -5(x - 2)
y = -5x - 10 + 25
y = 35 - 5x //which certainly works now xD
Sorry again.... take care
Type a message here!!
[b][color=#BF0000]MarauderIIC[/color][/b] wrote:"Never" is never true in programming.
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Simple Algebra Problem
Omg, I'm so stupid. The only reason I didn't think make x = 0 and get the y-intercept is because like I said when x = 1 it's a special case and x will never be equal to 0 ("Why would I plug in a value that will never occur in my program", is how I was thinking). I should have completely set details like that aside when I was finding the equation for the line.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!