Re: [fricas-devel] Patch Re: bug in simplify, or rootProduct (in manip.spad)

2015-11-01 Thread Waldek Hebisch
oldk1331 wrote:
> No, it does not.  I make a change in the patch:
> 

Looks good.  Can you provide real name to put in commit
message?

-- 
  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] Patch Re: bug in simplify, or rootProduct (in manip.spad)

2015-11-01 Thread oldk1331

> Looks good. Can you provide real name to put in commit 
> message? 


Thank you for accepting this patch, you can put "Qian Yun"
in the commit message.

-- 
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] Patch Re: bug in simplify, or rootProduct (in manip.spad)

2015-10-31 Thread Waldek Hebisch
oldk1331 wrote:
> 
> OK, after some debugging, I have made a patch:
> 
> --- a/src/algebra/manip.spad
> +++ b/src/algebra/manip.spad
> @@ -349,7 +349,7 @@ AlgebraicManipulations(R, F) : Exports == 
> Implementation where
>  rootKerSimp(op, x, n) == inroot(op, x, n)
>  
>  -- l is a list of nth-roots, returns a list of records of the form
> --- [a^(1/n1), a^(1/n2), ...], [n1, n2, ...]]
> +-- [[a^(1/n1), a^(1/n2), ...], [n1, n2, ...]]
>  -- such that the whole list covers l exactly
>breakup l ==
>  empty? l => empty()
> @@ -386,21 +386,22 @@
>  -- replaces (a^(1/n))^m in p by a power of a simpler radical of a if
>  -- n and m have a common factor
>radeval(p, k) ==
>  a := first(arg := argument k)
>  n := (retract(second arg)@Integer)::NonNegativeInteger
>  ans : F := 0
>  q := univariate(p, k)
>  while (d := degree q) > 0 repeat
> -  term :=
> +  term : F :=
>  --one?(g := gcd(d, n)) => monomial(1, k, d)
> -((g := gcd(d, n)) = 1) => monomial(1, k, d)
> -monomial(1, kernel(operator k, [a, (n quo g)::F], height k), d 
> quo g)
> -  ans := ans + leadingCoefficient(q)::F * term::F
> +(d = n) => a
> +((g := gcd(d, n)) = 1) => monomial(1, k, d)::F
> +monomial(1, kernel(operator k, [a, (n quo g)::F], height k), d 
> quo g)::F
> +  ans := ans + leadingCoefficient(q)::F * term
>q := reductum q
>  leadingCoefficient(q)::F + ans
>  
> 
> First part is just a comment fix.
> The second part fixs function 'radeval', bug happens when
> simplify calls rootProduct calls radeval.
> As we can see from the comments above, when 'm=n',
> '(a^(1/n))^m' should simplify to 'a' instead of '(a^(1/1))^1'.

Does it handle the following?

r1 := sqrt(x)
r2 := x^(2/3)
r3 := x^(3/4)
r12 := x^(1/12)
simplify(r1*r2*r3*r12)
-- 
  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] Patch Re: bug in simplify, or rootProduct (in manip.spad)

2015-10-31 Thread oldk1331


> Does it handle the following? 
>
> r1 := sqrt(x) 
> r2 := x^(2/3) 
> r3 := x^(3/4) 
> r12 := x^(1/12) 
> simplify(r1*r2*r3*r12) 
> -- 
>   Waldek Hebisch 
>

No, it does not.  I make a change in the patch:

--- a/src/algebra/manip.spad
+++ b/src/algebra/manip.spad
@@ -391,11 +391,12 @@ AlgebraicManipulations(R, F) : Exports == 
Implementation where
 ans : F := 0
 q := univariate(p, k)
 while (d := degree q) > 0 repeat
-  term :=
---one?(g := gcd(d, n)) => monomial(1, k, d)
-((g := gcd(d, n)) = 1) => monomial(1, k, d)
-monomial(1, kernel(operator k, [a, (n quo g)::F], height k), d 
quo g)
-  ans := ans + leadingCoefficient(q)::F * term::F
+  term :F :=
+g := gcd(d, n)
+(g = n) => a^(d quo g)
+(g = 1) => monomial(1, k, d)::F
+monomial(1, kernel(operator k, [a, (n quo g)::F], height k), d 
quo g)::F
+  ans := ans + leadingCoefficient(q)::F * term
   q := reductum q
 leadingCoefficient(q)::F + ans

-- 
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.