Добавлена интерполяция для вывода значений в произвольной точке
This commit is contained in:
parent
5cc69a2417
commit
8c5f162cc2
@ -1,5 +1,6 @@
|
|||||||
package com.nummethods.lr5;
|
package com.nummethods.lr5;
|
||||||
|
|
||||||
|
import com.nummethods.lr3.CubicSpline;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
@ -45,7 +46,7 @@ public class LR_5 extends JFrame {
|
|||||||
super("LR_5");
|
super("LR_5");
|
||||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
final Integral integral = var10;
|
final Integral integral = var2;
|
||||||
|
|
||||||
IntegrateMethod runge = new RungeKuttaMethod(integral);
|
IntegrateMethod runge = new RungeKuttaMethod(integral);
|
||||||
System.out.println("Runge-Kutta: " + runge.calculate(integral.getN()));
|
System.out.println("Runge-Kutta: " + runge.calculate(integral.getN()));
|
||||||
@ -96,12 +97,14 @@ public class LR_5 extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private double findPoint(Point2D[] array, double x) {
|
private double findPoint(Point2D[] array, double x) {
|
||||||
for (int i = 0; i < array.length; i++) {
|
CubicSpline spline = new CubicSpline(array);
|
||||||
|
return spline.interpolate(x);
|
||||||
|
/*for (int i = 0; i < array.length; i++) {
|
||||||
double dx = Math.abs( array[i].getX() - x );
|
double dx = Math.abs( array[i].getX() - x );
|
||||||
if (dx < 0.001) {
|
if (dx < 0.001) {
|
||||||
return array[i].getY();
|
return array[i].getY();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user