Class LinearEquations

java.lang.Object
org.monte.media.math.LinearEquations

public class LinearEquations extends Object
LinearEquations.

Reference: http://en.wikipedia.org/wiki/Cramer's_rule http://en.wikipedia.org/wiki/Determinant

Author:
Werner Randelshofer
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    det(double a, double b, double c, double d)
    Computes the determinant of a 3x3 matrix using Sarrus' rule.
    static double
    det(double a, double b, double c, double d, double e, double f, double g, double h, double i)
    Computes the determinant of a 2x2 matrix using Sarrus' rule.
    static double[]
    solve(double a, double b, double c, double d, double e, double f)
    Solves a linear system for x,y with cramer's rule.
    static double[]
    solve(double a, double b, double c, double d, double e, double f, double g, double h, double i, double j, double k, double l)
    Solves a linear system for x,y,z with cramer's rule.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • solve

      public static double[] solve(double a, double b, double c, double d, double e, double f)
      Solves a linear system for x,y with cramer's rule.
       a*x + b*y = e
       c*x + d*y = f
       
      Parameters:
      a -
      b -
      c -
      d -
      e -
      f -
    • solve

      public static double[] solve(double a, double b, double c, double d, double e, double f, double g, double h, double i, double j, double k, double l)
      Solves a linear system for x,y,z with cramer's rule.
       a*x + b*y + c*z = j
       d*x + e*y + f*z = k
       g*x + h*y + i*z = l
       
      Parameters:
      a -
      b -
      c -
      d -
      e -
      f -
    • det

      public static double det(double a, double b, double c, double d, double e, double f, double g, double h, double i)
      Computes the determinant of a 2x2 matrix using Sarrus' rule.
       | a, b, c |     |e, f|   |d, f|   |d, e|
       | d, e, f | = a*|h, i|-b*|g, i|+c*|g, h|=aei+bfg+cdh-ceg-bdi-afh
       | g, h, i |
       
      Parameters:
      a -
      b -
      c -
      d -
      e -
      f -
      g -
      h -
      i -
      Returns:
      the determinant
    • det

      public static double det(double a, double b, double c, double d)
      Computes the determinant of a 3x3 matrix using Sarrus' rule.
       | a, b |
       | c, d | = a*d - b*c
       
      Parameters:
      a -
      b -
      c -
      d -
      Returns:
      the determinant