Class JxnRealArrayAlgebra
- java.lang.Object
-
- JxnRealArrayAlgebra
-
- All Implemented Interfaces:
JxnCloneableAlgebra
public class JxnRealArrayAlgebra extends Object implements JxnCloneableAlgebra
Implementation of an algebra based on an internal arraydouble[] value
. Most of the methods perform element-wise operations on the array elements. Supports mixed operations withdouble
andJxnComplexAlgebra
.
Call one of theplot
methods to visualize the array values as acurve
in aPlotFrame
.
Use classJxnRealArrayTextFileDataSource
to read data values from text files.
-
-
Field Summary
Fields Modifier and Type Field Description protected static double
equalityTolerance
Tolerance forequals
method.protected static boolean
ignoreSurplus
double[]
value
Internal storage.
-
Constructor Summary
Constructors Modifier Constructor Description protected
JxnRealArrayAlgebra()
JxnRealArrayAlgebra(double[] value)
Creates aJxnRealArrayAlgebra
instance from the arrayvalue
.JxnRealArrayAlgebra(double[] value, boolean copyInput)
Creates aJxnRealArrayAlgebra
instance from the arraydouble [] value
.JxnRealArrayAlgebra(double start, double end, double step)
Creates an instance from the given parameters.JxnRealArrayAlgebra(double start, double step, int length)
Creates an instance from the given parameters.JxnRealArrayAlgebra(double uvmin, double uvStep, int nuvSteps, int nvuSteps, int ni)
Deprecated.replaced by classJxnUVGrid
.protected
JxnRealArrayAlgebra(int length)
JxnRealArrayAlgebra(int[] value)
Creates aJxnRealArrayAlgebra
instance from the arrayint[] value
.JxnRealArrayAlgebra(JxnRealArrayAlgebra ra)
Creates a copy ofra
.JxnRealArrayAlgebra(JxnRealArrayAlgebra ra, boolean transfer)
Creates a copy ofra
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static JxnRealArrayAlgebra
abs(JxnRealArrayAlgebra ra)
CallsMath.abs(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
abs(JxnRealArrayAlgebra x, JxnRealArrayAlgebra y)
static JxnRealArrayAlgebra
acos(JxnRealArrayAlgebra ra)
CallsMath.acos(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
acosD(JxnRealArrayAlgebra ra)
CallsMath.acos(double)
and converts the result from radians to degrees for each element of the internal array ofra
.static JxnRealArrayAlgebra
acosh(JxnRealArrayAlgebra ra)
CallsJxnUtilities.acosh(double)
for each element of the internal array ofra
.JxnRealArrayAlgebra
add(double d)
Addsd
to this.static JxnRealArrayAlgebra
add(double d, JxnRealArrayAlgebra ra)
Returnsd + ra
.JxnComplexArrayAlgebra
add(JxnComplexAlgebra cx)
Addscx
to this.JxnRealArrayAlgebra
add(JxnRealArrayAlgebra ra)
Addsra
to this.static JxnRealArrayAlgebra
asin(JxnRealArrayAlgebra ra)
CallsMath.asin(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
asinD(JxnRealArrayAlgebra ra)
CallsMath.asin(double)
and converts the result from radians to degrees for each element of the internal array ofra
.static JxnRealArrayAlgebra
asinh(JxnRealArrayAlgebra ra)
CallsJxnUtilities.asinh(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
atan(JxnRealArrayAlgebra ra)
CallsMath.atan(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
atan2(JxnRealArrayAlgebra y, JxnRealArrayAlgebra x)
static JxnRealArrayAlgebra
atan2D(JxnRealArrayAlgebra y, JxnRealArrayAlgebra x)
CallsMath.atan2
(y
i,x
i)
and converts the result from radians to degrees for each pair of elements of the internal arrays ofy
andx
.static JxnRealArrayAlgebra
atanD(JxnRealArrayAlgebra ra)
CallsMath.atan(double)
and converts the result from radians to degrees for each element of the internal array ofra
.static JxnRealArrayAlgebra
atanh(JxnRealArrayAlgebra ra)
CallsJxnUtilities.atanh(double)
for each element of the internal array ofra
.JxnRealArrayAlgebra
by(int[] index)
Same asbyIndex(int[])
.JxnRealArrayAlgebra
byIndex(int[] index)
Returns a newJxnRealArrayAlgebra
containing the values of this instance at the positions given inindex
.static JxnRealArrayAlgebra
cbrt(JxnRealArrayAlgebra ra)
CallsMath.cbrt(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
ceil(JxnRealArrayAlgebra ra)
CallsMath.ceil(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
clip(JxnRealArrayAlgebra ra, double lower, double upper)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
limitted tolower
andupper
.static JxnRealArrayAlgebra
clip(JxnRealArrayAlgebra ra, int[] iClip)
static JxnRealArrayAlgebra
clip(JxnRealArrayAlgebra ra1, JxnRealArrayAlgebra ra2)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra1
with elements replaced byDouble.NaN
if the respective element inra2
is invalid (NaN or Infinity).static JxnRealArrayAlgebra
clipGE(JxnRealArrayAlgebra ra, double maxValue)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
with elementsvalue[i] >= maxValue
replaced byDouble.NaN
.static JxnRealArrayAlgebra
clipGT(JxnRealArrayAlgebra ra, double maxValue)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
with elementsvalue[i] > maxValue
replaced byDouble.NaN
.static JxnRealArrayAlgebra
clipLE(JxnRealArrayAlgebra ra, double minValue)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
with elementsvalue[i] <= minValue
replaced byDouble.NaN
.static JxnRealArrayAlgebra
clipLT(JxnRealArrayAlgebra ra, double minValue)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
with elementsvalue[i] < minValue
replaced byDouble.NaN
.JxnCloneableAlgebra
cloneThis()
Called internally.static JxnRealArrayAlgebra
concat(JxnRealArrayAlgebra ra1, JxnRealArrayAlgebra ra2)
Returns a newJxnRealArrayAlgebra
which is the concatenation of the elements ofra1
followed byra2
.static JxnRealArrayAlgebra
convolution(JxnRealArrayAlgebra ra, JxnRealArrayAlgebra filter)
Returnsconvolution
( ra, filter, 1 )
.static JxnRealArrayAlgebra
convolution(JxnRealArrayAlgebra ra, JxnRealArrayAlgebra filter, int mode)
Returns the convolution ofra
withfilter
.static JxnRealArrayAlgebra
copySign(JxnRealArrayAlgebra x, JxnRealArrayAlgebra y)
static double
corXY(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry)
Returns the correlation coefficient ofrx
andry
.static JxnRealArrayAlgebra
cos(JxnRealArrayAlgebra ra)
CallsMath.cos(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
cosD(JxnRealArrayAlgebra ra)
CallsMath.cos(double)
for each element of the internal array ofra
after converting the argument from degrees to radians.static JxnRealArrayAlgebra
cosh(JxnRealArrayAlgebra ra)
CallsMath.cosh(double)
for each element of the internal array ofra
.static JxnRealArrayCurve
curve(JxnRealArrayAlgebra ry, Color color)
Returns a curve representation ofry
( xi = i, yi = ry.value[i] ).static JxnRealArrayCurve
curve(JxnRealArrayAlgebra ry, Color color, int lineType)
Seecurve
.static JxnRealArrayCurve
curve(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color)
Returns a curve representation ofrx
andry
( xi = rx.value[i], yi = ry.value[i] ).static JxnRealArrayCurve
curve(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType)
Seecurve
.static JxnRealArrayCurve
curve(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, JxnRealArrayAlgebra rz, IKmg3DProjection p3d)
static JxnRealArrayCurve
curve(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, JxnRealArrayAlgebra rz, IKmg3DProjection p3d, Color color)
static JxnRealArrayCurve
curve(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, JxnRealArrayAlgebra rz, IKmg3DProjection p3d, Color color, int lineType)
Only used for anaglyph stereo.static int[]
cut(JxnRealArrayAlgebra ra)
Returns an int array of the indicesi
of values ofra
with:value[i] > 0.
.static int[]
cut(JxnRealArrayAlgebra ra, double min, double max)
Returns an int array of the indicesi
of values ofra
with:min <= value[i] <= max
.static int[]
cut(JxnRealArrayAlgebra ra, int[] index)
Analyzes the values ofra
only with indices given in arrayindex
and returns an int array of the indicesi
of values with:value[i] > 0.
.static JxnRealArrayAlgebra
derivative(JxnRealArrayAlgebra y)
Returnsderivative
( y, 1. )
.static JxnRealArrayAlgebra
derivative(JxnRealArrayAlgebra y, double dt)
Returns the derivativedy/dt
for equidistant step sizedt
.static JxnRealArrayAlgebra
derivative(JxnRealArrayAlgebra y, JxnRealArrayAlgebra t)
Returns the derivativedy/dt
for the elements of the internal arrays ofy
andt
.JxnRealArrayAlgebra
div(double d)
Divides this byd
.static JxnRealArrayAlgebra
div(double d, JxnRealArrayAlgebra ra)
Returnsd / ra
.JxnComplexArrayAlgebra
div(JxnComplexAlgebra cx)
Divides this bycx
.JxnRealArrayAlgebra
div(JxnRealArrayAlgebra ra)
Divides this byra
.static JxnRealArrayAlgebra
energy(JxnRealArrayAlgebra p, double h)
Returns the integral of a power curve (with e.g.boolean
equals(Object other)
JxnRealArrayAlgebra
objects are equal, if all corresponding array elements are equal.static JxnRealArrayAlgebra
exp(JxnRealArrayAlgebra ra)
CallsMath.exp(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
expm1(JxnRealArrayAlgebra ra)
CallsMath.expm1(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
faltung(JxnRealArrayAlgebra ra, JxnRealArrayAlgebra filter)
Deprecated.static JxnRealArrayAlgebra
faltung(JxnRealArrayAlgebra ra, JxnRealArrayAlgebra filter, int iRand)
Deprecated.double[]
findValue(double value)
Findsvalue
in the internal array.static double[]
findValue(JxnRealArrayAlgebra ra, double value)
Same asra.
findValue(double value)
.static JxnRealArrayAlgebra
floor(JxnRealArrayAlgebra ra)
CallsMath.floor(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
gaussFilter(JxnRealArrayAlgebra t, double bandWidth)
ReturnsgaussFilter
( t, bandWidth, 3. )
.static JxnRealArrayAlgebra
gaussFilter(JxnRealArrayAlgebra t, double bandWidth, double filterWidth)
Creates a gaussFilter forconvolution
.double
get(double x)
Returns a value for positionx
by linear interpolation between the adjacent elements of the internal array of thisJxnRealArrayAlgebra
.double[]
get(double[] da)
Returns an array of values at the positions given inda
by linear interpolation between the adjacent elements of the internal array of thisJxnRealArrayAlgebra
usingget(double x)
.double
get(int i)
Returns the value of thei
-th element of the internal array of thisJxnRealArrayAlgebra
.double[]
get(int[] ia)
Returns an array of the values of the elements of the internal array of thisJxnRealArrayAlgebra
defined by the indices given inia
.JxnRealArrayAlgebra
get(JxnRealArrayAlgebra ra)
Returns aJxnRealArrayAlgebra
of values at the positions given inra
by linear interpolation between the adjacent elements of the internal array of thisJxnRealArrayAlgebra
usingget(double[])
.static JxnRealArrayAlgebra
getCalendarField(JxnRealArrayAlgebra ra, int field)
Returns the result ofgc.get( field )
withgc = new
GregorianCalendar()
for the values of the internal array ofra
interpreted as decimal seconds since 01-Jan-1970 00:00:00 UTC.static int
getCntInvalid(JxnRealArrayAlgebra ra)
Returns the number of invalid (NaN
orInfinitive
) values inra
.static int
getCntNaN(JxnRealArrayAlgebra ra)
Returns the number ofNaN
values inra
.static int
getCntValid(JxnRealArrayAlgebra ra)
Returns the number of valid (neitherNaN
norInfinitive
) values inra
.static JxnRealArrayAlgebra
getDayOfWeek(JxnRealArrayAlgebra ra)
Returns the day of week ( Mo: 1, ...static double
getEqualityTolerance()
Returns the tolerance used for theequals
method.static boolean
getIgnoreSurplus()
ReturnsignoreSurplus
.double[]
getValue()
Returns a reference to the internal array of thisJxnRealArrayAlgebra
.double
getValue(double x)
Returnsget
(x)
.double[]
getValue(double[] da)
Returnsget
(da)
.double
getValue(int i)
Deprecated.Useget
(i)
.static double
getValue(JxnRealArrayAlgebra ra, double x)
static double[]
getValue(JxnRealArrayAlgebra ra, double[] da)
static double
getValue(JxnRealArrayAlgebra ra, int i)
Returns the value of thei
-th element of the internal array ofra
.static JxnRealArrayAlgebra
hypot(JxnRealArrayAlgebra x, JxnRealArrayAlgebra y)
static JxnRealArrayAlgebra
IEEEremainder(double d, JxnRealArrayAlgebra y)
static JxnRealArrayAlgebra
IEEEremainder(JxnRealArrayAlgebra x, double d)
static JxnRealArrayAlgebra
IEEEremainder(JxnRealArrayAlgebra x, JxnRealArrayAlgebra y)
static JxnRealArrayAlgebra
integral(JxnRealArrayAlgebra y)
Returnsintegral
( y, 1. )
.static JxnRealArrayAlgebra
integral(JxnRealArrayAlgebra y, double dt)
Returns the integral ∫y dt
for equidistant step sizedt
.static JxnRealArrayAlgebra
integral(JxnRealArrayAlgebra y, JxnRealArrayAlgebra t)
Returns the integral ∫y dt
for the elements of the internal arrays ofy
andt
.JxnRealArrayAlgebra
inv()
Replaces this by its reciprocal.static int[]
invalid(JxnRealArrayAlgebra ra)
Returns an int array of the indices of values ofra
with invalid (NaN
orInfinitive
) values.static double
korXY(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry)
ReturnscorXY
( rx, ry )
.static int
length(JxnRealArrayAlgebra ra)
Returns the length of the internal array ofra
.static JxnRealArrayAlgebra
limit(JxnRealArrayAlgebra ra, double lower, double upper)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
limitted tolower
andupper
.static JxnRealArrayAlgebra
log(double b, JxnRealArrayAlgebra ra)
Determines the baseb
logarithm of each element of the internal array ofra
.static JxnRealArrayAlgebra
log(JxnRealArrayAlgebra ra)
CallsMath.log(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
log10(JxnRealArrayAlgebra ra)
CallsMath.log10(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
log1p(JxnRealArrayAlgebra ra)
CallsMath.log1p(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
max(double d, JxnRealArrayAlgebra y)
Deprecated.Usemax
( y, d )
.static JxnRealArrayAlgebra
max(JxnRealArrayAlgebra x, double d)
static JxnRealArrayAlgebra
max(JxnRealArrayAlgebra x, JxnRealArrayAlgebra y)
static int
maxIndex(JxnRealArrayAlgebra ra)
Returns the index of the (first) maximum value (including +Infinity) of the internal array ofra
.static double
maxValid(JxnRealArrayAlgebra ra)
Returns the minimum value excluding +Infinity of the internal array ofra
.static double
maxValue(JxnRealArrayAlgebra ra)
Returns the maximum value (including +Infinity) of the internal array ofra
.static JxnRealArrayAlgebra
min(double d, JxnRealArrayAlgebra y)
Deprecated.Usemin
( y, d )
.static JxnRealArrayAlgebra
min(JxnRealArrayAlgebra x, double d)
static JxnRealArrayAlgebra
min(JxnRealArrayAlgebra x, JxnRealArrayAlgebra y)
static int
minIndex(JxnRealArrayAlgebra ra)
Returns the index of the (first) minimum value (including -Infinity) of the internal array ofra
.static double
minValid(JxnRealArrayAlgebra ra)
Returns the minimum value excluding -Infinity of the internal array ofra
.static double
minValue(JxnRealArrayAlgebra ra)
Returns the minimum value (including -Infinity) of the internal array ofra
.static JxnRealArrayAlgebra
modulo(double d, JxnRealArrayAlgebra y)
static JxnRealArrayAlgebra
modulo(JxnRealArrayAlgebra x, double d)
static JxnRealArrayAlgebra
modulo(JxnRealArrayAlgebra x, JxnRealArrayAlgebra y)
JxnRealArrayAlgebra
mul(boolean sw)
Deprecated....static JxnRealArrayAlgebra
mul(boolean sw, JxnRealArrayAlgebra z)
Deprecated....JxnRealArrayAlgebra
mul(double d)
(Post)Multiplies this byd
.static JxnRealArrayAlgebra
mul(double d, JxnRealArrayAlgebra ra)
Returnsd * ra
.JxnComplexArrayAlgebra
mul(JxnComplexAlgebra cx)
(Post)Multiplies this bycx
.JxnRealArrayAlgebra
mul(JxnRealArrayAlgebra ra)
(Post)Multiplies this byra
.JxnRealArrayAlgebra
mulL(double d)
(Pre)Multiplies this byd
.static JxnRealArrayAlgebra
noise(int n)
Returns a newJxnRealArrayAlgebra
withn
random numbers fromrnd.
nextGaussian()
withrnd = new
Random()
.static JxnRealArrayAlgebra
noise(int n, long seed)
Returns a newJxnRealArrayAlgebra
withn
random numbers fromrnd.
nextGaussian()
withrnd = new
Random
(seed)
.static JxnRealArrayAlgebra
noise(JxnRealArrayAlgebra ra)
Returnsnoise(int n)
withn = ra.size()
.static JxnRealArrayAlgebra
noise(JxnRealArrayAlgebra ra, long seed)
Returnsnoise(int n, long seed)
withn = ra.size()
.static JxnRealArrayAlgebra
nonWindupStore(JxnRealArrayAlgebra p, double h, double initial, double lower, double upper)
Returns the integral internally limited tolower
andupper
(non windup limiter) of a power curve.static JxnRealArrayAlgebra
peak(JxnRealArrayAlgebra p, double h)
Determines the peak energy from a power curvep
.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra ry)
Creates a newJxnRealArrayPlotFrame
and visualizes the values ofry
as a curve:
xi = i, yi = ry.value[i], i = 0 ... y.length - 1.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra ry, double ymin, double ymax)
Deprecated.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra ry, Color color, int lineType)
Seeplot
.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry)
Creates a newJxnRealArrayPlotFrame
and visualizes the values ofrx
andry
as a curve:
xi = rx.value[i], yi = ry.value[i], i = 0 ... min( length(rx), length(ry) ) - 1.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, double vyx)
Seeplot
.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, double ymin, double ymax)
Deprecated.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, int logScales)
Seeplot
.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color)
Seeplot
.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, float lineWidth)
Seeplot
.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType)
Seeplot
.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType, double vyx)
Seeplot
.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType, float lineWidth, double vyx)
Seeplot
.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType, float lineWidth, int logScales)
Seeplot
.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType, int logScales)
Seeplot
.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, Stroke stroke)
Seeplot
.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, Stroke stroke, double vyx)
Seeplot
.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, Stroke stroke, int logScales)
Seeplot
.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry1, JxnRealArrayAlgebra ry2)
static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry1, JxnRealArrayAlgebra ry2, double ymin, double ymax)
Deprecated.static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, JxnRealArrayAlgebra rz, IKmg3DProjection p3d)
static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry1, JxnRealArrayAlgebra ry2, JxnRealArrayAlgebra ry3)
static JxnRealArrayPlotFrame
plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry1, JxnRealArrayAlgebra ry2, JxnRealArrayAlgebra ry3, double ymin, double ymax)
Deprecated.JxnRealArrayAlgebra
pow(double exponent)
Replaces this by its power ofexponent
.static JxnRealArrayAlgebra
pow(double d, JxnRealArrayAlgebra exponent)
Returnsd
to the power ofexponent
.JxnRealArrayAlgebra
pow(JxnRealArrayAlgebra exponent)
Replaces this by its power ofexponent
.static double
quadsum(JxnRealArrayAlgebra ra)
Returns the sum of the squares of all elements of the internal array ofra
.static JxnRealArrayAlgebra
random(int n)
static JxnRealArrayAlgebra
random(int n, long seed)
Returns a newJxnRealArrayAlgebra
withn
random numbers fromrnd.
nextDouble()
withrnd = new
Random(seed)
.static JxnRealArrayAlgebra
random(JxnRealArrayAlgebra ra)
Returnsrandom(int n)
withn = ra.size()
.static JxnRealArrayAlgebra
random(JxnRealArrayAlgebra ra, long seed)
Returnsrandom(int n, long seed)
withn = ra.size()
.JxnRealArrayAlgebra
range()
JxnRealArrayAlgebra
range(double start)
Callsrange(int)
withstart
rounded to int.JxnRealArrayAlgebra
range(double start, double end)
JxnRealArrayAlgebra
range(int iStart)
Returns a newJxnRealArrayAlgebra
containinglength(ra)-iStart
values starting from indexiStart
.JxnRealArrayAlgebra
range(int iStart, int iEnd)
Returns a newJxnRealArrayAlgebra
containingiEnd-iStart
values starting from indexiStart
to indexiEnd
(excluding).JxnRealArrayAlgebra
range(String start)
Returns a newJxnRealArrayAlgebra
containing the values of this starting fromstart
given as date time string.JxnRealArrayAlgebra
range(String start, String end)
Returns a newJxnRealArrayAlgebra
containing the values of this starting fromstart
toend
given as date time string.JxnRealArrayAlgebra
range(JxnRealArrayAlgebra ra)
Deprecated.No more supported.JxnRealArrayAlgebra
remainder(double d)
Replaces this bythis % d
.static JxnRealArrayAlgebra
remainder(double d, JxnRealArrayAlgebra ra)
Returnsd % ra
.JxnRealArrayAlgebra
remainder(JxnRealArrayAlgebra ra)
Replaces this bythis % ra
.static JxnRealArrayAlgebra
reverse(JxnRealArrayAlgebra ra)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
in reversed order.static JxnRealArrayAlgebra
rint(JxnRealArrayAlgebra ra)
CallsMath.rint(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
round(JxnRealArrayAlgebra ra)
Commercial rounding of each element of the internal array ofra
.static JxnRealArrayAlgebra
scalb(JxnRealArrayAlgebra ra, int scaleFactor)
CallsMath.scalb(double, int)
for each element of the internal array ofra
.JxnRealArrayAlgebra
set(int i, double vi)
Replaces thei
-th value of thisJxnRealArrayAlgebra
byvi
.static JxnRealArrayAlgebra
set(JxnRealArrayAlgebra ra, int i, double vi)
Returns a copy ofra
, with thei
-th value replaced byvi
.JxnRealArrayAlgebra
setDateTimeValue(boolean isDateTime)
Indicates that this instance represents date time values.static double
setEqualityTolerance(double eps)
Sets tolerance for theequals
method for all instances of this class.static boolean
setIgnoreSurplus(boolean ignore)
Controls if to ignore surplus elements of the longer internal array for methods which expect two instances with equal length internal arrays.JxnRealArrayAlgebra
setName(String name)
Sets a name for this instance (status experimental).static boolean
setNamedResultEnabled(boolean enabled)
Enables the use of name forJxnRealArrayAlgebra
instances (status experimental).JxnRealArrayAlgebra
setTimeFormat(boolean isDateTime)
Deprecated.replaced bysetDateTimeValue(boolean)
.double
setValue(double vi, int i)
Deprecated.replaced bysetValue
( i, vi )
.double
setValue(int i, double vi)
Replaces thei
-th value of thisJxnRealArrayAlgebra
byvi
.static JxnRealArrayAlgebra
setValue(JxnRealArrayAlgebra ra, double vi, int i)
Deprecated.Useset
( ra, i, vi )
.JxnRealArrayAlgebra
shift(int k)
Returns a newJxnRealArrayAlgebra
containing the values of this circularly shifted byk
.static JxnRealArrayAlgebra
shift(JxnRealArrayAlgebra ra, int k)
Returns a newJxnRealArrayAlgebra
containing the values of this shifted byk
filling with0.
.static JxnRealArrayAlgebra
shift(JxnRealArrayAlgebra ra, int k, double d)
Returns a newJxnRealArrayAlgebra
containing the values of this shifted byk
filling withd
.static JxnRealArrayAlgebra
sign(JxnRealArrayAlgebra ra)
Returns a newJxnRealArrayAlgebra
containing the sign of each element of the internal array ofra
.static JxnRealArrayAlgebra
signum(JxnRealArrayAlgebra ra)
CallsMath.signum(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
sin(JxnRealArrayAlgebra ra)
CallsMath.sin(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
sinD(JxnRealArrayAlgebra ra)
CallsMath.sin(double)
for each element of the internal array ofra
after converting the argument from degrees to radians.static JxnRealArrayAlgebra
sinh(JxnRealArrayAlgebra ra)
CallsMath.sinh(double)
for each element of the internal array ofra
.int
size()
Returns the length of the internal array.static JxnRealArrayAlgebra
smoothExp(JxnRealArrayAlgebra x, double alpha)
Returns the resulty
of an exponential smoothing ofx
.static JxnRealArrayAlgebra
sort(JxnRealArrayAlgebra ra)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
sorted in ascending order.static int[]
sortIndex(JxnRealArrayAlgebra ra)
Returns an array of the indices of the values ofra
in ascending order.static JxnRealArrayAlgebra
sqrt(JxnRealArrayAlgebra ra)
CallsMath.sqrt(double)
for each element of the internal array ofra
.JxnRealArrayAlgebra
sub(double d)
Subtractsd
from this.static JxnRealArrayAlgebra
sub(double d, JxnRealArrayAlgebra ra)
Returnsd - ra
.JxnComplexArrayAlgebra
sub(JxnComplexAlgebra cx)
Subtractscx
from this.JxnRealArrayAlgebra
sub(JxnRealArrayAlgebra ra)
Subtractsra
from this.static double
summe(JxnRealArrayAlgebra ra)
Returnstotal
( ra )
.static JxnRealArrayAlgebra
sw(JxnRealArrayAlgebra ra, double lower, double upper)
Deprecated.replaced byclip(JxnRealArrayAlgebra, double, double)
.static JxnRealArrayAlgebra
sw(JxnRealArrayAlgebra x, double lower, double upper, JxnRealArrayAlgebra yLower, JxnRealArrayAlgebra yInner, JxnRealArrayAlgebra yUpper)
Returns values ofyLower
,yInner
oryUpper
depending on the value ofx
.static JxnRealArrayAlgebra
sw(JxnRealArrayAlgebra x, JxnRealArrayAlgebra yLT, JxnRealArrayAlgebra yGE)
Returns values ofyLT
oryGE
depending on the value ofx
.static JxnRealArrayAlgebra
sw(JxnRealArrayAlgebra x, JxnRealArrayAlgebra yLT, JxnRealArrayAlgebra yEQ, JxnRealArrayAlgebra yGT, double eps)
Returns values ofyLT
,yEQ
oryGT
depending on the value ofx
.static JxnRealArrayAlgebra
tan(JxnRealArrayAlgebra ra)
CallsMath.tan(double)
for each element of the internal array ofra
.static JxnRealArrayAlgebra
tanD(JxnRealArrayAlgebra ra)
CallsMath.tan(double)
for each element of the internal array ofra
after converting the argument from degrees to radians.static JxnRealArrayAlgebra
tanh(JxnRealArrayAlgebra ra)
CallsMath.tanh(double)
for each element of the internal array ofra
.double[]
toArray()
Returns a copy of the internal array of thisJxnRealArrayAlgebra
.String
toString()
Formats instance.static double
total(JxnRealArrayAlgebra ra)
Returns the sum of all elements of the internal array ofra
.static int[]
valid(JxnRealArrayAlgebra ra)
Returns an int array of the indices of values ofra
with valid (neitherNaN
norInfinitive
) values.double
valueAt(int i)
Deprecated.Useget
(i)
.static double
valueAt(JxnRealArrayAlgebra ra, int i)
Deprecated.UsegetValue
( ra, i )
.
-
-
-
Field Detail
-
value
public double[] value
Internal storage.
-
equalityTolerance
protected static double equalityTolerance
Tolerance forequals
method.- See Also:
setEqualityTolerance(double)
-
ignoreSurplus
protected static boolean ignoreSurplus
-
-
Constructor Detail
-
JxnRealArrayAlgebra
protected JxnRealArrayAlgebra()
-
JxnRealArrayAlgebra
protected JxnRealArrayAlgebra(int length)
-
JxnRealArrayAlgebra
public JxnRealArrayAlgebra(double[] value)
Creates aJxnRealArrayAlgebra
instance from the arrayvalue
. CallsJxnRealArrayAlgebra( value, false )
.
Note: This constructor exists for performance and memory reasons and stores a reference tovalue
as the internal array representation. Consequently modifications of the array elements ofvalue
modify the JxnRealArrayAlgebra object and vice versa. To store an independent internal copy of the external arrayvalue
useJxnRealArrayalgebra( value, true )
.- See Also:
getValue()
-
JxnRealArrayAlgebra
public JxnRealArrayAlgebra(double[] value, boolean copyInput)
Creates aJxnRealArrayAlgebra
instance from the arraydouble [] value
.- Parameters:
copyInput
- if true, stores a copy of the arrayvalue
, otherwise stores a reference to the arrayvalue
.
-
JxnRealArrayAlgebra
public JxnRealArrayAlgebra(int[] value)
Creates aJxnRealArrayAlgebra
instance from the arrayint[] value
.
-
JxnRealArrayAlgebra
public JxnRealArrayAlgebra(JxnRealArrayAlgebra ra)
Creates a copy ofra
. CallsJxnRealArrayAlgebra( ra, true )
-
JxnRealArrayAlgebra
public JxnRealArrayAlgebra(JxnRealArrayAlgebra ra, boolean transfer)
Creates a copy ofra
.- Parameters:
transfer
- if true includes copies ofitsName
andisDateTimeValue
.
-
JxnRealArrayAlgebra
public JxnRealArrayAlgebra(double start, double step, int length)
Creates an instance from the given parameters.
value[i] = start + step * i
fori = 0 ... length-1
-
JxnRealArrayAlgebra
public JxnRealArrayAlgebra(double start, double end, double step)
Creates an instance from the given parameters.
Ifstart < end
:value[i] = start + abs(step) * i
ifstart > end
:value[i] = start - abs(step) * i
fori = 0 ... n
withn = 1 + abs( round( ( end - start ) / step ) )
-
JxnRealArrayAlgebra
public JxnRealArrayAlgebra(double uvmin, double uvStep, int nuvSteps, int nvuSteps, int ni)
Deprecated.replaced by classJxnUVGrid
.Darstellung von Funktionen x(u,v) und y(u,v) durch Abbildung eines Netzes in der uv-Ebene in die xy-Ebene.Anwendung:
u = @JxnRealArrayAlgebra( umin, uStep, nuSteps, nvSteps, ni ) v = @JxnRealArrayAlgebra( vmin, vStep, nvSteps, nuSteps, -ni ) x = fx( u, v ) y = fy( u, v ) plot( x, y ) mit uStep: Maschenweite in u-Richtung, nuSteps: Anzahl der Maschen vStep: Maschenweite in v-Richtung, nvSteps: Anzahl der Maschen ni: Anzahl der Stuetzstellen je Masche (ni=1 Stuetzstellen nur in den Knotenpunkten) Beispiel: nuSteps = 3, nvSteps = 2, ni = 2 ( + : Stuetzstelle ) +---+---+---+---+---+---+ | | | | + + + + | | | | vmin+vStep -> +---+---+---+---+---+---+ | | | | + + + + | | | | vmin +---+---+---+---+---+---+ umin | u -> umin+uStep
-
-
Method Detail
-
cloneThis
public JxnCloneableAlgebra cloneThis()
Description copied from interface:JxnCloneableAlgebra
Called internally. Required to avoid overwriting the left side operandopndLeft
inopndLeft op opndRght
, ifop
is implemented asopndLeft.op(opndRght)
and the instance methodop
modifies the instance.- Specified by:
cloneThis
in interfaceJxnCloneableAlgebra
- Returns:
- copy of this instance
-
size
public int size()
Returns the length of the internal array.
-
length
public static int length(JxnRealArrayAlgebra ra)
Returns the length of the internal array ofra
.
-
setIgnoreSurplus
public static boolean setIgnoreSurplus(boolean ignore)
Controls if to ignore surplus elements of the longer internal array for methods which expect two instances with equal length internal arrays. By default the methods silently ignore surplus elements.- Parameters:
ignore
- if set to false methods throw an Exception if the internal arrays differ in length.
-
getIgnoreSurplus
public static boolean getIgnoreSurplus()
ReturnsignoreSurplus
.
-
equals
public boolean equals(Object other)
JxnRealArrayAlgebra
objects are equal, if all corresponding array elements are equal. UsesetEqualityTolerance(double)
to set a tolerance for the comparision of the array values.
-
setEqualityTolerance
public static double setEqualityTolerance(double eps)
Sets tolerance for theequals
method for all instances of this class.- Parameters:
eps
-eps
> 0. absolute difference,eps
< 0. relative difference- Returns:
- old tolerance
-
getEqualityTolerance
public static double getEqualityTolerance()
Returns the tolerance used for theequals
method.
-
setName
public JxnRealArrayAlgebra setName(String name)
Sets a name for this instance (status experimental).
-
setNamedResultEnabled
public static boolean setNamedResultEnabled(boolean enabled)
Enables the use of name forJxnRealArrayAlgebra
instances (status experimental).
-
setDateTimeValue
public JxnRealArrayAlgebra setDateTimeValue(boolean isDateTime)
Indicates that this instance represents date time values. The values of the internal array are interpreted as decimal seconds since 01-Jan-1970 00:00:00 UTC.- See Also:
KmgDateTimeConverter
-
setTimeFormat
public JxnRealArrayAlgebra setTimeFormat(boolean isDateTime)
Deprecated.replaced bysetDateTimeValue(boolean)
.
-
add
public JxnRealArrayAlgebra add(JxnRealArrayAlgebra ra)
Addsra
to this.
-
sub
public JxnRealArrayAlgebra sub(JxnRealArrayAlgebra ra)
Subtractsra
from this.
-
mul
public JxnRealArrayAlgebra mul(JxnRealArrayAlgebra ra)
(Post)Multiplies this byra
.
-
div
public JxnRealArrayAlgebra div(JxnRealArrayAlgebra ra)
Divides this byra
.
-
inv
public JxnRealArrayAlgebra inv()
Replaces this by its reciprocal.
-
remainder
public JxnRealArrayAlgebra remainder(JxnRealArrayAlgebra ra)
Replaces this bythis % ra
.
-
pow
public JxnRealArrayAlgebra pow(JxnRealArrayAlgebra exponent)
Replaces this by its power ofexponent
.
-
add
public JxnRealArrayAlgebra add(double d)
Addsd
to this.
-
sub
public JxnRealArrayAlgebra sub(double d)
Subtractsd
from this.
-
mul
public JxnRealArrayAlgebra mul(double d)
(Post)Multiplies this byd
.
-
mulL
public JxnRealArrayAlgebra mulL(double d)
(Pre)Multiplies this byd
.
-
div
public JxnRealArrayAlgebra div(double d)
Divides this byd
.
-
remainder
public JxnRealArrayAlgebra remainder(double d)
Replaces this bythis % d
.
-
pow
public JxnRealArrayAlgebra pow(double exponent)
Replaces this by its power ofexponent
.
-
add
public static JxnRealArrayAlgebra add(double d, JxnRealArrayAlgebra ra)
Returnsd + ra
.
-
sub
public static JxnRealArrayAlgebra sub(double d, JxnRealArrayAlgebra ra)
Returnsd - ra
.
-
mul
public static JxnRealArrayAlgebra mul(double d, JxnRealArrayAlgebra ra)
Returnsd * ra
.
-
div
public static JxnRealArrayAlgebra div(double d, JxnRealArrayAlgebra ra)
Returnsd / ra
.
-
remainder
public static JxnRealArrayAlgebra remainder(double d, JxnRealArrayAlgebra ra)
Returnsd % ra
.
-
pow
public static JxnRealArrayAlgebra pow(double d, JxnRealArrayAlgebra exponent)
Returnsd
to the power ofexponent
.
-
mul
public JxnRealArrayAlgebra mul(boolean sw)
Deprecated....
-
mul
public static JxnRealArrayAlgebra mul(boolean sw, JxnRealArrayAlgebra z)
Deprecated....
-
add
public JxnComplexArrayAlgebra add(JxnComplexAlgebra cx)
Addscx
to this.
-
sub
public JxnComplexArrayAlgebra sub(JxnComplexAlgebra cx)
Subtractscx
from this.
-
mul
public JxnComplexArrayAlgebra mul(JxnComplexAlgebra cx)
(Post)Multiplies this bycx
.
-
div
public JxnComplexArrayAlgebra div(JxnComplexAlgebra cx)
Divides this bycx
.
-
abs
public static JxnRealArrayAlgebra abs(JxnRealArrayAlgebra ra)
CallsMath.abs(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
abs
public static JxnRealArrayAlgebra abs(JxnRealArrayAlgebra x, JxnRealArrayAlgebra y)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
hypot
public static JxnRealArrayAlgebra hypot(JxnRealArrayAlgebra x, JxnRealArrayAlgebra y)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
floor
public static JxnRealArrayAlgebra floor(JxnRealArrayAlgebra ra)
CallsMath.floor(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
ceil
public static JxnRealArrayAlgebra ceil(JxnRealArrayAlgebra ra)
CallsMath.ceil(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
round
public static JxnRealArrayAlgebra round(JxnRealArrayAlgebra ra)
Commercial rounding of each element of the internal array ofra
.
Note: The implementation differs fromMath.round(double)
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance. - See Also:
JxnUtilities.round_half_away_from_zero(double)
-
rint
public static JxnRealArrayAlgebra rint(JxnRealArrayAlgebra ra)
CallsMath.rint(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
modulo
public static JxnRealArrayAlgebra modulo(JxnRealArrayAlgebra x, JxnRealArrayAlgebra y)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance. - See Also:
remainder(JxnRealArrayAlgebra)
,IEEEremainder(JxnRealArrayAlgebra x, JxnRealArrayAlgebra y)
-
modulo
public static JxnRealArrayAlgebra modulo(JxnRealArrayAlgebra x, double d)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance. - See Also:
remainder(double d)
,IEEEremainder(JxnRealArrayAlgebra ra, double d)
-
modulo
public static JxnRealArrayAlgebra modulo(double d, JxnRealArrayAlgebra y)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance. - See Also:
remainder(double d, JxnRealArrayAlgebra y)
,IEEEremainder(double d, JxnRealArrayAlgebra y)
-
IEEEremainder
public static JxnRealArrayAlgebra IEEEremainder(JxnRealArrayAlgebra x, JxnRealArrayAlgebra y)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
IEEEremainder
public static JxnRealArrayAlgebra IEEEremainder(JxnRealArrayAlgebra x, double d)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
IEEEremainder
public static JxnRealArrayAlgebra IEEEremainder(double d, JxnRealArrayAlgebra y)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
sign
public static JxnRealArrayAlgebra sign(JxnRealArrayAlgebra ra)
Returns a newJxnRealArrayAlgebra
containing the sign of each element of the internal array ofra
.- Returns:
- new
JxnRealArrayAlgebra
with
= +1 > 0. value[i] = 0 if ra.value[i] == 0. = -1 < 0.
-
signum
public static JxnRealArrayAlgebra signum(JxnRealArrayAlgebra ra)
CallsMath.signum(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
copySign
public static JxnRealArrayAlgebra copySign(JxnRealArrayAlgebra x, JxnRealArrayAlgebra y)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
min
public static JxnRealArrayAlgebra min(JxnRealArrayAlgebra x, JxnRealArrayAlgebra y)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
min
public static JxnRealArrayAlgebra min(JxnRealArrayAlgebra x, double d)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
min
public static JxnRealArrayAlgebra min(double d, JxnRealArrayAlgebra y)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
max
public static JxnRealArrayAlgebra max(JxnRealArrayAlgebra x, JxnRealArrayAlgebra y)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
max
public static JxnRealArrayAlgebra max(JxnRealArrayAlgebra x, double d)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
max
public static JxnRealArrayAlgebra max(double d, JxnRealArrayAlgebra y)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
limit
public static JxnRealArrayAlgebra limit(JxnRealArrayAlgebra ra, double lower, double upper)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
limitted tolower
andupper
.- Returns:
- new
JxnRealArrayAlgebra
with
value[i] = lower if ra.value[i] < lower = upper if ra.value[i] > upper = ra.value[i] else
-
clip
public static JxnRealArrayAlgebra clip(JxnRealArrayAlgebra ra, double lower, double upper)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
limitted tolower
andupper
.
Clipped values ofra
are replaced byDouble.NaN
.
NaN
(Not-a-Number) is handled as follows:
- Arithmetic operations withNaN
operands do not abort but giveNaN
as result.
-NaN
values result in a gap in aJxnRealArrayCurve
.- Returns:
- new
JxnRealArrayAlgebra
withif( lower < upper ) value[i] = ra.value[i] if lower <= ra.value[i] <= upper = Double.NaN else else if( lower > upper ) value[i] = Double.NaN if upper < ra.value[i] < lower = ra.value[i] else else // lower == upper value[i] = Double.NaN if lower == ra.value[i] == upper = ra.value[i] else
-
clip
public static JxnRealArrayAlgebra clip(JxnRealArrayAlgebra ra1, JxnRealArrayAlgebra ra2)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra1
with elements replaced byDouble.NaN
if the respective element inra2
is invalid (NaN or Infinity).
-
clip
public static JxnRealArrayAlgebra clip(JxnRealArrayAlgebra ra, int[] iClip)
-
clipLE
public static JxnRealArrayAlgebra clipLE(JxnRealArrayAlgebra ra, double minValue)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
with elementsvalue[i] <= minValue
replaced byDouble.NaN
.
-
clipLT
public static JxnRealArrayAlgebra clipLT(JxnRealArrayAlgebra ra, double minValue)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
with elementsvalue[i] < minValue
replaced byDouble.NaN
.
-
clipGE
public static JxnRealArrayAlgebra clipGE(JxnRealArrayAlgebra ra, double maxValue)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
with elementsvalue[i] >= maxValue
replaced byDouble.NaN
.
-
clipGT
public static JxnRealArrayAlgebra clipGT(JxnRealArrayAlgebra ra, double maxValue)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
with elementsvalue[i] > maxValue
replaced byDouble.NaN
.
-
sw
public static JxnRealArrayAlgebra sw(JxnRealArrayAlgebra ra, double lower, double upper)
Deprecated.replaced byclip(JxnRealArrayAlgebra, double, double)
.
-
sw
public static JxnRealArrayAlgebra sw(JxnRealArrayAlgebra x, JxnRealArrayAlgebra yLT, JxnRealArrayAlgebra yGE)
Returns values ofyLT
oryGE
depending on the value ofx
.
Combined logical conditions:for x1 >= 0. AND x2 >= 0. use sw( min( x1, x2 ), ... ) for x1 >= 0. OR x2 >= 0. use sw( max( x1, x2 ), ... ) for x1 >= 0. EXOR x2 >= 0. use sw( x1 * x2, ... )
- Returns:
- new
JxnRealArrayAlgebra
with
value[i] = yLT.value[i] if x.value[i] < 0. = yGE.value[i] else
-
sw
public static JxnRealArrayAlgebra sw(JxnRealArrayAlgebra x, JxnRealArrayAlgebra yLT, JxnRealArrayAlgebra yEQ, JxnRealArrayAlgebra yGT, double eps)
Returns values ofyLT
,yEQ
oryGT
depending on the value ofx
.- Returns:
- new
JxnRealArrayAlgebra
with
value[i] = yLT.value[i] if x.value[i] < -eps = yGT.value[i] if x.value[i] > +eps = yEQ.value[i] else
-
sw
public static JxnRealArrayAlgebra sw(JxnRealArrayAlgebra x, double lower, double upper, JxnRealArrayAlgebra yLower, JxnRealArrayAlgebra yInner, JxnRealArrayAlgebra yUpper)
Returns values ofyLower
,yInner
oryUpper
depending on the value ofx
.- Returns:
- new
JxnRealArrayAlgebra
with
value[i] = yLower.value[i] if x.value[i] < lower = yUpper.value[i] if x.value[i] > upper = yInner.value[i] else
-
sort
public static JxnRealArrayAlgebra sort(JxnRealArrayAlgebra ra)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
sorted in ascending order.- See Also:
sortIndex(JxnRealArrayAlgebra)
-
reverse
public static JxnRealArrayAlgebra reverse(JxnRealArrayAlgebra ra)
Returns a newJxnRealArrayAlgebra
containing the elements of the internal array ofra
in reversed order.
-
concat
public static JxnRealArrayAlgebra concat(JxnRealArrayAlgebra ra1, JxnRealArrayAlgebra ra2)
Returns a newJxnRealArrayAlgebra
which is the concatenation of the elements ofra1
followed byra2
.
-
sqrt
public static JxnRealArrayAlgebra sqrt(JxnRealArrayAlgebra ra)
CallsMath.sqrt(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
cbrt
public static JxnRealArrayAlgebra cbrt(JxnRealArrayAlgebra ra)
CallsMath.cbrt(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
scalb
public static JxnRealArrayAlgebra scalb(JxnRealArrayAlgebra ra, int scaleFactor)
CallsMath.scalb(double, int)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
exp
public static JxnRealArrayAlgebra exp(JxnRealArrayAlgebra ra)
CallsMath.exp(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
expm1
public static JxnRealArrayAlgebra expm1(JxnRealArrayAlgebra ra)
CallsMath.expm1(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
log
public static JxnRealArrayAlgebra log(JxnRealArrayAlgebra ra)
CallsMath.log(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
log1p
public static JxnRealArrayAlgebra log1p(JxnRealArrayAlgebra ra)
CallsMath.log1p(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
log10
public static JxnRealArrayAlgebra log10(JxnRealArrayAlgebra ra)
CallsMath.log10(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
log
public static JxnRealArrayAlgebra log(double b, JxnRealArrayAlgebra ra)
Determines the baseb
logarithm of each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
sin
public static JxnRealArrayAlgebra sin(JxnRealArrayAlgebra ra)
CallsMath.sin(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
cos
public static JxnRealArrayAlgebra cos(JxnRealArrayAlgebra ra)
CallsMath.cos(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
tan
public static JxnRealArrayAlgebra tan(JxnRealArrayAlgebra ra)
CallsMath.tan(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
asin
public static JxnRealArrayAlgebra asin(JxnRealArrayAlgebra ra)
CallsMath.asin(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
acos
public static JxnRealArrayAlgebra acos(JxnRealArrayAlgebra ra)
CallsMath.acos(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
atan
public static JxnRealArrayAlgebra atan(JxnRealArrayAlgebra ra)
CallsMath.atan(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
atan2
public static JxnRealArrayAlgebra atan2(JxnRealArrayAlgebra y, JxnRealArrayAlgebra x)
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
sinD
public static JxnRealArrayAlgebra sinD(JxnRealArrayAlgebra ra)
CallsMath.sin(double)
for each element of the internal array ofra
after converting the argument from degrees to radians.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
cosD
public static JxnRealArrayAlgebra cosD(JxnRealArrayAlgebra ra)
CallsMath.cos(double)
for each element of the internal array ofra
after converting the argument from degrees to radians.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
tanD
public static JxnRealArrayAlgebra tanD(JxnRealArrayAlgebra ra)
CallsMath.tan(double)
for each element of the internal array ofra
after converting the argument from degrees to radians.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
asinD
public static JxnRealArrayAlgebra asinD(JxnRealArrayAlgebra ra)
CallsMath.asin(double)
and converts the result from radians to degrees for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
acosD
public static JxnRealArrayAlgebra acosD(JxnRealArrayAlgebra ra)
CallsMath.acos(double)
and converts the result from radians to degrees for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
atanD
public static JxnRealArrayAlgebra atanD(JxnRealArrayAlgebra ra)
CallsMath.atan(double)
and converts the result from radians to degrees for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
atan2D
public static JxnRealArrayAlgebra atan2D(JxnRealArrayAlgebra y, JxnRealArrayAlgebra x)
CallsMath.atan2
(y
i,x
i)
and converts the result from radians to degrees for each pair of elements of the internal arrays ofy
andx
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
sinh
public static JxnRealArrayAlgebra sinh(JxnRealArrayAlgebra ra)
CallsMath.sinh(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
cosh
public static JxnRealArrayAlgebra cosh(JxnRealArrayAlgebra ra)
CallsMath.cosh(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
tanh
public static JxnRealArrayAlgebra tanh(JxnRealArrayAlgebra ra)
CallsMath.tanh(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
asinh
public static JxnRealArrayAlgebra asinh(JxnRealArrayAlgebra ra)
CallsJxnUtilities.asinh(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
acosh
public static JxnRealArrayAlgebra acosh(JxnRealArrayAlgebra ra)
CallsJxnUtilities.acosh(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
atanh
public static JxnRealArrayAlgebra atanh(JxnRealArrayAlgebra ra)
CallsJxnUtilities.atanh(double)
for each element of the internal array ofra
.- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
random
public static JxnRealArrayAlgebra random(int n)
-
random
public static JxnRealArrayAlgebra random(int n, long seed)
Returns a newJxnRealArrayAlgebra
withn
random numbers fromrnd.
nextDouble()
withrnd = new
Random(seed)
.
-
random
public static JxnRealArrayAlgebra random(JxnRealArrayAlgebra ra)
Returnsrandom(int n)
withn = ra.size()
.
-
random
public static JxnRealArrayAlgebra random(JxnRealArrayAlgebra ra, long seed)
Returnsrandom(int n, long seed)
withn = ra.size()
.
-
noise
public static JxnRealArrayAlgebra noise(int n)
Returns a newJxnRealArrayAlgebra
withn
random numbers fromrnd.
nextGaussian()
withrnd = new
Random()
.
-
noise
public static JxnRealArrayAlgebra noise(int n, long seed)
Returns a newJxnRealArrayAlgebra
withn
random numbers fromrnd.
nextGaussian()
withrnd = new
Random
(seed)
.
-
noise
public static JxnRealArrayAlgebra noise(JxnRealArrayAlgebra ra)
Returnsnoise(int n)
withn = ra.size()
.
-
noise
public static JxnRealArrayAlgebra noise(JxnRealArrayAlgebra ra, long seed)
Returnsnoise(int n, long seed)
withn = ra.size()
.
-
derivative
public static JxnRealArrayAlgebra derivative(JxnRealArrayAlgebra y)
Returnsderivative
( y, 1. )
.
-
derivative
public static JxnRealArrayAlgebra derivative(JxnRealArrayAlgebra y, double dt)
Returns the derivativedy/dt
for equidistant step sizedt
.
result[i] = 0.5 * ( y[i+1] - y[i-1] ) / dt
(derivative from quadratic polynom through 3 adjacent points).- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
derivative
public static JxnRealArrayAlgebra derivative(JxnRealArrayAlgebra y, JxnRealArrayAlgebra t)
Returns the derivativedy/dt
for the elements of the internal arrays ofy
andt
.
Determines the derivative at ti from the quadratic polynom through the (not necessarily equidistant) points (ti-1, yi-1), (ti, yi) and (ti+1, yi+1).- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
integral
public static JxnRealArrayAlgebra integral(JxnRealArrayAlgebra y)
Returnsintegral
( y, 1. )
.
-
integral
public static JxnRealArrayAlgebra integral(JxnRealArrayAlgebra y, double dt)
Returns the integral ∫y dt
for equidistant step sizedt
.
result[0] = 0.; result[i+1] = result[i] + 0.5 * ( y[i+1] + y[i] ) * dt
(trapeziod rule: linear interpolation between data points)- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
integral
public static JxnRealArrayAlgebra integral(JxnRealArrayAlgebra y, JxnRealArrayAlgebra t)
Returns the integral ∫y dt
for the elements of the internal arrays ofy
andt
.
Determines the integral by the trapeziod rule (linear interpolation between (not necessarily equidistant) data points).
result[0] = 0.; result[i+1] = result[i] + 0.5 * ( y[i+1] + y[i] ) * ( t[i+1] - t[i] )
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
energy
public static JxnRealArrayAlgebra energy(JxnRealArrayAlgebra p, double h)
Returns the integral of a power curve (with e.g.p[0]
= average power of time interval: 0:00 - 0:15 (available and stored at 0:15) ).
result[0] = p[0]; result[i+1] = result[i] + h * p[i+1]
( withresult[i]
= accumulated meter value at time( i + 1 ) * h
).- Parameters:
h
- sample interval: If p is in kW and h is 0.25 h (= 15 min) the result is in kWh- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
nonWindupStore
public static JxnRealArrayAlgebra nonWindupStore(JxnRealArrayAlgebra p, double h, double initial, double lower, double upper)
Returns the integral internally limited tolower
andupper
(non windup limiter) of a power curve.
Differs fromlimit
(
energy
( p, h ), lower, upper )
which winds up.- Parameters:
initial
- initial value of the store- Returns:
- the result in a new
JxnRealArrayAlgebra
instance. - See Also:
energy(JxnRealArrayAlgebra, double)
, Wikipedia
-
peak
public static JxnRealArrayAlgebra peak(JxnRealArrayAlgebra p, double h)
Determines the peak energy from a power curvep
. Forep = peak( p, h )
the valueep[i]
contains the (peak) energy consumed above a power value ofps[i+1]
of the sorted power curveps =
reverse
(
sort
(p) )
.- Parameters:
h
- sample interval ofp
-
gaussFilter
public static JxnRealArrayAlgebra gaussFilter(JxnRealArrayAlgebra t, double bandWidth)
ReturnsgaussFilter
( t, bandWidth, 3. )
.
-
gaussFilter
public static JxnRealArrayAlgebra gaussFilter(JxnRealArrayAlgebra t, double bandWidth, double filterWidth)
Creates a gaussFilter forconvolution
.- Parameters:
bandWidth
- of the filter in terms oft
.filterWidth
- width of the (finite) approximation of the infinite width gauss filter in terms of thebandWidth
-
convolution
public static JxnRealArrayAlgebra convolution(JxnRealArrayAlgebra ra, JxnRealArrayAlgebra filter)
Returnsconvolution
( ra, filter, 1 )
.
-
convolution
public static JxnRealArrayAlgebra convolution(JxnRealArrayAlgebra ra, JxnRealArrayAlgebra filter, int mode)
Returns the convolution ofra
withfilter
. Together withgaussFilter
this results in the smoothing ofra
.
The filtering implements a generalized weighted moving average which removes high frequency signal components (noise).
Example:slider = @JxnSliderPanel($this) seed = slider.add( "seed", 0., 0., 1000. ) an = slider.add( "noise amplitude", 0.5, 0.01, 2. ) bw = slider.add( "filter bandwidth", 0.05, 0.001, 2. ) mode = 1 noise = JxnRealArrayAlgebra.noise( t, round seed ) y0 = 2 + sin 4 PI t y1 = y0 + an noise gf = gaussFilter( t, bw ) yf = convolution( y1, gf, mode ) plot( t, y1, yf, y0 ) total y1 + " " + total yf
- Parameters:
filter
- positive half of a symmetrical filter function e.g. fromgaussFilter
mode
- determines how to handle values which by the convolution are mapped to the intervals outside the left and right margins:
0 : discards values. As a concequence the total of the data is reduced.
1 : adjust the weight of the filter function applied near the margins to preserve the total of the data.
2 : cyclic mapping of data from the right to the left margin and vice versa (periodic extension).- See Also:
- Wikipedia
-
faltung
public static JxnRealArrayAlgebra faltung(JxnRealArrayAlgebra ra, JxnRealArrayAlgebra filter)
Deprecated.
-
faltung
public static JxnRealArrayAlgebra faltung(JxnRealArrayAlgebra ra, JxnRealArrayAlgebra filter, int iRand)
Deprecated.- See Also:
- Wikipedia
-
smoothExp
public static JxnRealArrayAlgebra smoothExp(JxnRealArrayAlgebra x, double alpha)
Returns the resulty
of an exponential smoothing ofx
.
y[i] = alpha * x[i] + ( 1 - alpha ) * y[i-1]
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance.
-
getDayOfWeek
public static JxnRealArrayAlgebra getDayOfWeek(JxnRealArrayAlgebra ra)
Returns the day of week ( Mo: 1, ... Su: 7 ) for the values of the internal array ofra
interpreted as decimal seconds since 01-Jan-1970 00:00:00 UTC. Returns negative values for German holidays (Bavaria).- Returns:
- the result in a new
JxnRealArrayAlgebra
instance. - See Also:
Calendar
, German holidays (Wikipedia),setDateTimeValue(boolean)
,KmgDateTimeConverter
-
getCalendarField
public static JxnRealArrayAlgebra getCalendarField(JxnRealArrayAlgebra ra, int field)
Returns the result ofgc.get( field )
withgc = new
GregorianCalendar()
for the values of the internal array ofra
interpreted as decimal seconds since 01-Jan-1970 00:00:00 UTC.- Parameters:
field
- constant fromCalendar
- Returns:
- the result in a new
JxnRealArrayAlgebra
instance. - See Also:
setDateTimeValue(boolean)
,KmgDateTimeConverter
-
set
public static JxnRealArrayAlgebra set(JxnRealArrayAlgebra ra, int i, double vi)
Returns a copy ofra
, with thei
-th value replaced byvi
.
-
set
public JxnRealArrayAlgebra set(int i, double vi)
Replaces thei
-th value of thisJxnRealArrayAlgebra
byvi
.- Returns:
- this
-
setValue
public double setValue(int i, double vi)
Replaces thei
-th value of thisJxnRealArrayAlgebra
byvi
.- Returns:
- the old value
-
setValue
public double setValue(double vi, int i)
Deprecated.replaced bysetValue
( i, vi )
.
-
setValue
public static JxnRealArrayAlgebra setValue(JxnRealArrayAlgebra ra, double vi, int i)
Deprecated.Useset
( ra, i, vi )
.
-
range
public JxnRealArrayAlgebra range(int iStart)
Returns a newJxnRealArrayAlgebra
containinglength(ra)-iStart
values starting from indexiStart
. IfiStart
< 0 returnsabs(iStart)
values starting from indexlength(ra)-abs(iStart)
.
-
range
public JxnRealArrayAlgebra range(int iStart, int iEnd)
Returns a newJxnRealArrayAlgebra
containingiEnd-iStart
values starting from indexiStart
to indexiEnd
(excluding).
-
range
public JxnRealArrayAlgebra range()
-
range
public JxnRealArrayAlgebra range(JxnRealArrayAlgebra ra)
Deprecated.
-
range
public JxnRealArrayAlgebra range(double start)
Callsrange(int)
withstart
rounded to int.
-
range
public JxnRealArrayAlgebra range(double start, double end)
-
range
public JxnRealArrayAlgebra range(String start)
Returns a newJxnRealArrayAlgebra
containing the values of this starting fromstart
given as date time string.- See Also:
setDateTimeValue(boolean)
,KmgDateTimeConverter
-
range
public JxnRealArrayAlgebra range(String start, String end)
Returns a newJxnRealArrayAlgebra
containing the values of this starting fromstart
toend
given as date time string.- See Also:
setDateTimeValue(boolean)
,KmgDateTimeConverter
-
shift
public JxnRealArrayAlgebra shift(int k)
Returns a newJxnRealArrayAlgebra
containing the values of this circularly shifted byk
.
-
shift
public static JxnRealArrayAlgebra shift(JxnRealArrayAlgebra ra, int k)
Returns a newJxnRealArrayAlgebra
containing the values of this shifted byk
filling with0.
.
-
shift
public static JxnRealArrayAlgebra shift(JxnRealArrayAlgebra ra, int k, double d)
Returns a newJxnRealArrayAlgebra
containing the values of this shifted byk
filling withd
.
-
byIndex
public JxnRealArrayAlgebra byIndex(int[] index)
Returns a newJxnRealArrayAlgebra
containing the values of this instance at the positions given inindex
.- See Also:
get(int[])
-
by
public JxnRealArrayAlgebra by(int[] index)
Same asbyIndex(int[])
.
-
sortIndex
public static int[] sortIndex(JxnRealArrayAlgebra ra)
Returns an array of the indices of the values ofra
in ascending order.ry.byIndex( sortIndex(ry) )
gives the sameJxnRealArrayAlgebra
assort
(ry)
, but sortIndex also allows to address other arrays according to the order of a given arrayry
.- See Also:
sort(JxnRealArrayAlgebra)
-
cut
public static int[] cut(JxnRealArrayAlgebra ra)
Returns an int array of the indicesi
of values ofra
with:value[i] > 0.
.
-
cut
public static int[] cut(JxnRealArrayAlgebra ra, int[] index)
Analyzes the values ofra
only with indices given in arrayindex
and returns an int array of the indicesi
of values with:value[i] > 0.
.
-
cut
public static int[] cut(JxnRealArrayAlgebra ra, double min, double max)
Returns an int array of the indicesi
of values ofra
with:min <= value[i] <= max
.
-
getCntValid
public static int getCntValid(JxnRealArrayAlgebra ra)
Returns the number of valid (neitherNaN
norInfinitive
) values inra
.
-
getCntNaN
public static int getCntNaN(JxnRealArrayAlgebra ra)
Returns the number ofNaN
values inra
.
-
getCntInvalid
public static int getCntInvalid(JxnRealArrayAlgebra ra)
Returns the number of invalid (NaN
orInfinitive
) values inra
.
-
valid
public static int[] valid(JxnRealArrayAlgebra ra)
Returns an int array of the indices of values ofra
with valid (neitherNaN
norInfinitive
) values.
-
invalid
public static int[] invalid(JxnRealArrayAlgebra ra)
Returns an int array of the indices of values ofra
with invalid (NaN
orInfinitive
) values.
-
valueAt
public double valueAt(int i)
Deprecated.Useget
(i)
.
-
valueAt
public static double valueAt(JxnRealArrayAlgebra ra, int i)
Deprecated.UsegetValue
( ra, i )
.
-
get
public double get(int i)
Returns the value of thei
-th element of the internal array of thisJxnRealArrayAlgebra
.
-
get
public double[] get(int[] ia)
Returns an array of the values of the elements of the internal array of thisJxnRealArrayAlgebra
defined by the indices given inia
.- See Also:
byIndex(int[])
-
get
public double get(double x)
Returns a value for positionx
by linear interpolation between the adjacent elements of the internal array of thisJxnRealArrayAlgebra
.
For:i <= x <= i+1
returns:value[i] + ( x - i ) * ( value[i+1] - value[i] )
-
get
public double[] get(double[] da)
Returns an array of values at the positions given inda
by linear interpolation between the adjacent elements of the internal array of thisJxnRealArrayAlgebra
usingget(double x)
.
-
get
public JxnRealArrayAlgebra get(JxnRealArrayAlgebra ra)
Returns aJxnRealArrayAlgebra
of values at the positions given inra
by linear interpolation between the adjacent elements of the internal array of thisJxnRealArrayAlgebra
usingget(double[])
.
-
toArray
public double[] toArray()
Returns a copy of the internal array of thisJxnRealArrayAlgebra
.
-
getValue
public double[] getValue()
Returns a reference to the internal array of thisJxnRealArrayAlgebra
.
Note: This method exists for performance and memory reasons. The modification of an array value will modify theJxnRealArrayAlgebra
object and vice versa. UsetoArray()
to get an independent copy of the internal array.- See Also:
JxnRealArrayAlgebra(double[])
-
getValue
public double getValue(int i)
Deprecated.Useget
(i)
.
-
getValue
public static double getValue(JxnRealArrayAlgebra ra, int i)
Returns the value of thei
-th element of the internal array ofra
.
-
getValue
public double getValue(double x)
Returnsget
(x)
.
-
getValue
public static double getValue(JxnRealArrayAlgebra ra, double x)
-
getValue
public double[] getValue(double[] da)
Returnsget
(da)
.
-
getValue
public static double[] getValue(JxnRealArrayAlgebra ra, double[] da)
-
findValue
public double[] findValue(double value)
Findsvalue
in the internal array.
Example:x = x / 2 = {-5.0, -4.975, ... 5.0}[401] (JxnRealArrayAlgebra) y = sin x = {0.9589242746631385, 0.9657154423905294, ... -0.9589242746631385}[401] (JxnRealArrayAlgebra) p = y.findValue( 0. ) = { 74.33630146888443, 200.0, 325.6636985311156 } (double[3]) x[p] ! shortcut of x.
Note: Intervals containingget
( p ) = { -3.141592463277889, 0.0, 3.14159246327789 } (double[3]) x[p] / PI = { -0.9999999394218395, 0.0, 0.9999999394218397 } (double[3]) y[p] = { -4.85722573273506E-17, 0.0, -6.002143226879753E-16 } (double[3]) sin x[p] = { -1.903119041361038E-7, 0.0, 1.903119032479254E-7 } (double[3])value
are detected only by looking for transitions of the values of the internal array from abovevalue
to belowvalue
without any magic to distinguish a pole from a zero crossing (try the example replacingsin
bytan
).- Returns:
- position(s) (by linear interpolation) within all intervals of the internal array which include the given
value
. - See Also:
get(double)
-
findValue
public static double[] findValue(JxnRealArrayAlgebra ra, double value)
Same asra.
findValue(double value)
.
-
minValue
public static double minValue(JxnRealArrayAlgebra ra)
Returns the minimum value (including -Infinity) of the internal array ofra
.
-
minValid
public static double minValid(JxnRealArrayAlgebra ra)
Returns the minimum value excluding -Infinity of the internal array ofra
.
-
minIndex
public static int minIndex(JxnRealArrayAlgebra ra)
Returns the index of the (first) minimum value (including -Infinity) of the internal array ofra
.
-
maxValue
public static double maxValue(JxnRealArrayAlgebra ra)
Returns the maximum value (including +Infinity) of the internal array ofra
.
-
maxValid
public static double maxValid(JxnRealArrayAlgebra ra)
Returns the minimum value excluding +Infinity of the internal array ofra
.
-
maxIndex
public static int maxIndex(JxnRealArrayAlgebra ra)
Returns the index of the (first) maximum value (including +Infinity) of the internal array ofra
.
-
summe
public static double summe(JxnRealArrayAlgebra ra)
Returnstotal
( ra )
.
-
total
public static double total(JxnRealArrayAlgebra ra)
Returns the sum of all elements of the internal array ofra
.
-
quadsum
public static double quadsum(JxnRealArrayAlgebra ra)
Returns the sum of the squares of all elements of the internal array ofra
.
-
korXY
public static double korXY(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry)
ReturnscorXY
( rx, ry )
.- See Also:
- Wikipedia
-
corXY
public static double corXY(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry)
Returns the correlation coefficient ofrx
andry
.- See Also:
- Wikipedia
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra ry)
Creates a newJxnRealArrayPlotFrame
and visualizes the values ofry
as a curve:
xi = i, yi = ry.value[i], i = 0 ... y.length - 1.
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra ry, Color color, int lineType)
Seeplot
.- Parameters:
lineType
- seeJxnRealArrayCurve
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra ry, double ymin, double ymax)
Deprecated.
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry)
Creates a newJxnRealArrayPlotFrame
and visualizes the values ofrx
andry
as a curve:
xi = rx.value[i], yi = ry.value[i], i = 0 ... min( length(rx), length(ry) ) - 1.
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, double ymin, double ymax)
Deprecated.
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry1, JxnRealArrayAlgebra ry2)
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry1, JxnRealArrayAlgebra ry2, double ymin, double ymax)
Deprecated.
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry1, JxnRealArrayAlgebra ry2, JxnRealArrayAlgebra ry3)
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry1, JxnRealArrayAlgebra ry2, JxnRealArrayAlgebra ry3, double ymin, double ymax)
Deprecated.
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, double vyx)
Seeplot
.- Parameters:
vyx
- fixed ratio of the scaling: 1.0 for equally scaled x- and y-axis.
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, int logScales)
Seeplot
.
Note: logarithmic scaling requires that all values are positive. The scale switches to linear if rx or ry include any value(s) <= 0.- Parameters:
logScales
- determines which axis should be scaled logarithmiclogScales x-axis y-axis 0 lin lin 1 lin log 2 log lin 3 log log 4 time lin 5 time log
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color)
Seeplot
.
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType)
Seeplot
.- Parameters:
lineType
- seeJxnRealArrayCurve
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, float lineWidth)
Seeplot
.
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, Stroke stroke)
Seeplot
.- Parameters:
stroke
- seejava.awt.BasicStroke
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType, double vyx)
Seeplot
.
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType, int logScales)
Seeplot
.
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType, float lineWidth, double vyx)
Seeplot
.- Parameters:
lineWidth
- seejava.awt.BasicStroke
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType, float lineWidth, int logScales)
Seeplot
.
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, Stroke stroke, double vyx)
Seeplot
.
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, Stroke stroke, int logScales)
Seeplot
.
-
plot
public static JxnRealArrayPlotFrame plot(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, JxnRealArrayAlgebra rz, IKmg3DProjection p3d)
-
curve
public static JxnRealArrayCurve curve(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color)
Returns a curve representation ofrx
andry
( xi = rx.value[i], yi = ry.value[i] ). Call theadd
method on aPlotFrame
instance to display the curve in the PlotFrame. Allows e.g. to show a curve in aJxnComplexPlotFrame
.
Example:plot( 3 + j 4 ).add( curve( 5 cos 2 PI t, 5 sin 2 PI t, Color.BLUE ).
setLineWidth
(3) )
-
curve
public static JxnRealArrayCurve curve(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, Color color, int lineType)
Seecurve
.- Parameters:
lineType
- seeJxnRealArrayCurve
- See Also:
JxnAbstractPainter.setLineWidth(float)
,JxnAbstractPainter.setStroke(java.awt.Stroke)
-
curve
public static JxnRealArrayCurve curve(JxnRealArrayAlgebra ry, Color color)
-
curve
public static JxnRealArrayCurve curve(JxnRealArrayAlgebra ry, Color color, int lineType)
Seecurve
.- Parameters:
lineType
- seeJxnRealArrayCurve
-
curve
public static JxnRealArrayCurve curve(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, JxnRealArrayAlgebra rz, IKmg3DProjection p3d)
-
curve
public static JxnRealArrayCurve curve(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, JxnRealArrayAlgebra rz, IKmg3DProjection p3d, Color color)
-
curve
public static JxnRealArrayCurve curve(JxnRealArrayAlgebra rx, JxnRealArrayAlgebra ry, JxnRealArrayAlgebra rz, IKmg3DProjection p3d, Color color, int lineType)
- Parameters:
lineType
- seeJxnRealArrayCurve
- See Also:
- JXN gallery, → anaglyph stereo
-
-