Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Matlab simplify Proof do not understand output
조회 수: 1 (최근 30일)
이전 댓글 표시
Inputing
simplify((( x^3+a*x+b) -(y^3+a*y+b) )^2/(x-y)^4)
ans =
(x^2 + x*y + y^2 + a)^2/(x - y)^2
feval(symengine,'Simplify',(( x^3+a*x+b) -(y^3+a*y+b) )^2/(x-y)^4,'OutputType = "Proof"')
get ans =
Input was \r\n (x^3 + a*x - y^3 - a*y)^2/(x - y)^4 \r\nApplying the rule\r\n () -> #X -> partfrac(#X, x, Mapcoeffs = proc(p)\r\n name polylib::sqrfree;\r\n local pp, pr, t, recollect, ret, options, unextend, ratsubsts, minpol, T, inds, Args, Float;\r\n begin\r\n pp := p; \r\n Args := [args()]; \r\n if nops(Args) = 2 && domtype(Args[2]) = DOM_BOOL then\r\n Args[2] := \"Recollect\" = Args[2]\r\n end_if; \r\n options := prog::getOptions(2, Args, faclib::defaultOptions, TRUE, faclib::optionTypes)[1]; \r\n recollect := (if options[\"Recollect\"] then\r\n proc(f)\r\n local t, i, j;\r\n begin\r\n t := table(); \r\n for i from 3 to nops(f) step 2 do\r\n if contains(t, f[i]) then\r\n t[f[i]] := t[f[i]]*f[i - 1]\r\n else \r\n t[f[i]] := f[i - 1]\r\n end_if\r\n end_for; \r\n [f[1], (op(t, [j, 2]), op(t, [j, 1])) $ j = 1..nops(t)]\r\n end_proc\r\n else \r\n id\r\n end_if); \r\n if (type(p) <> DOM_POLY || op(p, 3) = Expr) && stdlib::hasfloat(p) then\r\n p := numeric::rationalize(p); \r\n Float := proc(l)\r\n local i;\r\n begin\r\n for i from 2 to nops(l) step 2 do\r\n if type(l[i]) = DOM_POLY then\r\n l[i] := mapcoeffs(l[i], float)\r\n else \r\n l[i] := float(l[i])\r\n end_if\r\n end_for; \r\n l\r\n end_proc\r\n else \r\n Float := id\r\n end_if; \r\n unextend := id; \r\n if options[\"UseAlgebraicExtension\"] then\r\n p := poly(p); \r\n T := op(p, 3); \r\n if T = Expr then\r\n if map({coeff(p)}, domtype) minus {DOM_RAT, DOM_INT} = {} then\r\n T := Dom::Rational\r\n else \r\n T := Dom::Fraction(Dom::Polynomial(Dom::Rational))\r\n end_if\r\n end_if; \r\n inds := indets(poly2list(p)); \r\n [pr, ratsubsts, minpol] := [rationalize(poly2list(p), FindRelations = [\"_power\", \"exp\"], MinimalPolynomials)]; \r\n if ratsubsts = {} || traperror((T := fp::fold((p, d) -> Dom::AlgebraicExtension(d, poly(p, [op(indets(p) minus inds)], d)), T)(op(minpol)))) <> 0 || traperror((p := poly(pr, op(p, 2), T))) <> 0 || p = FAIL then\r\n p := pp\r\n else \r\n unextend := (if pp::dom = DOM_POLY then\r\n proc(f)\r\n local i;\r\n begin\r\n evalAt([(if op(pp, 3) = Expr then\r\n expr(f[1])\r\n else \r\n coerce(f[1], op(pp, 3))\r\n end_if), (poly(f[i], op(pp, 3)), f[i + 1]) $ i = 2..nops(f) - 1 step 2], ratsubsts)\r\n end_proc\r\n else \r\n proc(f)\r\n local i;\r\n begin\r\n evalAt([expr(f[1]), (expr(f[i]), f[i + 1]) $ i = 2..nops(f) - 1 step 2], ratsubsts)\r\n end_proc\r\n end_if)\r\n end_if\r\n end_if; \r\n if p::dom::sqrfree <> FAIL then\r\n return(p::dom::sqrfree(p))\r\n end_if; \r\n if domtype(p) = DOM_POLY then\r\n if testargs() then\r\n t := op(p, 3); \r\n if domtype(t) = DOM_DOMAIN then\r\n if t::hasProp <> FAIL then\r\n if t::hasProp(Cat::FactorialDomain) then\r\n if t::characteristic <> 0 then\r\n if t::hasProp(Cat::Field) then\r\n if ~t::hasProp(Dom::IntegerMod) then\r\n if ~t::hasProp(Dom::GaloisField) then\r\n if ~t::hasProp(Dom::AlgebraicExtension) || t::degreeOverPrimeField = UNKNOWN then\r\n error(message(\"symbolic:polylib:NotAFiniteField\"))\r\n end_if\r\n end_if\r\n end_if\r\n else \r\n error(message(\"symbolic:polylib:NotAField\"))\r\n end_if\r\n end_if\r\n else \r\n error(message(\"symbolic:polylib:NotAFactorialDomain\"))\r\n end_if\r\n end_if\r\n else \r\n if t <> hold(Expr) && ~isprime(op(t, 1)) then\r\n error(message(\"symbolic:polylib:NoPrimeModulus\"))\r\n end_if\r\n end_if\r\n end_if; \r\n ret := Float(recollect(unextend(faclib::sqrfree_poly(p, options)))); \r\n Factored::create(ret, \"squarefree\")\r\n else \r\n ret := Float(recollect(unextend(faclib::factor_expr(p, options, TRUE)))); \r\n Factored::create(ret, \"squarefree\")\r\n end_if\r\n end_proc@normal)\r\ngives \r\n 2*a + 4*x*y + (3*y^2 + a)^2/(x - y)^2 + x^2 + 10*y^2 + (6*y*(3*y^2 + a))/(x - y) \r\nApplying the rule\r\n Simplify::sqrfreeFactor\r\ngives \r\n (x^2 + x*y + y^2 + a)^2/(x - y)^2 \r\nEND OF PROOF \r\n
I don't understand what the proof for simplify is doing I was just trying to get the steps how do I just get the like mathematica/wolfram alpha show steps output
댓글 수: 0
답변 (1개)
Walter Roberson
2019년 11월 9일
The output is showing the steps.
If you look near the end of the output, you will find
Applying the rule\r\n Simplify::sqrfreeFactor
That indicates that a rule named Simplify::sqrfreeFactor is being applied to the current expression it is working with. That part is easy to understand.
But when you look near the top of the output, you will find
Applying the rule\r\n () -> #X -> partfrac(#X, x, Mapcoeffs = proc(p)\r\n
and so on. What is happening there is that there is an anonymous function being applied, rather than one that a specific name has been given to. Because there is no name for it, MuPAD is outputing what the anonymous function code is, which is a bunch of MuPAD code. The short summary of the code is that the anonymous function runs partial fraction expansion, with each term processed by a procedure named polylib::sqrfree the code for which is given there.
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!