test/Tools/isac/Knowledge/eqsystem.sml
changeset 59984 08296690e7a6
parent 59973 8a46c2e7c27a
child 59997 46fe5a8c3911
equal deleted inserted replaced
59983:f1fdb213717b 59984:08296690e7a6
   314 Operand:   L :: real                 ========== L was already present in equalities ========== *)
   314 Operand:   L :: real                 ========== L was already present in equalities ========== *)
   315 
   315 
   316 "===== case 1 =====";
   316 "===== case 1 =====";
   317 val matches = Refine.refine fmz ["LINEAR","system"];
   317 val matches = Refine.refine fmz ["LINEAR","system"];
   318 case matches of 
   318 case matches of 
   319  [Model.Matches (["LINEAR", "system"], _),
   319  [M_Match.Matches (["LINEAR", "system"], _),
   320   Model.Matches (["2x2", "LINEAR", "system"], _),
   320   M_Match.Matches (["2x2", "LINEAR", "system"], _),
   321   Model.NoMatch (["triangular", "2x2", "LINEAR", "system"], _),
   321   M_Match.NoMatch (["triangular", "2x2", "LINEAR", "system"], _),
   322 		  Model.Matches (["normalise", "2x2", "LINEAR", "system"],
   322 		  M_Match.Matches (["normalise", "2x2", "LINEAR", "system"],
   323 			    {Find = [Correct "solution LL"],
   323 			    {Find = [Correct "solution LL"],
   324 			     With = [],
   324 			     With = [],
   325 			     Given =
   325 			     Given =
   326 			       [Correct
   326 			       [Correct
   327 				"equalities\n [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,\n  0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2]",
   327 				"equalities\n [0 = -1 * q_0 * 0 ^^^ 2 / 2 + 0 * c + c_2,\n  0 = -1 * q_0 * L ^^^ 2 / 2 + L * c + c_2]",
   333 "===== case 2 =====";
   333 "===== case 2 =====";
   334 val fmz = ["equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]", 
   334 val fmz = ["equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]", 
   335 	   "solveForVars [c, c_2]", "solution LL"];
   335 	   "solveForVars [c, c_2]", "solution LL"];
   336 val matches = Refine.refine fmz ["LINEAR","system"];
   336 val matches = Refine.refine fmz ["LINEAR","system"];
   337 case matches of [_,_,
   337 case matches of [_,_,
   338 		  Model.Matches
   338 		  M_Match.Matches
   339 		    (["triangular", "2x2", "LINEAR", "system"],
   339 		    (["triangular", "2x2", "LINEAR", "system"],
   340 		      {Find = [Correct "solution LL"],
   340 		      {Find = [Correct "solution LL"],
   341 		       With = [],
   341 		       With = [],
   342 		       Given =
   342 		       Given =
   343 		        [Correct "equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]",
   343 		        [Correct "equalities [c_2 = 0, L * c + c_2 = q_0 * L ^^^ 2 / 2]",
   389 Operator:  op # c_3 :: 'a list \<Rightarrow> 'a list
   389 Operator:  op # c_3 :: 'a list \<Rightarrow> 'a list
   390 Operand:   [c_4] :: 'b list
   390 Operand:   [c_4] :: 'b list
   391 \-------------------------------------------------------/
   391 \-------------------------------------------------------/
   392 val matches = Refine.refine fmz ["LINEAR","system"];
   392 val matches = Refine.refine fmz ["LINEAR","system"];
   393 case matches of 
   393 case matches of 
   394     [Model.Matches (["LINEAR", "system"], _),
   394     [M_Match.Matches (["LINEAR", "system"], _),
   395      Model.NoMatch (["2x2", "LINEAR", "system"], _),
   395      M_Match.NoMatch (["2x2", "LINEAR", "system"], _),
   396      Model.NoMatch (["3x3", "LINEAR", "system"], _),
   396      M_Match.NoMatch (["3x3", "LINEAR", "system"], _),
   397      Model.Matches (["4x4", "LINEAR", "system"], _),
   397      M_Match.Matches (["4x4", "LINEAR", "system"], _),
   398      Model.NoMatch (["triangular", "4x4", "LINEAR", "system"], _),
   398      M_Match.NoMatch (["triangular", "4x4", "LINEAR", "system"], _),
   399      Model.Matches (["normalise", "4x4", "LINEAR", "system"], _)] => ()
   399      M_Match.Matches (["normalise", "4x4", "LINEAR", "system"], _)] => ()
   400   | _ => error "eqsystem.sml: Refine.refine relaxed triangular sys Model.NoMatch";
   400   | _ => error "eqsystem.sml: Refine.refine relaxed triangular sys M_Match.NoMatch";
   401 (*WN060914 does NOT match, because 3rd and 4th equ are not ordered*)
   401 (*WN060914 does NOT match, because 3rd and 4th equ are not ordered*)
   402 
   402 
   403 "===== case 4 =====";
   403 "===== case 4 =====";
   404 val fmz = ["equalities [L * q_0 = c,                                       \
   404 val fmz = ["equalities [L * q_0 = c,                                       \
   405 	   \            0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2,\
   405 	   \            0 = (2 * c_2 + 2 * L * c + -1 * L ^^^ 2 * q_0) / 2,\
   406 	   \            0 = c_3,                           \
   406 	   \            0 = c_3,                           \
   407 	   \            0 = c_4]", 
   407 	   \            0 = c_4]", 
   408 	   "solveForVars [c, c_2, c_3, c_4]", "solution LL"];
   408 	   "solveForVars [c, c_2, c_3, c_4]", "solution LL"];
   409 val matches = Refine.refine fmz ["triangular", "4x4", "LINEAR","system"];
   409 val matches = Refine.refine fmz ["triangular", "4x4", "LINEAR","system"];
   410 case matches of 
   410 case matches of 
   411     [Model.Matches (["triangular", "4x4", "LINEAR", "system"], _)] => ()
   411     [M_Match.Matches (["triangular", "4x4", "LINEAR", "system"], _)] => ()
   412   | _ => error "eqsystem.sml: Refine.refine relaxed triangular sys Model.NoMatch";
   412   | _ => error "eqsystem.sml: Refine.refine relaxed triangular sys M_Match.NoMatch";
   413 val matches = Refine.refine fmz ["LINEAR","system"];
   413 val matches = Refine.refine fmz ["LINEAR","system"];
   414 ============ inhibit exn WN120314 ==============================================*)
   414 ============ inhibit exn WN120314 ==============================================*)
   415 
   415 
   416 "----------- Refine.refine [2x2,linear,system] search error--------------";
   416 "----------- Refine.refine [2x2,linear,system] search error--------------";
   417 "----------- Refine.refine [2x2,linear,system] search error--------------";
   417 "----------- Refine.refine [2x2,linear,system] search error--------------";