Procedurally generated polynomial functions

  • Context: Undergrad 
  • Thread starter Thread starter JMS1
  • Start date Start date
  • Tags Tags
    Functions Polynomial
Click For Summary

Discussion Overview

The discussion focuses on generating polynomial equations based on specified x-intercepts and local maxima, particularly for polynomials of degree 4. Participants explore the challenges of ensuring that the polynomial meets these conditions while maintaining the desired properties of the function.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant proposes starting with a polynomial of degree 4 with fixed x-intercepts at 1 and -1, and discusses how to place a local maximum at various points.
  • Another participant suggests using the general form of a polynomial and formulating conditions based on its derivatives to achieve the desired local maximum.
  • There is a discussion about the implications of adjusting the polynomial to meet the local maximum condition, which can inadvertently alter the x-intercepts.
  • Participants outline specific conditions that must be satisfied by the coefficients of the polynomial to ensure it meets the requirements of having a local maximum at a specified point.
  • One participant raises a question about the number of local maxima that can be specified for each polynomial, noting the degrees of freedom associated with even and odd degree polynomials.

Areas of Agreement / Disagreement

Participants generally agree on the need for specific conditions to define the polynomial, but there are multiple competing views on how to best formulate these conditions and the implications of doing so. The discussion remains unresolved regarding the optimal approach to generating the polynomial while maintaining the desired properties.

Contextual Notes

Participants note that there may be multiple solutions or even none, depending on the constraints set by the local maxima and x-intercepts. The discussion also highlights the complexity introduced when adjusting the polynomial to meet specific conditions.

Who May Find This Useful

This discussion may be useful for programmers, mathematicians, and educators interested in polynomial functions, mathematical modeling, and the application of calculus in generating functions with specific characteristics.

JMS1
Messages
10
Reaction score
0
I'm a programmer looking for a way to create polynomial equations from a list of x intercepts and local maxima.

For the sake of discussion we can begin with a function of degree 4. The scale and position of the curve is unimportant so for simplicity's sake the curve can always have x intercepts at 1 and -1. That leaves the declaration of one local maximum to create a unique equation. If I want that maximum to be (0,0) then the equation takes the form (x-1)(x+1)(x)(x). Moving the maximum along the x-axis is simple. For maximum at (a,0) use the formula (x-1)(x+1)(x-a)(x-a) for any 'a' where 1>a>-1. Creating an equation where the local maximum is on the y-axis is also easy where a maximum at (0,-b) can be given by the equation (x-1)(x+1)(x-bi)(x+bi) for any b where 1>b>0

The problems arise when trying to use a maximum not on a zero axis. for example trying to create a local maximum at (0.2,-0.2) using the equation (x-1)(x+1)(x-.2-.2i)(x-.2+.2i) the local maximum is actually at (0.256,-0.190). Not exactly what I was looking for. So what would be a generalized formula which would give me a local maximum at (a,-b)?
 
Mathematics news on Phys.org
You could operate with ##f(x) = a_n x^n + \dots + a_1x+a_0## instead and formulate your conditions in terms of derivatives of ##f##, i.e. in conditions on the ##a_i##.
 
fresh_42 said:
You could operate with ##f(x) = a_n x^n + \dots + a_1x+a_0## instead and formulate your conditions in terms of derivatives of ##f##, i.e. in conditions on the ##a_i##.
I could, but how?

Taking the example I gave of the function ##f(x)=(x-1)(x+1)(x-.2-.2i)(x-.2+.2i)##, or otherwise written ##f(x)=x^4-.4x^3-.76x^2+.4x-.24##, I get the derrivitive ##f'(x)=4x^3-1.2x^2-1.52x+.4##. taking the value at ##x=.2## I get ##y=.08##. Subtracting this from the derivative I get ##f'(x)=4x^3-1.2x^2-1.52x+.32##. The integral of this is ##f(x)=x^4-.4x^3-.76x^2+.32x##. Evaluating this equation at ##x=.2## I get ##y=.032##. Now subtracting ##.232## from the function I get ##f(x)=x^4-.4x^3-.76x^2+.32x-.232##. Evaluating this function I do indeed have a local maximum at ##(0.2,-0.2)##. However while I've been changing the function to match the local maximum I've managed to move the ##x## intercepts from my standard ##-1, 1##, to ##-0.972, 1.041##.

