Hello, I have been trying to make my own algorithm for normalizing a vector (length 1). The problem is that when I take a "new Vector<Rational>," do the computation, and put it into the square root, the square root doesn't know what to do with it because it's Rational.
Here's what I've been trying:
declare $v=new Vector<Rational>([1,7,8,9,6,4,7,6,5]);
declare @array=$v;
print "@array\n";
declare @array2=(1);
declare $sum=0;
for (declare $i=0;$i<9;$i++) {
$sum=$sum+$array[$i]*$array[$i];
}
print sqrt($sum);