Codota Logo
MathUtils
Code IndexAdd Codota to your IDE (free)

How to use
MathUtils
in
org.matheclipse.parser.client.math

Best Java code snippets using org.matheclipse.parser.client.math.MathUtils (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: org.refcodes/refcodes-criteria

/**
 * Add two long integers, checking for overflow.
 * 
 * @param a an addend
 * @param b an addend
 * @return the sum <code>a+b</code>
 * @throws org.matheclipse.parser.client.math.MathException if the result
 *         can not be represented as an long
 * @since 1.2
 */
public static long addAndCheck( long a, long b ) {
  return addAndCheck( a, b, "overflow: add" );
}
origin: org.refcodes/refcodes-criteria

/**
 * Returns a <code>double</code> representation of the
 * <a href="http://mathworld.wolfram.com/BinomialCoefficient.html"> Binomial
 * Coefficient</a>, "<code>n choose k</code>", the number of
 * <code>k</code>-element subsets that can be selected from an
 * <code>n</code>-element set.
 * 
 * <Strong>Preconditions</strong>:
 * <ul>
 * <li><code>0 &lt;= k &lt;= n </code> (otherwise
 * <code>IllegalArgumentException</code> is thrown)</li>
 * <li>The result is small enough to fit into a <code>double</code>. The
 * largest value of <code>n</code> for which all coefficients are &lt;
 * Double.MAX_VALUE is 1029. If the computed value exceeds Double.MAX_VALUE,
 * Double.POSITIVE_INFINITY is returned</li>
 * </ul>
 * 
 * @param n the size of the set
 * @param k the size of the subsets to be counted
 * @return <code>n choose k</code>
 * @throws java.lang.IllegalArgumentException if preconditions are not met.
 */
public static double binomialCoefficientDouble( final int n, final int k ) {
  return Math.floor( Math.exp( binomialCoefficientLog( n, k ) ) + 0.5 );
}
origin: org.refcodes/refcodes-criteria

/**
 * Returns true iff both arguments are null or have same dimensions and all
 * their elements are {@link #equals(double,double) equals}.
 * 
 * @param x first array
 * @param y second array
 * @return true if the values are both null or have same dimension and equal
 *         elements
 * @since 1.2
 */
public static boolean equals( double[] x, double[] y ) {
  if ( (x == null) || (y == null) ) {
    return !((x == null) ^ (y == null));
  }
  if ( x.length != y.length ) {
    return false;
  }
  for ( int i = 0; i < x.length; ++i ) {
    if ( !equals( x[i], y[i] ) ) {
      return false;
    }
  }
  return true;
}
origin: org.refcodes/refcodes-criteria

/**
 * Returns the least common multiple between two integer values.
 * 
 * @param a the first integer value.
 * @param b the second integer value.
 * @return the least common multiple between a and b.
 * @throws org.matheclipse.parser.client.math.MathException if the lcm is
 *         too large to store as an int
 * @since 1.1
 */
public static int lcm( int a, int b ) {
  return Math.abs( mulAndCheck( a / gcd( a, b ), b ) );
}
origin: org.appdapter/ext.bundle.math.symja_jas

return createComplex(MathUtils.sinh(real) * Math.cos(imaginary), MathUtils.cosh(real) * Math.sin(imaginary));
origin: axkr/symja_android_library

@Override
public int hashCode() {
  return MathUtils.hash(value);// Double.doubleToLongBits(value);
  // return (int)(bits ^ (bits >>> 32));
}
origin: org.refcodes/refcodes-criteria

return createComplex( Math.abs( imaginary ) / (2.0 * t), MathUtils.indicator( imaginary ) * t );
origin: org.appdapter/ext.bundle.math.symja_jas

/**
 * Returns n!. Shorthand for <code>n</code> <a
 * href="http://mathworld.wolfram.com/Factorial.html"> Factorial</a>, the
 * product of the numbers <code>1,...,n</code> as a <code>double</code>.
 * <p>
 * <Strong>Preconditions</strong>:
 * <ul>
 * <li> <code>n >= 0</code> (otherwise <code>IllegalArgumentException</code>
 * is thrown)</li>
 * <li> The result is small enough to fit into a <code>double</code>. The
 * largest value of <code>n</code> for which <code>n!</code> <
 * Double.MAX_VALUE</code> is 170. If the computed value exceeds
 * Double.MAX_VALUE, Double.POSITIVE_INFINITY is returned</li>
 * </ul>
 * </p>
 * 
 * @param n
 *          argument
 * @return <code>n!</code>
 * @throws IllegalArgumentException
 *           if n < 0
 */
public static double factorialDouble(final int n) {
  if (n < 0) {
    throw new IllegalArgumentException("must have n >= 0 for n!");
  }
  return Math.floor(Math.exp(factorialLog(n)) + 0.5);
}
origin: org.appdapter/ext.bundle.math.symja_jas

long result = Math.round(factorialDouble(n));
if (result == Long.MAX_VALUE) {
  throw new MathException("result too large to represent in a long integer");
origin: org.refcodes/refcodes-criteria

long result = Math.round( binomialCoefficientDouble( n, k ) );
if ( result == Long.MAX_VALUE ) {
  throw new MathException( "result too large to represent in a long integer" );
origin: org.refcodes/refcodes-criteria

return createComplex( MathUtils.cosh( real ) * Math.cos( imaginary ), MathUtils.sinh( real ) * Math.sin( imaginary ) );
origin: org.appdapter/ext.bundle.math.symja_jas

/**
 * Returns the least common multiple between two integer values.
 * 
 * @param a
 *          the first integer value.
 * @param b
 *          the second integer value.
 * @return the least common multiple between a and b.
 * @throws MathException
 *           if the lcm is too large to store as an int
 * @since 1.1
 */
public static int lcm(int a, int b) {
  return Math.abs(mulAndCheck(a / gcd(a, b), b));
}
origin: org.appdapter/ext.bundle.math.symja_jas

public int hashCode() {
  return MathUtils.hash(value);// Double.doubleToLongBits(value);
  // return (int)(bits ^ (bits >>> 32));
}
origin: org.appdapter/ext.bundle.math.symja_jas

  return createComplex(t, imaginary / (2.0 * t));
} else {
  return createComplex(Math.abs(imaginary) / (2.0 * t), MathUtils.indicator(imaginary) * t);
origin: org.refcodes/refcodes-criteria

/**
 * Returns n!. Shorthand for <code>n</code>
 * <a href="http://mathworld.wolfram.com/Factorial.html"> Factorial</a>, the
 * product of the numbers <code>1,...,n</code> as a <code>double</code>.
 * 
 * <Strong>Preconditions</strong>:
 * <ul>
 * <li><code>n &gt;= 0</code> (otherwise
 * <code>IllegalArgumentException</code> is thrown)</li>
 * <li>The result is small enough to fit into a <code>double</code>. The
 * largest value of <code>n</code> for which <code>n! &lt;
 * Double.MAX_VALUE</code> is 170. If the computed value exceeds
 * Double.MAX_VALUE, Double.POSITIVE_INFINITY is returned</li>
 * </ul>
 * 
 * @param n argument
 * @return <code>n!</code>
 * @throws java.lang.IllegalArgumentException if n &lt; 0
 */
public static double factorialDouble( final int n ) {
  if ( n < 0 ) {
    throw new IllegalArgumentException( "must have n >= 0 for n!" );
  }
  return Math.floor( Math.exp( factorialLog( n ) ) + 0.5 );
}
origin: axkr/symja_android_library

long result = Math.round(factorialDouble(n));
if (result == Long.MAX_VALUE) {
  throw new MathException("result too large to represent in a long integer");
origin: axkr/symja_android_library

long result = Math.round(binomialCoefficientDouble(n, k));
if (result == Long.MAX_VALUE) {
  throw new MathException("result too large to represent in a long integer");
origin: org.refcodes/refcodes-criteria

return createComplex( Math.cos( real ) * MathUtils.cosh( imaginary ), -Math.sin( real ) * MathUtils.sinh( imaginary ) );
origin: axkr/symja_android_library

/**
 * Returns the least common multiple between two integer values.
 * 
 * @param a
 *          the first integer value.
 * @param b
 *          the second integer value.
 * @return the least common multiple between a and b.
 * @throws MathException
 *           if the lcm is too large to store as an int
 * @since 1.1
 */
public static int lcm(int a, int b) {
  return Math.abs(mulAndCheck(a / gcd(a, b), b));
}
origin: org.refcodes/refcodes-criteria

/**
 * Hash code.
 * 
 * @return the int
 */
@Override
public int hashCode() {
  return MathUtils.hash( value );// Double.doubleToLongBits(value);
  // return (int)(bits ^ (bits >>> 32));
}
org.matheclipse.parser.client.mathMathUtils

Javadoc

Some useful additions to the built-in functions in Math.

Most used methods

  • addAndCheck
    Add two long integers, checking for overflow.
  • binomialCoefficientDouble
    Returns a double representation of the Binomial Coefficient [http://mathworld.wolfram.com/BinomialCo
  • binomialCoefficientLog
    Returns the natural log of the Binomial Coefficient [http://mathworld.wolfram.com/BinomialCoefficien
  • cosh
    Returns the hyperbolic cosine [http://mathworld.wolfram.com/HyperbolicCosine.html] of x.
  • equals
    Returns true iff both arguments are null or have same dimensions and all their elements are #equals(
  • factorialDouble
    Returns n!. Shorthand for n Factorial [http://mathworld.wolfram.com/Factorial.html], the product of
  • factorialLog
    Returns the natural logarithm of n!.Preconditions: * n >= 0 (otherwiseIllegalArgumentException is th
  • gcd
    Gets the greatest common divisor of the absolute value of two numbers, using the "binary gcd" method
  • hash
    Returns an integer hash code representing the given double array value.
  • indicator
    For a short value x, this method returns (short)(+1) if x >= 0 and (short)(-1) if x < 0.
  • mulAndCheck
    Multiply two long integers, checking for overflow.
  • sinh
    Returns the hyperbolic sine [http://mathworld.wolfram.com/HyperbolicSine.html] of x.
  • mulAndCheck,
  • sinh

Popular in Java

  • Finding current android device location
  • putExtra (Intent)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • runOnUiThread (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • BigInteger (java.math)
    Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • StringTokenizer (java.util)
    The string tokenizer class allows an application to break a string into tokens. The tokenization met
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now