answersLogoWhite

0

A number of well-tested open-source Matrix Java libraries are available. Best to find and use one that's been around for a while since most of the bugs have been worked out. If you need to write your own it's still worth-while to examine the APIs of those libraries first.

JAMA is a free Java library for basic linear algebra and matrix operations developed as a straightforward public-domain reference implementation by MathWorks and NIST.

Example of Use. The following simple example solves a 3x3 linear system Ax=b and computes the norm of the residual.

double[][] array = {{1.,2.,3},{4.,5.,6.},{7.,8.,10.}};

Matrix A = new Matrix(array);

Matrix b = Matrix.random(3,1);

Matrix x = A.solve(b);

Matrix Residual = A.times(x).minus(b);

double rnorm = Residual.normInf();

User Avatar

Wiki User

13y ago

Still curious? Ask our experts.

Chat with our AI personalities

FranFran
I've made my fair share of mistakes, and if I can help you avoid a few, I'd sure like to try.
Chat with Fran
BeauBeau
You're doing better than you think!
Chat with Beau
MaxineMaxine
I respect you enough to keep it real.
Chat with Maxine
More answers

In Java, you add numbers with the "+" operator. For example, if you want to add "a" and "b", and copy the result to variable "c", the command would be:

c = a + b;

User Avatar

Wiki User

12y ago
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a java package program for addition?
Write your answer...
Submit
Still have questions?
magnify glass
imp