Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author Tibi
- */
- import java.util.*;
- public class LagrangeInterpolacio extends IllesztettFuggveny {
- LagrangeInterpolacio() {
- super();
- }
- LagrangeInterpolacio( LagrangeInterpolacio obj ) {
- super( obj );
- }
- LagrangeInterpolacio( AdatParok ap ) {
- }
- float ertek( float ertek , AdatParok obj ) {
- float fx = 0;
- for( int i = 0; i < obj.size(); i++ ) {
- float Lg = 1;
- for( int j = 0; j < obj.size(); j++ ) {
- if( i != j ) {
- Lg *= ( ertek - obj.getAdatPar( j ).x ) /
- ( obj.getAdatPar( i ).x - obj.getAdatPar( j ).x );
- }
- }
- fx += Lg * obj.getAdatPar( i ).y;
- }
- return fx;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment