We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,489 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Polynomial interpolation algorithm

I am trying to write an algorithm that finds the Lagrange polynomial given a set of points, in quadratic time.

I don't necessarily want the code to do it, just an explanation on how to write this algorithm in java in quadratic time. I know the equation, its relatively simple, I just have no idea how to represent it in Java.

For example, I know the code must calculate P(x) (for j to N, j != i) = (x - xi)/(xj-xi), and I represent each xi and xj value in an array, but how do I represent the symbol x?

If anyone can provide an explanation on how I can go about this algorithm, or any help whatsoever, it would be greatly appreciated.

Thanks.

Just for clarification, here is a link to the definition of a Lagrange polynomial:
http://en.wikipedia.org/wiki/Lagrange_polynomial

2
Contributors
1
Reply
2 Hours
Discussion Span
2 Years Ago
Last Updated
3
Views
jssutton11
Newbie Poster
6 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Break up the equation into simple binary operations and someone can show you the code.
For example to multiply two variables: var1 * var2

how do I represent the symbol x

A variable named: x would be defined by putting a type in front of the x:
<THE TYPE Here> x;
valid types are: int, short, float, double, .....


If you need help writing a program, have you thought of hiring a programmer?

NormR1
Posting Sage
Team Colleague
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0630 seconds using 2.77MB