In the end I've traded one two-dimensional discrepancy for two one-dimensional discrepancies. Calculus may be the way forward with this, but If it is I still don't know how to apply it.
 
Let's gather what you have. You are looking for a polynomial ##f## of ##\deg(f) = 4 \; , \; f(1) = f(-1) = 0 \; , \; f(0.2) = -0.2## and the maximum condition gives ##f'(0.2) = 0## and ##f''(0.2) < 0.##
These conditions on the coefficients ##a_i## of ##f## mean:
##a_0 + a_1 + a_2 + a_3 + a_4 = 0##
##a_0 - a_1 + a_2 - a_3 + a_4 = 0##
##a_0 + a_1 \cdot (0.2)^1 + a_2 \cdot (0.2)^2 + a_3\cdot (0.2)^3 + a_4\cdot (0.2)^4 = -0.2##
##a_1 + 2a_2 \cdot (0.2)^1 + 3a_3\cdot (0.2)^2 + 4a_4\cdot (0.2)^3 = 0##
##a_2 + 3a_3\cdot (0.2)^1 + 6a_4\cdot (0.2)^2 < 0##
Now any solution to these conditions gives you a required polynomial ##f##. In general there can be more than one solution or even none.
 
  • Like
Likes   Reactions: FactChecker
Hey JMS1.

Following on from fresh_42's advice, I'd list the constraints one by one with whatever information you have and then rectify that system.

If you don't have a full rank system then you will get multiple solutions.

Also - are you trying to do anything besides have a maximum at a point along with the intercepts?

If you get an inconsistency then it means you will probably get a function that is inconsistent with the constraints (like how a linear system when row reduced has a bunch of zero's in a row but a non-zero element in the final column). That's how you tell for linear systems but for non-linear you get a complex solution when a consistent one would result in real numbers.
 
JMS1 said:
I'm a programmer looking for a way to create polynomial equations from a list of x intercepts and local maxima.

For the sake of discussion we can begin with a function of degree 4. The scale and position of the curve is unimportant so for simplicity's sake the curve can always have x intercepts at 1 and -1.

How many points specifying local maxima will you have for each polynomial ? - just one given (x=a, y=b = local max) point per polynomial or several?
 
fresh_42 said:
Let's gather what you have. You are looking for a polynomial ##f## of ##\deg(f) = 4 \; , \; f(1) = f(-1) = 0 \; , \; f(0.2) = -0.2## and the maximum condition gives ##f'(0.2) = 0## and ##f''(0.2) < 0.##
These conditions on the coefficients ##a_i## of ##f## mean:
##a_0 + a_1 + a_2 + a_3 + a_4 = 0##
##a_0 - a_1 + a_2 - a_3 + a_4 = 0##
##a_0 + a_1 \cdot (0.2)^1 + a_2 \cdot (0.2)^2 + a_3\cdot (0.2)^3 + a_4\cdot (0.2)^4 = -0.2##
##a_1 + 2a_2 \cdot (0.2)^1 + 3a_3\cdot (0.2)^2 + 4a_4\cdot (0.2)^3 = 0##
##a_2 + 3a_3\cdot (0.2)^1 + 6a_4\cdot (0.2)^2 < 0##
Now any solution to these conditions gives you a required polynomial ##f##. In general there can be more than one solution or even none.

It works!

It looks simple and robust enough to be applied to a general case, thanks.

BTW: for future reference or google searching for help, what would you call this system?
 
Last edited:
Stephen Tashi said:
How many points specifying local maxima will you have for each polynomial ? - just one given (x=a, y=b = local max) point per polynomial or several?
For even polynomials I have ##x## intercepts at ##-1## and ##1##. For odd polynomials I put a double ##x## intercept at ##1## or in other words it's both an ##x## intercept and a zero slope point. . The scalar for the highest order term or ##a_n## is always ##1##. That leaves ##n-2## degrees of freedom for even degree polynomials and ##n-3## degrees of freedom for odd degree polynomials. Each local maximum fixes ##2## degrees of freedom, so for ##n=4## and ##n=5## I need one local maximum. for ##n=6## and ##n=7## I need 2 local maxima, and so on.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
9
Views
4K
  • · Replies 3 ·
Replies
3
Views
1K