test/Tools/isac/Knowledge/simplify.sml
changeset 52105 2786cc9704c8
parent 42400 dcacb8077a98
child 55402 d580d7fc9b8e
equal deleted inserted replaced
52104:83166e7c7e52 52105:2786cc9704c8
    42 "----------- append inform with final result ------------";
    42 "----------- append inform with final result ------------";
    43 "----------- append inform with final result ------------";
    43 "----------- append inform with final result ------------";
    44 "----------- append inform with final result ------------";
    44 "----------- append inform with final result ------------";
    45 states:=[];
    45 states:=[];
    46 CalcTree [(["Term ((14 * x * y) / ( x * y ))", "normalform N"],
    46 CalcTree [(["Term ((14 * x * y) / ( x * y ))", "normalform N"],
    47 	   ("Rational",["rational","simplification"],
    47 	("Rational", ["rational","simplification"], ["simplification","of_rationals"]))];
    48 	    ["simplification","of_rationals"]))];
       
    49 Iterator 1;
    48 Iterator 1;
    50 moveActiveRoot 1;
    49 moveActiveRoot 1;
    51 autoCalculate 1 CompleteCalcHead;
    50 autoCalculate 1 CompleteCalcHead;
    52 
    51 val ((pt,p),_) = get_calc 1; show_pt pt; 
    53 val ((pt,p),_) = get_calc 1;
    52 (*[
    54 pt_extract (pt, p);
    53 (([], Frm), Simplify (14 * x * y / (x * y)))] *)
       
    54 pt_extract (pt, p); (*determines SOME (Apply_Method ["simplification", "of_rationals"])*)
    55 
    55 
    56 autoCalculate 1 (Step 1);
    56 autoCalculate 1 (Step 1);
       
    57 val ((pt,p),_) = get_calc 1; show_pt pt;
       
    58 (*[
       
    59 (([], Frm), Simplify (14 * x * y / (x * y))),
       
    60 (([1], Frm), 14 * x * y / (x * y))] *)
    57 
    61 
    58 appendFormula 1 "14";
    62 appendFormula 1 "14";
    59 val ((pt,p),_) = get_calc 1; show_pt pt;
    63 val ((pt,p),_) = get_calc 1; show_pt pt;
       
    64 (*[
       
    65 (([], Frm), Simplify (14 * x * y / (x * y))),
       
    66 (([1], Frm), 14 * x * y / (x * y)),
       
    67 (([1,1], Frm), 14 * x * y / (x * y)),
       
    68 (([1,1], Res), 14 * (x * y) / (x * y)),
       
    69 (([1,2], Res), 14 / 1),
       
    70 (([1,3], Res), 14),
       
    71 (([1], Res), 14)]*)
    60 
    72 
    61 autoCalculate 1 (Step 1);
    73 autoCalculate 1 (Step 1);
    62 val ((pt,p),_) = get_calc 1; show_pt pt;
    74 val ((pt,p),_) = get_calc 1; show_pt pt;
       
    75 (*[
       
    76 (([], Frm), Simplify (14 * x * y / (x * y))),
       
    77 (([1], Frm), 14 * x * y / (x * y)),
       
    78 (([1,1], Frm), 14 * x * y / (x * y)),
       
    79 (([1,1], Res), 14 * (x * y) / (x * y)),
       
    80 (([1,2], Res), 14 / 1),
       
    81 (([1,3], Res), 14),
       
    82 (([1], Res), 14),
       
    83 (([], Res), 14)] *)
    63 val Form res = (#1 o pt_extract) (pt, ([],Res));
    84 val Form res = (#1 o pt_extract) (pt, ([],Res));
    64 term2str res = "??.empty";
       
    65 if p = ([], Res) andalso term2str res = "14" then ()
    85 if p = ([], Res) andalso term2str res = "14" then ()
    66 else error "simplify.sml: append inform with final result ?!?";
    86 else error "simplify.sml: append inform with final result changed";
    67 
    87