algebra

DreamThrall

Newbie
Joined
Oct 14, 2003
Messages
3,483
Reaction score
0
Okay, I'm trying to write this function in JavaScript and I feel like a dolt because I can't figure out the algebraic equation I need to use.

I need to be able to find y if I know what both x and n are. I know there's an equation or some sort of parabolic function or whatever, but I can't for the life of me remember what it is. Help!

y = (x * 1) + (x * 2) + (x * 3) + (x * n)...
 
If you know what 'x' and 'n' are... replace the values? :o
 
no, because (x * n) will be added n number of times ... the "..." after the function means that it keeps repeating as demonstrated with "n"


so for example:

when n =
1: y = (x * 1)
2: y = (x * 1) + (x * 2)
3: y = (x * 1) + (x * 2) + (x * 3)
4: y = (x * 1) + (x * 2) + (x * 3) + (x * 4)
5: y = (x * 1) + (x * 2) + (x * 3) + (x * 4) + (x * 5)

and so on.
 
okay I'm dumb and just had to think about it...

y = (x * n) * (x * n)

this had been bugging me for like a week... oy.
 
No, it should be y = x*(n+1)*n/2
 
that doesn't return the value I need though, and function I wrote above does...
 
Back
Top