Java - interpolacion cuadratica

 
Vista:

interpolacion cuadratica

Publicado por sergio (1 intervención) el 15/03/2017 02:05:30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package interpolacioncuadratica;
 
/**
 *
 * @author sergio 
 */
import java.util.Scanner;
 
public class InterpolacionCuadratica { //interpolacion cuadratica 
 
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
          System.out.println("ingresar el valor de fx2 :");
         double fx2 = input .nextDouble();
          System.out.println("ingresar el valor de fx1 :");
         double fx1 = input .nextDouble();
         System.out.println("ingresar el valor de fx0 :");
         double fx0 = input .nextDouble();
         System.out.println("ingresar el valor de x2 :");
         double x2 = input .nextDouble();
         System.out.println("ingresar el valor de x1 :");
         double x1 = input .nextDouble();
         System.out.println("ingrear el valor de x0 :");
         double x0 = input .nextDouble();
         System.out.println(" ingresar el valor de x :");
         double x = input .nextDouble();
 
         double A = ((fx2-fx1)/(x2-x1)-(fx1-fx0)/(x1-x0))/(x2-x0);
         double R = (fx1-fx0)/(x1-x0);
         double T = x-x0;
         double L = x-x1;
         double resultado1 = (R*T)+fx0;
         double resultado2 = (A*T*L)+resultado1;
         System.out.println("La interpolacion lineal f1x es = " +resultado1);
         System.out.println("La interpolacion cuadratica f2x es = " +resultado2);
 
    }
 
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder