[fricas-devel] automatic factorization in Factored
Hi Waldek, Did you change anything in Factored? As far as I remember (and a very old FriCAS form 2011 that I still have around confirms this), there was no automatic factorization in (3). I thought this was deliberate, because factorization costs time and (2) and (3) might only be intermediate operations. Honestly, I'm not decided whether this is good or bad. Ralf (1) -> p: Factored(Polynomial Integer) := (x-1)^2*(x+1) 2 (1) (x - 1) (x + 1) Type: Factored(Polynomial(Integer)) (2) -> q :=p+1 32 (2) x - x - x + 2 Type: Factored(Polynomial(Integer)) (3) -> q-1 2 (3) (x - 1) (x + 1) Type: Factored(Polynomial(Integer)) -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To post to this group, send email to fricas-devel@googlegroups.com. Visit this group at http://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.
Re: [fricas-devel] automatic factorization in Factored
> Nothing changed in Factored, but now Polynomial(Integer) has > UniqueFactorizationDomain. Now coercion to Factored is > performing factorization: > > (1) -> (x^2 - 1)::Factored(?) > >(1) (x - 1)(x + 1) > Type: Factored(Polynomial(Integer)) > > This coercion is performed after subtraction. Yes. I understand your example and don't have a problem with it. Coercion is an operation and is allowed to do something. Now, in my original posting I used p+1 and who knows, why type the interpreter give to + and 1 and what magic coercions happen in between even though the result finally is Factored Polynomial Integer. But where is the coercion in the session below? Everything happens inside F, so there shouldn't be need for a coercion, and, in fact, I cannot see from the code of Factored, where there is a coercion or anything that produces a factored form in (5). Ralf (1) -> F ==> Factored Polynomial Integer Type: Void (2) -> e: F := 1 (2) 1 Type: Factored(Polynomial(Integer)) (3) -> p: F := (x-1)^2*(x+1) 2 (3) (x - 1) (x + 1) Type: Factored(Polynomial(Integer)) (4) -> q: F := p + e 32 (4) x - x - x + 2 Type: Factored(Polynomial(Integer)) (5) -> r: F := q - e 2 (5) (x - 1) (x + 1) Type: Factored(Polynomial(Integer)) -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To post to this group, send email to fricas-devel@googlegroups.com. Visit this group at http://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.
Re: [fricas-devel] automatic factorization in Factored
Ralf Hemmecke wrote: > > > Nothing changed in Factored, but now Polynomial(Integer) has > > UniqueFactorizationDomain. Now coercion to Factored is > > performing factorization: > > > > (1) -> (x^2 - 1)::Factored(?) > > > >(1) (x - 1)(x + 1) > > Type: > > Factored(Polynomial(Integer)) > > > > This coercion is performed after subtraction. > > Yes. I understand your example and don't have a problem with it. > Coercion is an operation and is allowed to do something. > > Now, in my original posting I used p+1 and who knows, why type the > interpreter give to + and 1 and what magic coercions happen in between > even though the result finally is Factored Polynomial Integer. > > But where is the coercion in the session below? Everything happens > inside F, so there shouldn't be need for a coercion, and, in fact, I > cannot see from the code of Factored, where there is a coercion or > anything that produces a factored form in (5). Look at '+' in Factored, when base domain R is GCD domain as last step it performs multiplication of expanded sum by gcd. Expanded sum is in R, and we need multiplication of type (R, %) -> %, If you look at this multiplication you will see that as first step it performs coercion from R to %... This is a bit tricky but )trace Factored )math will tell you that '+' calls '*' and '*' calls 'coerce'. -- Waldek Hebisch -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To post to this group, send email to fricas-devel@googlegroups.com. Visit this group at http://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.
Re: [fricas-devel] automatic factorization in Factored
Ralf Hemmecke wrote: > > Hi Waldek, > > Did you change anything in Factored? > > As far as I remember (and a very old FriCAS form 2011 that I still have > around confirms this), there was no automatic factorization in (3). I > thought this was deliberate, because factorization costs time and (2) > and (3) might only be intermediate operations. > > Honestly, I'm not decided whether this is good or bad. > > Ralf > > (1) -> p: Factored(Polynomial Integer) := (x-1)^2*(x+1) > >2 >(1) (x - 1) (x + 1) > Type: > Factored(Polynomial(Integer)) > (2) -> q :=p+1 > > 32 >(2) x - x - x + 2 > Type: > Factored(Polynomial(Integer)) > (3) -> q-1 > >2 >(3) (x - 1) (x + 1) > Type: > Factored(Polynomial(Integer)) > Nothing changed in Factored, but now Polynomial(Integer) has UniqueFactorizationDomain. Now coercion to Factored is performing factorization: (1) -> (x^2 - 1)::Factored(?) (1) (x - 1)(x + 1) Type: Factored(Polynomial(Integer)) This coercion is performed after subtraction. -- Waldek Hebisch -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To post to this group, send email to fricas-devel@googlegroups.com. Visit this group at http://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.