Easy Math Question - SOLVED- thanks

jordank32

Member
Jul 12, 2004
137
0
0
Just trying to develop a quadratic equation from the following:

when x=0, y=0
when x=N, y=0
when x=N/2, y = ymax

I know that I knew how to do this at some point in my life, any help would be much appreciated, thanks.
 

jordank32

Member
Jul 12, 2004
137
0
0
ymax is just any constant.
assuming that the constant ymax is given, i need an equation for y in terms of x and ymax that satisfies those requirements. It will be a continuous equation but I will only be looking at the range x=0 to x=N
 

jordank32

Member
Jul 12, 2004
137
0
0
But I need an equation for y in terms of x and ymax.

-x(x-N)=0 has neither a y or a ymax in it. thanks though
 

ArmenK

Golden Member
Oct 16, 2000
1,600
1
0
Originally posted by: jordank32
But I need an equation for y in terms of x and ymax.

-x(x-N)=0 has neither a y or a ymax in it. thanks though

Oops. Here you go:

y=-x(x-N)=Nx-x^2

ymax is determined by N: -(N/2)(N/2-N)=(N^2)/4
 

jordank32

Member
Jul 12, 2004
137
0
0
Thanks, but isn't there a way where I can specify what ymax is? I do not want ymax to be (N^2)/4. I want to somehow include ymax in the equation so I can pick what the ymax value will be. Is this not possible?
 

ArmenK

Golden Member
Oct 16, 2000
1,600
1
0
Originally posted by: jordank32
Thanks, but isn't there a way where I can specify what ymax is? I do not want ymax to be (N^2)/4. I want to somehow include ymax in the equation so I can pick what the ymax value will be. Is this not possible?


What you could do try is:

y-((N^2)/4)+ymax=-x(x-N)=Nx-x^2

that way you subtract off the max which puts the peak at 0, then add on whatver ymax you want

I think that should work
 

jordank32

Member
Jul 12, 2004
137
0
0
that almost does the trick, however, doing that makes it so that y does not equal 0 when x=0 and x=N, any other ideas? thanks for all of your help
 

RaynorWolfcastle

Diamond Member
Feb 8, 2001
8,968
16
81
for a quadratic eq
f(x) = Ax^2 + Bx + C
f'(x) = 2Ax + B
f''(x) = 2A

rewrite your constraints as
f(0) = 0
f(N) = 0
f'(N/2) = 0

solve for A, B, and C using these constraints
 

ChuckHsiao

Member
Apr 22, 2005
157
0
0
1. y(x=0) = 0
2. y(x=N) = 0
3. y(x=N/2) = ymax (ymin, it doesn't really matter, it's just a variable name)

Quadratic equations take the form of y = ax^2 + bx + c, where a, b, and c are constants to be determined. There are three equations, and three unknowns, so this is (should be "technically", cuz not always) solvable. To do so, just plug them in one by one:

1. 0 = a*0 + b*0 + c => c = 0
2. 0 = a*N^2 + b*N => a*N^2 = -b*N => a*N = -b
3. ymax = (a*N^2)/4 + b*N/2 = -b*N/4 + b*N/2 = b*N/4, so ymax = b*N/4 => b = 4*ymax/N
Plugging in with the above (last part of #2), a = -4*ymax/N^2
Thus, the final solution is y = -4*ymax*(x/N)^2 + 4*ymax*x/N


Note that once you knew that c = 0 via condition 1, you could reduce this down to the more intuitive y = ax*(x+b) form. In this case, you get:
2. 0 = aN*(N+b) => a = 0 and/or b = -N
3. ymax = aN/2 * (N/2 + b) => a is NOT 0 (unless ymax = 0, in which case the whole equation is y = 0), so you know that b = -N
Plugging this in, ymax = aN/2 * (N/2-N) = aN/2*(-N/2) => ymax = -a*(N/2)^2 => a = -4*ymax/(N^2)
Thus it's y = -4*ymax*x/(N^2) * (x-N)

You can expand this out to see that both are equivalent.

Chuck Hsiao
Amptron
 

ChuckHsiao

Member
Apr 22, 2005
157
0
0
Wow 8 posts while I was writing my reply, with multiple ones answering it. Boooooooo. I'm too slow.

Chuck Hsiao
Amptron
 

jordank32

Member
Jul 12, 2004
137
0
0
thanks Chuck, one quick question, your second formulation gives y = -4*ymax*(x/N)^2 * (x-N) . If this is multiplied out, we get a x^3 term. Is this just a typo? Thanks for your help
 

ChuckHsiao

Member
Apr 22, 2005
157
0
0
Yea I was writing it and double-checking that it's equivalent with the above, and stuck the (x/N)^2 there by mistake. Had too much fun sticking x and N in ( ).

Chuck Hsiao
Amptron