Linear equations task

When we graduated that does not mean we should stop learning, this is what at least I believe. These days after graduation I worked on some projects, below is one of them:

This was a program I created after university to keep my skills, up-to-date.
As I am a passionate Mathematical, I created a program which allowed me to find out “determinant” of the 3x3 matrix coefficients and also find whether the matrix has any solution. In other word, I found out whether this matrix has any dependent or independent row. I used many Array, ArrayList, double and other primitive types to accomplish this program.

You can download the code here. Below is small part of code.

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Scanner;

 * @author Mehdi Dana
 * @date 25/07/2012

public class MathDana {
  * @param args
  * @throws IOException 

 // round a double value
 public static double roundTwoDecimals(double d) {
  DecimalFormat twoDForm = new DecimalFormat("#.##");
  return Double.valueOf(twoDForm.format(d));
 // compare two arraylist, whether they are the same or not
 public static boolean compareArrayList(ArrayList< Double> arr1, ArrayList< Double> arr2){
  boolean ans = true;
  for(int i=0; i < arr1.size(); i++){
   double tem1 = roundTwoDecimals( arr1.get(i));
   double tem2 = roundTwoDecimals( arr2.get(i));
   if(tem1 != tem2){ 
    ans = false;
  return ans;

 // many methods here

 // main method
 public static void main(String[] args) throws IOException {
  try {
   // a lot code here
  }catch(Exception e){
   System.out.println("Your input is wrong");
   // e.printStackTrace(); // to track error if there is 



Popular posts from this blog

I solved GCHQ puzzle and this is how I did it

The best way to predict the future is to create it

Why I don't have social media account?