You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

**kylekatarn****Member**- Registered: 2005-07-24
- Posts: 445

I've been studiying a way of creating a continuous function containing n-given points of the plane. Until now I came with two methods: polinomial and polinomio-trigonometric (a mixed method). But a few days have passed by and every time I look at my solutions I think they are a bit 'heavy' althougth very precise, generalized and clear to understand. I wonder if someone knows more on this subject.

Anyone has ideias on this topic? I leave you with an example:

Find a continuous function that contains the following points

P1(-5;2) P2(3;8) P3(0;0) P4(7;-8) P5(1/2;-5)

(completely random pts)

Any suggestions please add a brief demonstration plz.

Offline

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,608

I think I could fit a polynomial to that, as there are no duplicate x-values. But the polynomial is likely to swing around a lot and also move wildly past the end points.

B-splines can do a neater job, but are not a single "function" as such, they are more like polynomial-segments (I can't remember the details, though)

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman

Offline

**mathsyperson****Moderator**- Registered: 2005-06-22
- Posts: 4,900

Excel says that y=-0.1481x^4+0.6293x³+4.4564x²-12.367x-8^-10, presumably to 5 significant figures each. This is a quartic function, and even though the highest required point is 8, its highest point is almost 50, so as MathsIsFun says, there is probably a better way, involving trigonometry or something.

Why did the vector cross the road?

It wanted to be normal.

Offline

**kylekatarn****Member**- Registered: 2005-07-24
- Posts: 445

Given n points:

P1(x1;y1)

P2(x2;y2)

P3(x3;y3)

.

.

.

Pn(xn;yn)

Polynomial method

--------------------------------------------

My polynomial method consists of solving n equations to n variables (wich isn't very fun when you have 50 pts or more)

For n points, it seems that you only need a polynomial of degree n-1 or lower (I haven't proved it).

y1=a1.x1^(n-1) + a2.x1^(n-2) + a3.x1^(n-3) + ... + a(n-1).x1 + an

y2=a1.x2^(n-1) + a2.x2^(n-2) + a3.x2^(n-3) + ... + a(n-1).x2 + an

y3=a1.x3^(n-1) + a2.x3^(n-2) + a3.x3^(n-3) + ... + a(n-1).x3 + an

.

.

.

yN=a1.xn^(n-1) + a2.xn^(n-2) + a3.xn^(n-3) + ... + a(n-1).xn + an

(Solve for a1,a2,a3,...,a(n-1),an)

Mixed Method

--------------------------------------------

When studying the polinomial method, I came up with an ideia - mixing polynomials with trigonometric (then periodic) functions

*The 'one-point only' case*

We know that cos(0)=1.

If we have one point K(a;1) we can say that the function θ(x)=cos(x-a) contains that point. But what if that abcyss wasn't 1? We could multiply θ(x) for the y-value since θ(a)=1. For K(a;b) we can build the function θ(x)=bcos(x-a) containing the point.

*And what if more points are given?*

We could build separate θ-functions for each point and then find a way to connect all that information into a single equation!

To make things simpler lets consider 3 points.

P1(x1;y1) P2(x2;y2) and P3(x3;y3)

We must find a function , so that P1∈, P2∈ and P3∈. In another way:

(x1)=y1 (x2)=y2 (x3)=y3

Now we build the θ-funcs:

θ1(x)=y1.cos(x-x1)

θ2(x)=y2.cos(x-x2)

θ3(x)=y3.cos(x-x3)

θ1 has the solution for P1. We don't want **θ1** to 'influentiate' **θ2** and **θ3**. So for x=x2 and x=x3, θ1 must be zero.

θ2 has the solution for P2. We don't want **θ2** to 'influentiate' **θ1** and **θ3**. So for x=x1 and x=x3, θ2 must be zero.

θ3 has the solution for P3. We don't want **θ3** to 'influentiate' **θ1** and **θ2**. So for x=x2 and x=x3, θ1 must be zero.

If we have a polynomial with zeros at x2 and x3, we can multipy it by θ1 to assure that θ1 doesn't mess up with the other points

Such polinomial is simple to find P1(x)=(x-x2)(x-x3)

The same applies to θ2 and θ3

P2(x)=(x-x1)(x-x3)

P3(x)=(x-x1)(x-x2)

Multiply now.

θ1(x)P1(x)

θ2(x)P2(x)

θ3(x)P3(x)

Build the function

s(x)=θ1(x)P1(x)+θ2(x)P2(x)+θ3(x)P3(x)

lets analyse it...

s(x1)=θ1(x1)P1(x1)+0+0=θ1(x1)P1(x1)

s(x2)=0+θ2(x2)P2(x2)+0=θ2(x1)P2(x2)

s(x3)=0+0+θ3(x3)P3(x3)

Ok! we are very near!

If we divide each factor for Pj(xj) (to 'undo the effects' of multiplication by the polynomial at that point) we get:

g(x1)=θ1(x1)P1(x1)/P1(x1)=θ1(x1)=(x1)

g(x2)=θ2(x2)P2(x2)/P2(x2)=θ2(x2)=(x2)

g(x3)=θ3(x3)P3(x3)/P3(x3)=θ3(x3)=(x3)

So the function is defined like this:

(x)=θ1(x)P1(x)/P1(x1)+θ2(x)P2(x)/P2(x2)+θ3(x)P3(x)/P3(x3)

where:

θj=yjcos(x-xj)

Pj=(x-x1)(x-x2)(x-x3)/(x-xj)

You can extend this to the number of points you want. But I haven't proved anything. Proofs are welcome : )

And this poly-trig method has some interesting properties like translation and scaling wich I'm researching rigth now.

I hope that's not as hard to understand as it was to explain...

And things sometimes get difficult because English is not my natural language and my level of education is pre-college.

Feel free to make questions,comments,corrections,suggestions,etc..

--------------------------------------------

&btw.. can I post pictures here? it would be a lot easier to show some things I will post in a few days : |

*Last edited by kylekatarn (2005-08-02 03:00:42)*

Offline

**mathsyperson****Moderator**- Registered: 2005-06-22
- Posts: 4,900

You can post pictures here as long as they are viewable somewhere else on the net.

`[img]link to picture[/img]`

If you want to upload images from your computer, I *think* you need to upload them onto another site first and then link to it.

Why did the vector cross the road?

It wanted to be normal.

Offline

Pages: **1**