PUBS: A Practical Upper Bounds Solver

/*

This Program is taken from the following site (without permission) solely for the experimentation of cost analysis of practial java programs

http://www.physics.unlv.edu/~pang/cp2_j.html

*/
///////////////////////////////////////////////////////////////////////////
//                                                                       //
// Program file name: LinearEq.java                                      //
//                                                                       //
// Tao Pang 2006                                                       //
//                                                                       //
// Last modified: November 6, 2006                                       //
//                                                                       //
// (1) This Java program is part of the book, "An Introduction to        //
//     Computational Physics, 2nd Edition," written by Tao Pang and      //
//     published by Cambridge University Press on January 19, 2006.      //
//                                                                       //
// (2) No warranties, express or implied, are made for this program.     //
//                                                                       //
///////////////////////////////////////////////////////////////////////////

// An example of solving a linear equation set via the
// partial-pivoting Gaussian elimination.

import java.lang.*;
public class LinearEq{
  public static void main(String argv[]) {
    int n = 3;
    double x[] = new double[n];
    double b[] = {200,0,0};
    double a[][]= {{ 100,  100,  100},
                   {-100,  300, -100},
                   {-100, -100,  300}};   
    int index[] = new int[n];
    x = solve(a, b, index);

    for (int i=0; i
|
Home
|
Solver
|
Examples

|
Help
|
About
|