<h2>org.das2.util.DasMath</h2><p></p> <h2>DasMath( )</h2> <p>Creates a new instance of DasMath</p> <hr> <a name="biggerOf"></a> <h2>biggerOf</h2> biggerOf( double x1, double x2 ) → double <p>returns the bigger number of two numbers</p> <h3>Parameters</h3> x1 - a number <br> x2 - a number <h3>Returns:</h3> the greater of the two numbers <br><br> <a href="https://github.com/autoplot/dev/search?q=biggerOf&unscoped_q=biggerOf">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#biggerOf">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br> <hr> <a name="exp10"></a> <h2>exp10</h2> exp10( double x ) → double <p></p> <h3>Parameters</h3> x - a double <h3>Returns:</h3> double <br><br> <a href="https://github.com/autoplot/dev/search?q=exp10&unscoped_q=exp10">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#exp10">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br> exp10( int x ) → double<br> <hr> <a name="findex"></a> <h2>findex</h2> findex( double[] datax, double[] x ) → double[] <p>Returns the "floating point indeces" of x within array datax. A floating point index (or "findex") indicates the indeces of the points that bracket and the weights of each bracketing point to use. A findex of 4.5 indicates that x is half-way between index 4 and 5, so equal weights should be used. floor( findex ) is the "left" bracket, ceil(findex) is the "right" bracket, and fp( findex ) is the weight for the right bracket. See interpolate for an example of its use.</p> <h3>Parameters</h3> datax - a double[] <br> x - a double[] <h3>Returns:</h3> double[] <br><br> <a href="https://github.com/autoplot/dev/search?q=findex&unscoped_q=findex">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#findex">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br> findex( double[] datax, double x, int guess ) → double<br> <hr> <a name="gcd"></a> <h2>gcd</h2> gcd( double[] A, double error ) → double <p>Returns the greatest common divisor of a group of numbers. This is useful for a number of visualization techniques, for instance when you need to integerize your data, the binsize should be the gcd. An error parameter is provided to avoid numerical noise, and in case there is a granularity that needn't be surpassed. org.das2.datum.DatumUtil has a private copy of this code.</p> <h3>Parameters</h3> A - the array of numbers <br> error - the limit of the error to deal with numerical noise <h3>Returns:</h3> the greatest common divisor (GCD) <br><br> <a href="https://github.com/autoplot/dev/search?q=gcd&unscoped_q=gcd">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#gcd">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br> <hr> <a name="interpolate"></a> <h2>interpolate</h2> interpolate( double[] datay, double findex ) → double <p>Interpolate just one point</p> <h3>Parameters</h3> datay - a double[] <br> findex - a double <h3>Returns:</h3> double <br><br> <a href="https://github.com/autoplot/dev/search?q=interpolate&unscoped_q=interpolate">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#interpolate">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br> interpolate( double[] datay, double[] findex ) → double[]<br> <hr> <a name="log10"></a> <h2>log10</h2> log10( double x ) → double <p></p> <h3>Parameters</h3> x - a double <h3>Returns:</h3> double <br><br> <a href="https://github.com/autoplot/dev/search?q=log10&unscoped_q=log10">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#log10">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br> <hr> <a name="main"></a> <h2>main</h2> main( <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String[]</a> args ) → void <p></p> <h3>Parameters</h3> args - a java.lang.String[] <h3>Returns:</h3> void (returns nothing) <br><br> <a href="https://github.com/autoplot/dev/search?q=main&unscoped_q=main">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#main">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br> <hr> <a name="max"></a> <h2>max</h2> max( double[] A ) → double <p>return the maximum of the list</p> <h3>Parameters</h3> A - the list of numbers <h3>Returns:</h3> the maximum of the list <br><br> <a href="https://github.com/autoplot/dev/search?q=max&unscoped_q=max">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#max">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br> <hr> <a name="mean"></a> <h2>mean</h2> mean( double[] A ) → double <p>return the mean of the list. The first element's magnitude is removed from each accumulated value so that items with large offset values (for example times) can be averaged. There is no checking for NaNs or fill values.</p> <h3>Parameters</h3> A - a double[] <h3>Returns:</h3> the mean of the list. <br><br> <a href="https://github.com/autoplot/dev/search?q=mean&unscoped_q=mean">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#mean">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br> <hr> <a name="median"></a> <h2>median</h2> median( double[] A ) → double <p>return the median of the list length N, which is the value at index N/2 of the sorted list. This does not return the average for even-length lists. and there is no checking for NaNs or fill values.</p> <h3>Parameters</h3> A - the list of numbers <h3>Returns:</h3> the median of the list <br><br> <a href="https://github.com/autoplot/dev/search?q=median&unscoped_q=median">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#median">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br> <hr> <a name="min"></a> <h2>min</h2> min( double[] A ) → double <p>return the minimum of the list</p> <h3>Parameters</h3> A - the list <h3>Returns:</h3> the minimum of the list <br><br> <a href="https://github.com/autoplot/dev/search?q=min&unscoped_q=min">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#min">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br> <hr> <a name="modp"></a> <h2>modp</h2> modp( double x, double t ) → double <p>just like modulo (%) function, but negative numbers return positive phase.</p> <h3>Parameters</h3> x - the numerator <br> t - the devisor <h3>Returns:</h3> the modulo, which will always be positive <br><br> <a href="https://github.com/autoplot/dev/search?q=modp&unscoped_q=modp">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#modp">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br> modp( int x, int t ) → int<br> <hr> <a name="roundNFractionalDigits"></a> <h2>roundNFractionalDigits</h2> roundNFractionalDigits( double x, int n ) → double <p>round the decimal to the number of fractional decimal places. For example, <code>DasMath.roundNFractionalDigits(1.2345678,3)==1.23</code> Note the name implies that there will be three decimals in the fractional part, but this implementation will return only two.</p> <h3>Parameters</h3> x - a double <br> n - number of decimal places <h3>Returns:</h3> the number rounded to the number of decimal places. <h3>See Also:</h3> <a href='null'>roundNSignificantDigits(double, int)</a> <br> <a href='https://github.com/autoplot/dev/blob/master/demos/2023/20230910/roundNDigits.jy'>https://github.com/autoplot/dev/blob/master/demos/2023/20230910/roundNDigits.jy</a> <br> <br><br> <a href="https://github.com/autoplot/dev/search?q=roundNFractionalDigits&unscoped_q=roundNFractionalDigits">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#roundNFractionalDigits">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br> <hr> <a name="roundNSignificantDigits"></a> <h2>roundNSignificantDigits</h2> roundNSignificantDigits( double x, int n ) → double <p>Round the double to n significant digits by removing the exponent to make the number order one, then rounding the mantissa, then replacing the exponent.</p> <h3>Parameters</h3> x - a double <br> n - number of decimal places <h3>Returns:</h3> the number rounded to the number of decimal places. <h3>See Also:</h3> <a href='null'>roundNFractionalDigits(double, int)</a> <br> <a href='https://github.com/autoplot/dev/blob/master/demos/2023/20230910/roundNDigits.jy'>https://github.com/autoplot/dev/blob/master/demos/2023/20230910/roundNDigits.jy</a> <br> <br><br> <a href="https://github.com/autoplot/dev/search?q=roundNSignificantDigits&unscoped_q=roundNSignificantDigits">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#roundNSignificantDigits">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br> <hr> <a name="sort"></a> <h2>sort</h2> sort( double[] A ) → double[] <p>return a sorted version of the array. The original array is not modified.</p> <h3>Parameters</h3> A - a double[] <h3>Returns:</h3> return a sorted version of the array. <br><br> <a href="https://github.com/autoplot/dev/search?q=sort&unscoped_q=sort">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#sort">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br> <hr> <a name="tanh"></a> <h2>tanh</h2> tanh( double x ) → double <p></p> <h3>Parameters</h3> x - a double <h3>Returns:</h3> double <br><br> <a href="https://github.com/autoplot/dev/search?q=tanh&unscoped_q=tanh">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/DasMath.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/DasMath.html#tanh">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/DasMath.java">[view source]</a> <br> <br>