|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.brusoftware.plot4j.Graph
com.brusoftware.plot4j.FunctionGraph
public class FunctionGraph
This class represents the graph of a two-variables function.
To generate the graph, a function must be provided, following the JavaScript syntax and using the Math object. That is:
| CONSTANT | DESCRIPTION |
|---|---|
| Math.E | Returns Euler's number (approx. 2.718) |
| Math.LN2 | Returns the natural logarithm of 2 (approx. 0.693) |
| Math.LN10 | Returns the natural logarithm of 10 (approx. 2.302) |
| Math.LOG2E | Returns the base-2 logarithm of E (approx. 1.442) |
| Math.LOG10E | Returns the base-10 logarithm of E (approx. 0.434) |
| Math.PI | Returns PI (approx. 3.14159) |
| Math.SQRT1_2 | Returns the square root of 1/2 (approx. 0.707) |
| Math.SQRT2 | Returns the square root of 2 (approx. 1.414) |
| METHOD | DESCRIPTION |
|---|---|
| Math.abs(x) | Returns the absolute value of x |
| Math.acos(x) | Returns the arccosine of x, in radians |
| Math.asin(x) | Returns the arcsine of x, in radians |
| Math.atan(x) | Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radians |
| Math.atan2(y,x) | Returns the arctangent of the quotient of its arguments |
| Math.ceil(x) | Returns x, rounded upwards to the nearest integer |
| Math.cos(x) | Returns the cosine of x (x is in radians) |
| Math.exp(x) | Returns the value of Ex |
| Math.floor(x) | Returns x, rounded downwards to the nearest integer |
| Math.log(x) | Returns the natural logarithm (base E) of x |
| Math.max(x,y,z,...,n) | Returns the number with the highest value |
| Math.min(x,y,z,...,n) | Returns the number with the lowest value |
| Math.pow(x,y) | Returns the value of x to the power of y |
| Math.random() | Returns a random number between 0 and 1 |
| Math.round(x) | Rounds x to the nearest integer |
| Math.sin(x) | Returns the sine of x (x is in radians) |
| Math.sqrt(x) | Returns the square root of x |
| Math.tan(x) | Returns the tangent of an angle |
| Constructor Summary | |
|---|---|
FunctionGraph(java.lang.String function,
java.lang.String var_name)
Creates a new FunctionGraph. |
|
| Method Summary | |
|---|---|
java.lang.String |
getFunction()
Returns the function represented by this FunctionGraph. |
int |
getNumOfPoints()
Returns the number of interpolation points. |
void |
setFunction(java.lang.String f)
Sets a new function to this FunctionGraph. |
void |
setNumOfPoints(int n)
Sets the number of interpolation points. |
| Methods inherited from class com.brusoftware.plot4j.Graph |
|---|
getGraphColor, getPoints, setGraphColor |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FunctionGraph(java.lang.String function,
java.lang.String var_name)
function - the function represented by this FunctionGraphvar_name - the name of the free variable (case sensitive)| Method Detail |
|---|
public void setFunction(java.lang.String f)
f - the new functionDiagram.refresh()public java.lang.String getFunction()
public void setNumOfPoints(int n)
throws WrongValueException
n - the number of interpolation points
WrongValueException - if n < 2Graph.getPoints()public int getNumOfPoints()
setNumOfPoints(int),
Graph.getPoints()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||