• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Easy Math Question - SOLVED- thanks

jordank32

Member
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.
 
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
 
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
 
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?
 
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
 
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
 
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
 
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
 
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
 
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
 
Back
Top