src/Tools/isac/Knowledge/Partial_Fractions.thy
author Walther Neuper <wneuper@ist.tugraz.at>
Wed, 21 Nov 2018 12:32:54 +0100
changeset 59472 3e904f8ec16c
parent 59416 229e5c9cf78b
child 59473 28b67cae58c3
permissions -rw-r--r--
update to new Isabelle conventions: {*...*} to \<open>...\<close>
neuper@42376
     1
(* Partial_Fractions 
jan@42344
     2
   author: Jan Rocnik, isac team
jan@42344
     3
   Copyright (c) isac team 2011
jan@42344
     4
   Use is subject to license terms.
jan@42344
     5
*)
wneuper@59344
     6
(* Partial Fraction Decomposition *)
jan@42344
     7
neuper@42289
     8
neuper@42376
     9
theory Partial_Fractions imports RootRatEq begin
jan@42353
    10
wneuper@59472
    11
ML\<open>
neuper@42376
    12
(*
jan@42353
    13
signature PARTFRAC =
jan@42353
    14
sig
jan@42353
    15
  val ansatz_rls : rls
jan@42353
    16
  val ansatz_rls_ : theory -> term -> (term * term list) option
jan@42353
    17
end
neuper@42376
    18
*)
wneuper@59472
    19
\<close>
jan@42353
    20
wneuper@59472
    21
subsection \<open>eval_ functions\<close>
jan@42344
    22
consts
neuper@42359
    23
  factors_from_solution :: "bool list => real"
neuper@42359
    24
  drop_questionmarks    :: "'a => 'a"
jan@42344
    25
wneuper@59472
    26
text \<open>these might be used for variants of fac_from_sol\<close>
wneuper@59472
    27
ML \<open>
jan@42344
    28
fun mk_minus_1 T = Free("-1", T); (*TODO DELETE WITH numbers_to_string*)
jan@42344
    29
fun flip_sign t = (*TODO improve for use in factors_from_solution: -(-1) etc*)
jan@42344
    30
  let val minus_1 = t |> type_of |> mk_minus_1
jan@42344
    31
  in HOLogic.mk_binop "Groups.times_class.times" (minus_1, t) end;
wneuper@59472
    32
\<close>
neuper@42376
    33
wneuper@59472
    34
text \<open>from solutions (e.g. [z = 1, z = -2]) make linear factors (e.g. (z - 1)*(z - -2))\<close>
wneuper@59472
    35
ML \<open>
jan@42344
    36
fun fac_from_sol s =
jan@42344
    37
  let val (lhs, rhs) = HOLogic.dest_eq s
jan@42367
    38
  in HOLogic.mk_binop "Groups.minus_class.minus" (lhs, rhs) end;
jan@42344
    39
jan@42344
    40
fun mk_prod prod [] =
wneuper@59416
    41
      if prod = Rule.e_term then error "mk_prod called with []" else prod
jan@42344
    42
  | mk_prod prod (t :: []) =
wneuper@59416
    43
      if prod = Rule.e_term then t else HOLogic.mk_binop "Groups.times_class.times" (prod, t)
jan@42344
    44
  | mk_prod prod (t1 :: t2 :: ts) =
wneuper@59416
    45
        if prod = Rule.e_term 
jan@42344
    46
        then 
jan@42344
    47
           let val p = HOLogic.mk_binop "Groups.times_class.times" (t1, t2)
jan@42344
    48
           in mk_prod p ts end 
jan@42344
    49
        else 
jan@42344
    50
           let val p = HOLogic.mk_binop "Groups.times_class.times" (prod, t1)
jan@42344
    51
           in mk_prod p (t2 :: ts) end 
jan@42344
    52
jan@42344
    53
fun factors_from_solution sol = 
jan@42344
    54
  let val ts = HOLogic.dest_list sol
wneuper@59416
    55
  in mk_prod Rule.e_term (map fac_from_sol ts) end;
jan@42344
    56
neuper@42376
    57
