Java tutorial
import org.apache.commons.math3.linear.ArrayRealVector; import org.apache.commons.math3.linear.MatrixUtils; import org.apache.commons.math3.linear.RealMatrix; import org.apache.commons.math3.linear.RealVector; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author newuser */ public class Theta { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here double[] u = { 1, 1 }; double[] v = { 7, 9 }; RealVector vectorU = new ArrayRealVector(u); RealVector vectorV = new ArrayRealVector(v); double distance = vectorU.getDistance(vectorV); System.out.println(distance); //RealVector projected=vectorU.projection(vectorV); //System.out.println(projected.toString()); } }