Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
samuel_brierley
Creator
Creator

Peak of a Polynomial Curve

Hi all,

I have a funny feeling this is going to be widely complicated.

I have a scatter graph with a polynomial curve, all i want to do is get the X axis value at the peak of the Polynomial curve and put this number in a text box.

is this possible?

thanks

3 Replies
morganaaron
Specialist
Specialist

Hi Brierley,

What degree is the polynomial? If it's 2nd degree you can use the quadratic formula (one of the options on the curve is to show the equation) inside Qlik to work out the derivatives, then find the halfway point for your X axis that's in between these two values to give you your maximum Y value (which would be your peak).

That can all be coded in Qlik - I can help you with it if it is a 2nd degree - cubed you're getting a bit more complex! The only problem is you'll need to pass the coefficients into variables using input boxes, so partially manual.

There may well also be extensions for this that I'm not aware of.

samuel_brierley
Creator
Creator
Author

Hi Aaron,

that is all very encouraging and yes it is second degree so im glad you are able to help.

I think I understand the the process you are describing and im sure with a quick google i could learn the mathematics required although the problem i envisage is how do i get the equation of the curve into the text box, i think this is what you are suggesting would be the manual part.

morganaaron
Specialist
Specialist

That's correct.

You'll need three variables and one input box to show all 3. You can call them what you like but in standard mathematical notation the 3 coefficients are referred to as A, B and C.

If you tick the "show equation" box on your chart, what you'd then need to do is input the coefficients into each box - A is the coefficient in front of the squared value, B infront of the singular X value and C the last part, so if your equation was:

32x^2 + 15.64x + 3509

You'd type 32 for A, 15.64 for B and 3509 for C.

You then want to set up two textboxes, one to check the result of the discriminant (either google this or ask if you want me to explain) as whether this is negative, positive or 0 will inform how you solve it - if it's negative then it's probably a little difficult to get into here as it involves imaginary numbers for the solution (again google if need be!)

If positive, you'll want to use the quadratic formula (you can create this in Qlik) to return two further variables, and then plug the midway between these two into your formula containing your original A, B and C variables.

That sounds complicated but when you break it down, it's not too bad. If you can't wrap your head around it let me know and I'll send over an app that does it to show you!