Procedurally generated polynomial functions

In summary, procedurally generated polynomial functions are mathematical expressions that are created through algorithms or computer programs. They are used in various scientific fields to model and analyze complex systems, generate data for simulations, and solve problems with multiple variables. The advantages of using these functions include their flexibility and efficiency, but they are limited by the accuracy of the algorithms and may not fully capture the complexity of certain systems. While they can provide valuable insights, they cannot replace traditional mathematical models entirely and should be used in conjunction with other techniques.
  • #1
JMS1
10
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
  • #2
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##.
 
  • #3
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.
 
  • #4
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 FactChecker
  • #5
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.
 
  • #6
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?
 
  • #7
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:
  • #8
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.
 

Related to Procedurally generated polynomial functions

What are procedurally generated polynomial functions?

Procedurally generated polynomial functions are mathematical expressions that are created using algorithms or computer programs. They involve variables, constants, and mathematical operations such as addition, subtraction, multiplication, and division.

How are procedurally generated polynomial functions used in science?

Procedurally generated polynomial functions are used in various fields of science, such as physics, biology, and computer science. They are used to model and analyze complex systems, generate data for simulations, and solve problems that involve multiple variables.

What are the advantages of using procedurally generated polynomial functions?

One of the main advantages of using procedurally generated polynomial functions is their flexibility and adaptability. They can be easily adjusted to fit different scenarios and can handle a wide range of variables and parameters. Additionally, they can be generated quickly and efficiently, saving time and resources.

What are some limitations of using procedurally generated polynomial functions?

One limitation of using procedurally generated polynomial functions is that they are only as accurate as the algorithms or programs used to create them. If the algorithms are flawed or the input data is incorrect, the resulting function may not accurately represent the system being studied. Additionally, these functions may not be able to capture the full complexity of certain systems.

Can procedurally generated polynomial functions replace traditional mathematical models?

No, procedurally generated polynomial functions cannot replace traditional mathematical models entirely. While they can provide valuable insights and data, they may not be suitable for all types of systems and may not always be as accurate as traditional models. It is important to use a combination of different modeling techniques and approaches to fully understand and analyze complex systems.

Similar threads

Replies
18
Views
2K
Replies
2
Views
1K
  • General Math
Replies
1
Views
742
Replies
4
Views
466
Replies
3
Views
785
Replies
2
Views
297
Replies
3
Views
1K
Replies
1
Views
742
Replies
5
Views
725
Replies
1
Views
821
Back
Top