Add plotting directly from array
This commit is contained in:
parent
193bf13349
commit
c9817662f2
@ -58,7 +58,6 @@ public class Functions {
|
|||||||
/*
|
/*
|
||||||
Math commands
|
Math commands
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Derivative of function with respect to idv
|
// Derivative of function with respect to idv
|
||||||
public String diff(String function, String idv) {
|
public String diff(String function, String idv) {
|
||||||
return util.evaluate("diff(" + function + "," + idv + ")").toString();
|
return util.evaluate("diff(" + function + "," + idv + ")").toString();
|
||||||
@ -87,11 +86,11 @@ public class Functions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double rad(double degrees) {
|
public double rad(double degrees) {
|
||||||
return degrees * (PI/180);
|
return degrees * (PI / 180);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double deg(double radians) {
|
public double deg(double radians) {
|
||||||
return radians * (180/PI);
|
return radians * (180 / PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String sym(String input) {
|
public String sym(String input) {
|
||||||
@ -122,7 +121,6 @@ public class Functions {
|
|||||||
/*
|
/*
|
||||||
Graphing interfaces
|
Graphing interfaces
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void plotrange(double xmin, double xmax) {
|
public void plotrange(double xmin, double xmax) {
|
||||||
graphwin.setRange(xmin, xmax);
|
graphwin.setRange(xmin, xmax);
|
||||||
}
|
}
|
||||||
@ -132,6 +130,14 @@ public class Functions {
|
|||||||
graphwin.graphFunction(function);
|
graphwin.graphFunction(function);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void plot(double[] x, double[] y) {
|
||||||
|
graphwin.plotPoints(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void plot(double[] x, double[] y, String name) {
|
||||||
|
graphwin.plotPoints(x, y, name);
|
||||||
|
}
|
||||||
|
|
||||||
public void plot(String function, double xmin, double xmax) {
|
public void plot(String function, double xmin, double xmax) {
|
||||||
graphwin.setRange(xmin, xmax);
|
graphwin.setRange(xmin, xmax);
|
||||||
plot(function);
|
plot(function);
|
||||||
@ -199,6 +205,7 @@ public class Functions {
|
|||||||
/*
|
/*
|
||||||
Constructor.
|
Constructor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public Functions() {
|
public Functions() {
|
||||||
MainGUI.loadFrame(graphwin, false);
|
MainGUI.loadFrame(graphwin, false);
|
||||||
}
|
}
|
||||||
|
@ -321,6 +321,14 @@ public class Graph extends javax.swing.JInternalFrame {
|
|||||||
private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
|
private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
|
||||||
}//GEN-LAST:event_formComponentShown
|
}//GEN-LAST:event_formComponentShown
|
||||||
|
|
||||||
|
public void plotPoints(double[] x, double[] y) {
|
||||||
|
plotPoints(x, y, "Points");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void plotPoints(double[] x, double[] y, String name) {
|
||||||
|
plot.addLinePlot(name, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the zoom ratio.
|
* Get the zoom ratio.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user