Hi,
I have a test I wish to show to you.
Here is the code test:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package es.upm.fi.algebralineal;
import java.util.logging.Level;
import java.util.logging.Logger;
import jscl.math.Expression;
import jscl.math.Generic;
import jscl.text.ParseException;
/**
*
* @author raul
*/
public class ExpressionTest {
public static void main(String args[]) {
try {
Generic v1 = Expression.valueOf("{1/sqrt(5), 2/sqrt(5)}");
Generic v2 = Expression.valueOf("{(-4)/sqrt(20), 2/sqrt(20)}");
Generic u1 = Expression.valueOf("{1/sqrt(5), 2/sqrt(5)}");
Generic u2 = Expression.valueOf("{(-4)/(2*sqrt(5)), 2/(2*sqrt(5))}");
System.out.println("v1.equals(u1) -> " + v1.equals(u1));
System.out.println("v2.equals(u2) -> " + v2.equals(u2));
System.out.println("v2.simplify().equals(u2) -> " + v2.simplify().equals(u2));
System.out.println("v2.simplify().equals(u2.simplfy()) -> " + v2.simplify().equals(u2.simplify()));
} catch (ParseException ex) {
Logger.getLogger(ExpressionTest.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
and this is the output after running it:
v1.equals(u1) -> true
v2.equals(u2) -> false
v2.simplify().equals(u2) -> false
v2.simplify().equals(u2.simplfy()) -> true
In my opinion all tests must return true.
Im using meditor 2.3 and java 1.6.0_03 (sun)
You can contact me at raul.selas@gmail.com
regards,
Raúl
test sources
I agree that there should be a canonical representation of algebraic numbers, without having to call simplify. This is the path I am taking with ScAS, see for instance https://meditorworld.appspot.com/scas2/examples/an.txt .