(*("factors_from_solution", ("Partial_Fractions.factors_from_solution", 
neuper@42376
    58
     eval_factors_from_solution ""))*)
jan@42352
    59
fun eval_factors_from_solution (thmid:string) _
jan@42352
    60
     (t as Const ("Partial_Fractions.factors_from_solution", _) $ sol) thy =
jan@42352
    61
       ((let val prod = factors_from_solution sol
wneuper@59416
    62
         in SOME (TermC.mk_thmid thmid (Rule.term_to_string''' thy prod) "",
wneuper@59390
    63
              HOLogic.Trueprop $ (TermC.mk_equality (t, prod)))
jan@42352
    64
         end)
jan@42352
    65
       handle _ => NONE)
jan@42352
    66
 | eval_factors_from_solution _ _ _ _ = NONE;
wneuper@59472
    67
\<close>
jan@42344
    68
wneuper@59472
    69
text \<open>'ansatz' introduces '?Vars' (questionable design); drop these again\<close>
wneuper@59472
    70
ML \<open>
neuper@42359
    71
(*("drop_questionmarks", ("Partial_Fractions.drop_questionmarks", eval_drop_questionmarks ""))*)
neuper@42359
    72
fun eval_drop_questionmarks (thmid:string) _
neuper@42359
    73
     (t as Const ("Partial_Fractions.drop_questionmarks", _) $ tm) thy =
wneuper@59389
    74
        if TermC.contains_Var tm
neuper@42359
    75
        then
neuper@42359
    76
          let
wneuper@59389
    77
            val tm' = TermC.var2free tm
wneuper@59416
    78
            in SOME (TermC.mk_thmid thmid (Rule.term_to_string''' thy tm') "",
wneuper@59390
    79
                 HOLogic.Trueprop $ (TermC.mk_equality (t, tm')))
neuper@42359
    80
            end
neuper@42359
    81
        else NONE
neuper@42359
    82
  | eval_drop_questionmarks _ _ _ _ = NONE;
wneuper@59472
    83
\<close>
neuper@42359
    84
wneuper@59472
    85
text \<open>store eval_ functions for calls from Scripts\<close>
wneuper@59472
    86
setup \<open>KEStore_Elems.add_calcs
wneuper@59472
    87
  [("drop_questionmarks", ("Partial_Fractions.drop'_questionmarks", eval_drop_questionmarks ""))]\<close>
neuper@42359
    88
wneuper@59472
    89
subsection \<open>'ansatz' for partial fractions\<close>
jan@42353
    90
axiomatization where
jan@42358
    91
  ansatz_2nd_order: "n / (a*b) = A/a + B/b" and
neuper@42376
    92
  ansatz_3rd_order: "n / (a*b*c) = A/a + B/b + C/c" and
neuper@42376
    93
  ansatz_4th_order: "n / (a*b*c*d) = A/a + B/b + C/c + D/d" and
neuper@42386
    94
  (*version 1*)
neuper@42376
    95
  equival_trans_2nd_order: "(n/(a*b) = A/a + B/b) = (n = A*b + B*a)" and
neuper@42376
    96
  equival_trans_3rd_order: "(n/(a*b*c) = A/a + B/b + C/c) = (n = A*b*c + B*a*c + C*a*b)" and
neuper@42376
    97
  equival_trans_4th_order: "(n/(a*b*c*d) = A/a + B/b + C/c + D/d) = 
neuper@42386
    98
    (n = A*b*c*d + B*a*c*d + C*a*b*d + D*a*b*c)" and
neuper@42386
    99
  (*version 2: not yet used, see partial_fractions.sml*)
neuper@42387
   100
  multiply_2nd_order: "(n/x = A/a + B/b) = (a*b*n/x = A*b + B*a)" and
neuper@42387
   101
  multiply_3rd_order: "(n/x = A/a + B/b + C/c) = (a*b*c*n/x = A*b*c + B*a*c + C*a*b)" and
neuper@42387
   102
  multiply_4th_order: 
neuper@42387
   103
    "(n/x = A/a + B/b + C/c + D/d) = (a*b*c*d*n/x = A*b*c*d + B*a*c*d + C*a*b*d + D*a*b*c)"
neuper@42387
   104
wneuper@59472
   105
text \<open>Probably the optimal formalization woudl be ...
neuper@42387
   106
neuper@42386
   107
  multiply_2nd_order: "x = a*b ==> (n/x = A/a + B/b) = (a*b*n/x = A*b + B*a)" and
neuper@42386
   108
  multiply_3rd_order: "x = a*b*c ==>
neuper@42386
   109
    (n/x = A/a + B/b + C/c) = (a*b*c*n/x = A*b*c + B*a*c + C*a*b)" and
neuper@42386
   110
  multiply_4th_order: "x = a*b*c*d ==>
neuper@42386
   111
    (n/x = A/a + B/b + C/c + D/d) = (a*b*c*d*n/x = A*b*c*d + B*a*c*d + C*a*b*d + D*a*b*c)"
jan@42353
   112
neuper@42387
   113
... because it would allow to start the ansatz as follows
neuper@42387
   114
(1) 3 / (z * (z - 1 / 4 + -1 / 8 * (1 / z))) = 3 / (z * (z - 1 / 4 + -1 / 8 * (1 / z)))
neuper@42387
   115
(2) 3 / (z * (z - 1 / 4 + -1 / 8 * (1 / z))) = AA / (z - 1 / 2) + BB / (z - -1 / 4)
neuper@42387
   116
(3) (z - 1 / 2) * (z - -1 / 4) * 3 / (z * (z - 1 / 4 + -1 / 8 * (1 / z))) = 
neuper@42387
   117
    (z - 1 / 2) * (z - -1 / 4) * AA / (z - 1 / 2) + BB / (z - -1 / 4)
neuper@42387
   118
(4) 3 = A * (z - -1 / 4) + B * (z - 1 / 2)
neuper@42387
   119
neuper@42387
   120
... (1==>2) ansatz
neuper@42387
   121
    (2==>3) multiply_*
neuper@42387
   122
    (3==>4) norm_Rational
neuper@42387
   123
TODOs for this version ar in partial_fractions.sml "--- progr.vers.2: "
wneuper@59472
   124
\<close>
neuper@42387
   125
wneuper@59472
   126
ML \<open>
s1210629013@55444
   127
val ansatz_rls = prep_rls'(
wneuper@59416
   128
  Rule.Rls {id = "ansatz_rls", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
wneuper@59416
   129
	  erls = Rule.Erls, srls = Rule.Erls, calc = [], errpatts = [],
jan@42353
   130
	  rules = 
wneuper@59416
   131
	   [Rule.Thm ("ansatz_2nd_order",TermC.num_str @{thm ansatz_2nd_order}),
wneuper@59416
   132
	    Rule.Thm ("ansatz_3rd_order",TermC.num_str @{thm ansatz_3rd_order})
jan@42353
   133
	   ], 
wneuper@59416
   134
	 scr = Rule.EmptyScr});
jan@42353
   135
s1210629013@55444
   136
val equival_trans = prep_rls'(
wneuper@59416
   137
  Rule.Rls {id = "equival_trans", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
wneuper@59416
   138
	  erls = Rule.Erls, srls = Rule.Erls, calc = [], errpatts = [],
jan@42354
   139
	  rules = 
wneuper@59416
   140
	   [Rule.Thm ("equival_trans_2nd_order",TermC.num_str @{thm equival_trans_2nd_order}),
wneuper@59416
   141
	    Rule.Thm ("equival_trans_3rd_order",TermC.num_str @{thm equival_trans_3rd_order})
jan@42354
   142
	   ], 
wneuper@59416
   143
	 scr = Rule.EmptyScr});
neuper@42386
   144
s1210629013@55444
   145
val multiply_ansatz = prep_rls'(
wneuper@59416
   146
  Rule.Rls {id = "multiply_ansatz", preconds = [], rew_ord = ("dummy_ord",Rule.dummy_ord), 
wneuper@59416
   147
	  erls = Rule.Erls,
wneuper@59416
   148
	  srls = Rule.Erls, calc = [], errpatts = [],
neuper@42386
   149
	  rules = 
wneuper@59416
   150
	   [Rule.Thm ("multiply_2nd_order",TermC.num_str @{thm multiply_2nd_order})
neuper@42386
   151
	   ], 
wneuper@59416
   152
	 scr = Rule.EmptyScr});
wneuper@59472
   153
\<close>
jan@42354
   154
wneuper@59472
   155
text \<open>store the rule set for math engine\<close>
wneuper@59472
   156
setup \<open>KEStore_Elems.add_rlss 
neuper@52125
   157
  [("ansatz_rls", (Context.theory_name @{theory}, ansatz_rls)), 
neuper@52125
   158
  ("multiply_ansatz", (Context.theory_name @{theory}, multiply_ansatz)), 
wneuper@59472
   159
  ("equival_trans", (Context.theory_name @{theory}, equival_trans))]\<close>
jan@42344
   160
wneuper@59472
   161
subsection \<open>Specification\<close>
jan@42344
   162
neuper@42376
   163
consts
neuper@42376
   164
  decomposedFunction :: "real => una"
neuper@42376
   165
wneuper@59472
   166
ML \<open>
wneuper@59406
   167
Celem.check_guhs_unique := false; (*WN120307 REMOVE after editing*)
wneuper@59472
   168
\<close>
wneuper@59472
   169
setup \<open>KEStore_Elems.add_pbts
wneuper@59406
   170
  [(Specify.prep_pbt @{theory} "pbl_simp_rat_partfrac" [] Celem.e_pblID
s1210629013@55339
   171
      (["partial_fraction", "rational", "simplification"],
s1210629013@55339
   172
        [("#Given" ,["functionTerm t_t", "solveFor v_v"]),
s1210629013@55339
   173
          (* TODO: call this sub-problem with appropriate functionTerm: 
s1210629013@55339
   174
            leading coefficient of the denominator is 1: to be checked here! and..
s1210629013@55339
   175
            ("#Where" ,["((get_numerator t_t) has_degree_in v_v) < 
s1210629013@55339
   176
               ((get_denominator t_t) has_degree_in v_v)"]), TODO*)
s1210629013@55339
   177
          ("#Find"  ,["decomposedFunction p_p'''"])],
wneuper@59416
   178
        Rule.append_rls "e_rls" Rule.e_rls [(*for preds in where_ TODO*)], 
s1210629013@55339
   179
        NONE, 
wneuper@59472
   180
        [["simplification","of_rationals","to_partial_fraction"]]))]\<close>
jan@42354
   181
wneuper@59472
   182
subsection \<open>Method\<close>
neuper@42376
   183
consts
neuper@42376
   184
  PartFracScript  :: "[real,real,  real] => real" 
neuper@42376
   185
    ("((Script PartFracScript (_ _ =))// (_))" 9)
jan@42353
   186
wneuper@59472
   187
text \<open>rule set for functions called in the Script\<close>
wneuper@59472
   188
ML \<open>
wneuper@59416
   189
  val srls_partial_fraction = Rule.Rls {id="srls_partial_fraction", 
neuper@42376
   190
    preconds = [],
neuper@42376
   191
    rew_ord = ("termlessI",termlessI),
wneuper@59416
   192
    erls = Rule.append_rls "erls_in_srls_partial_fraction" Rule.e_rls
neuper@42376
   193
      [(*for asm in NTH_CONS ...*)
wneuper@59416
   194
       Rule.Calc ("Orderings.ord_class.less",eval_equ "#less_"),
neuper@42376
   195
       (*2nd NTH_CONS pushes n+-1 into asms*)
wneuper@59416
   196
       Rule.Calc("Groups.plus_class.plus", eval_binop "#add_")], 
wneuper@59416
   197
    srls = Rule.Erls, calc = [], errpatts = [],
neuper@42376
   198
    rules = [
wneuper@59416
   199
       Rule.Thm ("NTH_CONS",TermC.num_str @{thm NTH_CONS}),
wneuper@59416
   200
       Rule.Calc("Groups.plus_class.plus", eval_binop "#add_"),
wneuper@59416
   201
       Rule.Thm ("NTH_NIL",TermC.num_str @{thm NTH_NIL}),
wneuper@59416
   202
       Rule.Calc("Tools.lhs", eval_lhs "eval_lhs_"),
wneuper@59416
   203
       Rule.Calc("Tools.rhs", eval_rhs"eval_rhs_"),
wneuper@59416
   204
       Rule.Calc("Atools.argument'_in", eval_argument_in "Atools.argument'_in"),
wneuper@59416
   205
       Rule.Calc("Rational.get_denominator", eval_get_denominator "#get_denominator"),
wneuper@59416
   206
       Rule.Calc("Rational.get_numerator", eval_get_numerator "#get_numerator"),
wneuper@59416
   207
       Rule.Calc("Partial_Fractions.factors_from_solution",
neuper@42376
   208
         eval_factors_from_solution "#factors_from_solution"),
wneuper@59416
   209
       Rule.Calc("Partial_Fractions.drop_questionmarks", eval_drop_questionmarks "#drop_?")],
wneuper@59416
   210
    scr = Rule.EmptyScr};
wneuper@59472
   211
\<close>
wneuper@59472
   212
ML \<open>
neuper@42376
   213
eval_drop_questionmarks;
wneuper@59472
   214
\<close>
wneuper@59472
   215
ML \<open>
neuper@48761
   216
val ctxt = Proof_Context.init_global @{theory};
wneuper@59389
   217
val SOME t = TermC.parseNEW ctxt "eqr = drop_questionmarks eqr";
wneuper@59472
   218
\<close>
wneuper@59472
   219
ML \<open>
wneuper@59389
   220
TermC.parseNEW ctxt "decomposedFunction p_p'''";
wneuper@59389
   221
TermC.parseNEW ctxt "decomposedFunction";
wneuper@59472
   222
\<close>
neuper@42415
   223
s1210629013@55380
   224
(* current version, error outcommented *)
wneuper@59472
   225
setup \<open>KEStore_Elems.add_mets
wneuper@59406
   226
  [Specify.prep_met @{theory} "met_partial_fraction" [] Celem.e_metID
s1210629013@55373
   227
      (["simplification","of_rationals","to_partial_fraction"], 
s1210629013@55373
   228
        [("#Given" ,["functionTerm t_t", "solveFor v_v"]),
s1210629013@55373
   229
          (*("#Where" ,["((get_numerator t_t) has_degree_in v_v) < 
s1210629013@55373
   230
            ((get_denominator t_t) has_degree_in v_v)"]), TODO*)
s1210629013@55373
   231
          ("#Find"  ,["decomposedFunction p_p'''"])],
s1210629013@55373
   232
        (*f_f = 3 / (z * (z - 1 / 4 + -1 / 8 * (1 / z)), zzz: z*)
wneuper@59416
   233
        {rew_ord'="tless_true", rls'= Rule.e_rls, calc = [], srls = srls_partial_fraction, prls = Rule.e_rls,
wneuper@59416
   234
          crls = Rule.e_rls, errpats = [], nrls = Rule.e_rls},
s1210629013@55373
   235
        (*([], Frm), Problem (Partial_Fractions, [partial_fraction, rational, simplification])*)
s1210629013@55373
   236
        "Script PartFracScript (f_f::real) (zzz::real) =   " ^
s1210629013@55373
   237
          (*([1], Frm), 3 / (z * (z - 1 / 4 + -1 / 8 * (1 / z)))*)
s1210629013@55373
   238
          "(let f_f = Take f_f;                              " ^
s1210629013@55373
   239
          (*           num_orig = 3*)
s1210629013@55373
   240
          "  (num_orig::real) = get_numerator f_f;           " ^
s1210629013@55373
   241
          (*([1], Res), 24 / (-1 + -2 * z + 8 * z ^^^ 2)*)
s1210629013@55373
   242
          "  f_f = (Rewrite_Set norm_Rational False) f_f;    " ^
s1210629013@55373
   243
          (*           denom = -1 + -2 * z + 8 * z ^^^ 2*)
s1210629013@55373
   244
          "  (denom::real) = get_denominator f_f;            " ^
s1210629013@55373
   245
          (*           equ = -1 + -2 * z + 8 * z ^^^ 2 = 0*)
s1210629013@55373
   246
          "  (equ::bool) = (denom = (0::real));              " ^
s1210629013@55373
   247
s1210629013@55373
   248
          (*([2], Pbl), solve (-1 + -2 * z + 8 * z ^^^ 2 = 0, z)*)
s1210629013@55373
   249
          "  (L_L::bool list) = (SubProblem (PolyEq',        " ^
s1210629013@55373
   250
          "    [abcFormula, degree_2, polynomial, univariate, equation], " ^
s1210629013@55373
   251
          (*([2], Res), [z = 1 / 2, z = -1 / 4]*)
s1210629013@55373
   252
          "    [no_met]) [BOOL equ, REAL zzz]);              " ^
s1210629013@55373
   253
          (*           facs: (z - 1 / 2) * (z - -1 / 4)*)
s1210629013@55373
   254
          "  (facs::real) = factors_from_solution L_L;       " ^
s1210629013@55373
   255
          (*([3], Frm), 33 / ((z - 1 / 2) * (z - -1 / 4)) *) 
s1210629013@55373
   256
          "  (eql::real) = Take (num_orig / facs);           " ^
s1210629013@55373
   257
          (*([3], Res), ?A / (z - 1 / 2) + ?B / (z - -1 / 4)*)
s1210629013@55373
   258
          "  (eqr::real) = (Try (Rewrite_Set ansatz_rls False)) eql;  " ^
s1210629013@55373
   259
          (*([4], Frm), 3 / ((z - 1 / 2) * (z - -1 / 4)) = ?A / (z - 1 / 2) + ?B / (z - -1 / 4)*)
s1210629013@55373
   260
          "  (eq::bool) = Take (eql = eqr);                  " ^
s1210629013@55373
   261
          (*([4], Res), 3 = ?A * (z - -1 / 4) + ?B * (z - 1 / 2)*)
s1210629013@55373
   262
          "  eq = (Try (Rewrite_Set equival_trans False)) eq;" ^
s1210629013@55373
   263
          (*           eq = 3 = A * (z - -1 / 4) + B * (z - 1 / 2)*)
s1210629013@55373
   264
          "  eq = drop_questionmarks eq;                     " ^
s1210629013@55373
   265
          (*           z1 = 1 / 2*)
s1210629013@55373
   266
          "  (z1::real) = (rhs (NTH 1 L_L));                 " ^
s1210629013@55373
   267
          (*           z2 = -1 / 4*)
s1210629013@55373
   268
          "  (z2::real) = (rhs (NTH 2 L_L));                 " ^
s1210629013@55373
   269
          (*([5], Frm), 3 = A * (z - -1 / 4) + B * (z - 1 / 2)*)
s1210629013@55373
   270
          "  (eq_a::bool) = Take eq;                         " ^
s1210629013@55373
   271
          (*([5], Res), 3 = A * (1 / 2 - -1 / 4) + B * (1 / 2 - 1 / 2)*)
s1210629013@55373
   272
          "  eq_a = (Substitute [zzz = z1]) eq;              " ^
s1210629013@55373
   273
          (*([6], Res), 3 = 3 * A / 4*)
s1210629013@55373
   274
          "  eq_a = (Rewrite_Set norm_Rational False) eq_a;  " ^
s1210629013@55373
   275
s1210629013@55373
   276
          (*([7], Pbl), solve (3 = 3 * A / 4, A)*)
s1210629013@55373
   277
          "  (sol_a::bool list) =                            " ^
s1210629013@55373
   278
          "    (SubProblem (Isac', [univariate,equation], [no_met])   " ^
s1210629013@55373
   279
          (*([7], Res), [A = 4]*)
s1210629013@55373
   280
          "    [BOOL eq_a, REAL (A::real)]);                 " ^
s1210629013@55373
   281
          (*           a = 4*)
s1210629013@55373
   282
          "  (a::real) = (rhs (NTH 1 sol_a));                " ^
s1210629013@55373
   283
          (*([8], Frm), 3 = A * (z - -1 / 4) + B * (z - 1 / 2)*)
s1210629013@55373
   284
          "  (eq_b::bool) = Take eq;                         " ^
s1210629013@55373
   285
          (*([8], Res), 3 = A * (-1 / 4 - -1 / 4) + B * (-1 / 4 - 1 / 2)*)
s1210629013@55373
   286
          "  eq_b = (Substitute [zzz = z2]) eq_b;            " ^
s1210629013@55373
   287
          (*([9], Res), 3 = -3 * B / 4*)
s1210629013@55373
   288
          "  eq_b = (Rewrite_Set norm_Rational False) eq_b;  " ^
s1210629013@55373
   289
          (*([10], Pbl), solve (3 = -3 * B / 4, B)*)
s1210629013@55373
   290
          "  (sol_b::bool list) =                            " ^
s1210629013@55373
   291
          "    (SubProblem (Isac', [univariate,equation], [no_met])   " ^
s1210629013@55373
   292
          (*([10], Res), [B = -4]*)
s1210629013@55373
   293
          "    [BOOL eq_b, REAL (B::real)]);                 " ^
s1210629013@55373
   294
          (*           b = -4*)
s1210629013@55373
   295
          "  (b::real) = (rhs (NTH 1 sol_b));                " ^
s1210629013@55373
   296
          (*           eqr = A / (z - 1 / 2) + B / (z - -1 / 4)*)
s1210629013@55373
   297
          "  eqr = drop_questionmarks eqr;                   " ^
s1210629013@55373
   298
          (*([11], Frm), A / (z - 1 / 2) + B / (z - -1 / 4)*)
s1210629013@55373
   299
          "  (pbz::real) = Take eqr;                         " ^
s1210629013@55373
   300
          (*([11], Res), 4 / (z - 1 / 2) + -4 / (z - -1 / 4)*)
s1210629013@55373
   301
          "  pbz = ((Substitute [A = a, B = b]) pbz)         " ^
s1210629013@55373
   302
          (*([], Res), 4 / (z - 1 / 2) + -4 / (z - -1 / 4)*)
s1210629013@55373
   303
          "in pbz)"
s1210629013@55373
   304
)]
wneuper@59472
   305
\<close>
wneuper@59472
   306
ML \<open>
neuper@42376
   307
(*
neuper@42376
   308
  val fmz =                                             
neuper@42376
   309
    ["functionTerm (3 / (z * (z - 1 / 4 + -1 / 8 * (1 / z))))", 
neuper@42376
   310
      "solveFor z", "functionTerm p_p"];
neuper@42376
   311
  val (dI',pI',mI') =
neuper@42376
   312
    ("Partial_Fractions", 
neuper@42376
   313
      ["partial_fraction", "rational", "simplification"],
neuper@42376
   314
      ["simplification","of_rationals","to_partial_fraction"]);
neuper@42376
   315
  val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
neuper@42376
   316
*)
wneuper@59472
   317
\<close>
neuper@42289
   318
jan@42295
   319
neuper@42376
   320
wneuper@59472
   321
subsection \<open>\<close>
neuper@42376
   322
neuper@42289
   323
end