Re: [fricas-devel] generalization of Groebner

2017-02-16 Thread Waldek Hebisch
Ralf Hemmecke wrote:
> 
> Now, in this patch
> 
> diff --git a/src/algebra/gbintern.spad b/src/algebra/gbintern.spad
> index 0446c47..06bba81 100644
> --- a/src/algebra/gbintern.spad
> +++ b/src/algebra/gbintern.spad
> @@ -3,11 +3,11 @@
>  ++ Keywords:
>  ++ Description
>  ++ This package provides low level tools for Groebner basis computations
> -GroebnerInternalPackage(Dom, Expon, VarSet, Dpol) : T == C where
> +GroebnerInternalPackage(Dom, Expon, Dpol) : T == C where
>   Dom :   GcdDomain
>   Expon : OrderedAbelianMonoidSup
> - VarSet : OrderedSet
> - Dpol :  PolynomialCategory(Dom, Expon, VarSet)
> + Dpol : Join(FiniteAbelianMonoidRing(Dom, Expon),
> + VariablesCommuteWithCoefficients)
>   NNI==> NonNegativeInteger
> --  Definition of Record critPair and Prinp
> 
> I basically remove VarSet and thus the (assumed) structure of Expon.
> 
> In my application that led me to this generalization business, I then
> have Dpol = PolynomialRing(Dom, Expon).

I wonder about mathematical correctness of this.  Above Expon may
be any ordered abelian monoid.  You also like to have coercion
from Expon to Vector(NNI).  Now, let Expon be a submonoid
of NNI^k for some k.  Such submonoind on general is not a free
monoid anymore.  In particular, unlike polynomial case smaller
exponent (smaller on all coordinates) not necessarily divides
larger one.  My impression is that this breaks important assumption
made by GroebnerInternalPackage.  Consequently various
'exquo' may fail...

-- 
  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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [BUG] ")compile" modifies kernel cache?

2017-02-16 Thread Waldek Hebisch
oldk1331 wrote:
> 
> On Thu, Feb 16, 2017 at 11:14 PM, Waldek Hebisch
>  wrote:
> >>
> >> Can you point out where does "invalidates
> >> all kernel caches" happen?
> >> (So that I can disable it when I'm sure it's safe.)
> >
> > Directly this is done by 'clearConstructorCache'.  Without
> > 'clearConstructorCache' if you load new version of constructor
> > you will get strange mix of old and new routines.  So
> > during developement skipping 'clearConstructorCache' is
> > essentially never safe.
> 
> If I compile a spad file that only contains packages (so no new
> version of domain constructor), will that be safe to skip
> 'clearConstructorCache'?

No.  Without 'clearConstructorCache' all domains/packages
will continue to use old version of compiled package.
So basicaly the only safe case is if anything that used
previous version will be no longer used.  In particular
if package was unused before (in this case call to
'clearConstructorCache' is automaticaly skipped).
In normal testing scenario when you try the package,
recompile and try again the only safe variant is
when the package is only used directly from command
line but not from other domains/packages.

-- 
  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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [PATCH v1] add a special case in lg2func; fix

2017-02-16 Thread oldk1331
> I understand that some people would like to see results
> with extra roots.  So it would make sense to add this
> as an optional behaviour.

I agree to have both options.  So for results with extra roots
approach: this patch is an improvement, because it used to
introduce "rootSimp zeroOf p", that is essentially the same
extra root introduced by my patch, but my patch pairs it up
to produce much better "results with extra roots".

-- 
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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [BUG] ")compile" modifies kernel cache?

2017-02-16 Thread oldk1331
On Thu, Feb 16, 2017 at 11:14 PM, Waldek Hebisch
 wrote:
>>
>> Can you point out where does "invalidates
>> all kernel caches" happen?
>> (So that I can disable it when I'm sure it's safe.)
>
> Directly this is done by 'clearConstructorCache'.  Without
> 'clearConstructorCache' if you load new version of constructor
> you will get strange mix of old and new routines.  So
> during developement skipping 'clearConstructorCache' is
> essentially never safe.

If I compile a spad file that only contains packages (so no new
version of domain constructor), will that be safe to skip
'clearConstructorCache'?

-- 
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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [BUG] ")compile" modifies kernel cache?

2017-02-16 Thread oldk1331
I find a method to counteract the effect of 'clearConstructorCache':

Building expressions using ==, after compiling a file, switch the
definition of independent variable, causing expressions to be rebuilt:

x == x1
t == sqrt (2* sqrt(x^4))
# tower sqrt(t^3)
)co manip
x == x2  -- switch definition
# tower sqrt(t^3)

-- 
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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] Announce: FriCAS 1.3.1 has been released

2017-02-16 Thread Waldek Hebisch
Martin Baker wrote:
> 
> I am curious about the following error which compiled without error on 
> previous releases.
> 
> This is not a problem (might even be be an advantage) because it forces 
> me to write:
> print (message "value of a is " << a)
> instead of:
> print ("value of a is " << a)
> 
> There is also a change to runtime, I suspect this may be change in Lisp? 
> In the last release display of quotes around strings was suppressed in 
> bash output (even without 'message' function) but not in this release.
> 
> As I say, this is not important feel free to ignore, just interested to 
> know if it was deliberate or due to unpredictability of compiler.

This is delibarate change to avoid unpredictability of compiler.
>From the announcemnet:

> - Removed special handling of coercion of String to OutputForm
>   from Spad compiler.

Compiler treated '"string"::OutputForm' specially giving
different result than 'coerce("string")@OutputForm'.  This
could lead to errors.  I write about this few months ago,
when this change was made.

-- 
  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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


[fricas-devel] [BUG] ")compile" modifies kernel cache?

2017-02-16 Thread oldk1331
(1) -> t := sqrt (2* sqrt(a^4));

(2) -> # tower sqrt(t*t*t)

   (2)  4

(3) -> )compile manip.spad
-- or compile any other spad file

(3) -> # tower sqrt(t*t*t)

   (3)  3


I use '#' to make output shorter.  As you can see, after
compiling a file, the output of "tower" changes!

This is pretty serious. Is this a known behaviour?

-- 
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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [BUG] ")compile" modifies kernel cache?

2017-02-16 Thread Waldek Hebisch
> 
> (1) -> t := sqrt (2* sqrt(a^4));
> 
> (2) -> # tower sqrt(t*t*t)
> 
>(2)  4
> 
> (3) -> )compile manip.spad
> -- or compile any other spad file
> 
> (3) -> # tower sqrt(t*t*t)
> 
>(3)  3
> 
> 
> I use '#' to make output shorter.  As you can see, after
> compiling a file, the output of "tower" changes!
> 
> This is pretty serious. Is this a known behaviour?

Yes.  ')compile' replaces old kernel cache by new one
(it has to because after compile potentially all
constructors are invalid).  In effect all kernels
stored in variables are invalid.  Arguably ')compile'
should clear all interpreter variables.  I guess that
original authors decided that most variables remain
valid and users using ')compile' can recompute ones
which became invalid.  OTOH user normally have no
way to invalidate cached constructors (beside recompiling
the conctructor, but this is time consuming and
require knowledge of dependencies), so ')compile'
invalidates them all.  Smarter ')compile' could
track dependencies and try to invalidate only
minimal set of constructors, but this is tricky
to implements.

-- 
  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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [BUG] ")compile" modifies kernel cache?

2017-02-16 Thread oldk1331
> so ')compile'
> invalidates them all.  Smarter ')compile' could
> track dependencies and try to invalidate only
> minimal set of constructors, but this is tricky
> to implements.

Can you point out where does "invalidates
all kernel caches" happen?
(So that I can disable it when I'm sure it's safe.)

BTW, does this affect your development loop?
I mean, after compiling a file, you have to
re-eval all variables?

-- 
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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


[fricas-devel] [PATCH v1] add a special case in lg2func; fix serval integrals

2017-02-16 Thread oldk1331
Compare the result of
  integrate(1/(x^8-1),x)
  integrate(8*sqrt(2)/(x^8-1),x)
  integrate(a/(x^8-1),x)

The first is more complex than the second one.
Why? Because:
(1) -> factor(x^4+1)

 4
   (1)  x  + 1
  Type: Factored(Polynomial(Integer))
(2) -> factor(x^4+4)

  22
   (2)  (x  - 2x + 2)(x  + 2x + 2)
  Type: Factored(Polynomial(Integer))

The factorization of "x^4+r" depends on r, or else it will
introduce extra algebraic kernels.

In rational function integration, sum logs over roots of
"x^4+r=0" is pretty common, but "lg2func" doesn't deal
with this case.  So I manually facor "x^4+r" into quadratics.

This patch improves 1190a 1191a 1207a 1217a 1218a 1228a
of mapleok.input, making 1191a 1207a 1217a continuous.

I have to use "rootSimp" in the patch, I'm not sure if this
will causes trouble elsewhere.


diff --git a/src/algebra/irexpand.spad b/src/algebra/irexpand.spad
index eb90a9c9..eaffa9e4 100644
--- a/src/algebra/irexpand.spad
+++ b/src/algebra/irexpand.spad
@@ -84,6 +84,7 @@
   zero?(delta := (b := coefficient(p, 1))^2 - 4 *
(a := coefficient(p, 2)) * (p0 := coefficient(p, 0))) =>
  [linear(monomial(1, 1) + (b / a)::UP, lg)]
+  delta := rootSimp delta
   e := (q := quadeval(lg, c := - b * (d := inv(2*a)), d, delta)).ans1
   lgp  := c * log(nrm := (e^2 - delta * (f := q.ans2)^2))
   s:= (sqr := insqrt delta).sqrt
@@ -152,8 +153,18 @@
 --  one? d => [linear(p, lg.logand)]
   (d = 1) => [linear(p, lg.logand)]
   d = 2  => quadratic(p, lg.logand, x)
-  odd? d and
-((r := retractIfCan(reductum p)@Union(F, "failed")) case F) =>
+  r := retractIfCan(reductum p)@Union(F, "failed")
+  d = 4 and r case F =>
+  -- In this "p := ?^4 + r" case, we manually factor p into
+  -- "?^2 + sqrt(r) - ?*sqrt(2*sqrt(r))" and
+  -- "?^2 + sqrt(r) + ?*sqrt(2*sqrt(r))".
+  upx := monomial(1,1)$UP
+  t : F := rootSimp sqrt(2 * rootSimp sqrt r)
+  -- quadratic will always return 1 result (instead of 2),
+  -- because the sign of delta is fixed.
+  [firstquadratic(upx^2 + sqrt(r)::UP - upx*t, lg.logand, x)
++ first quadratic(upx^2 + sqrt(r)::UP + upx*t, lg.logand, x)]
+  odd? d and r case F =>
 pairsum([cmplex(alpha := rootSimp zeroOf p, lg.logand)],
 lg2func([lg.scalar,
  (p exquo (monomial(1, 1)$UP - alpha::UP))::UP,

-- 
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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


[fricas-devel] [BUG] rootSimp sqrt(2 * sqrt(a^4))

2017-02-16 Thread oldk1331
The documentation of rootSimp says it
"transforms every radical of the form ..."

(1) -> rootSimp sqrt(2 * sqrt(a^4))

 +--+
 |  +--+
 |  | 4
   (1)  \|2\|a

rootSimp returns itself, I think rootSimp should return "a*sqrt(2)".

I don't know where went wrong.

Maybe the evaluation order of "eval : (%, List Kernel %, List %) -> %"
in the definition of rootSimp is wrong, it should eval one kernel
at a time and then recursively call rootSimp?

-- 
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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


[fricas-devel] [PATCH] add a continuity test (definite integration)

2017-02-16 Thread oldk1331
The result of in249a get fixed in previous commit,
so I'm moving it from mapleok.input to integ.input.
I modified the integrand a little to avoid (-1)^(1/3).

--- a/src/input/integ.input
+++ b/src/input/integ.input
@@ -644,5 +644,9 @@
 c1 := eval(g, x = a1)
 testEquals("integrate(b1, x)", "c1")

+-- This test was from mapleok.input
+in249a := integrate((sin(z)/(1-cos(z)))^(1/3), z = 0..%pi, "noPole")
+testEquals("normalize(in249a)", "2/3*sqrt(3)*%pi")
+
 )set output algebra on
 statistics()
diff --git a/src/input/mapleok.input b/src/input/mapleok.input
index c9959409..8fb1e35d 100644
--- a/src/input/mapleok.input
+++ b/src/input/mapleok.input
@@ -4194,14 +4194,6 @@
 -- - 2
 --Type: Union(f1: OrderedCompletion Expression Complex Integer,...)

-in249a:=integrate((sin(z)/(cos(z)-1))^(1/3), z= 0..%pi,"noPole")
---
--- 3+-+   3+-+ +-+
---  3log(32\|2 ) - 12log(2\|2 ) - 4%pi\|3
---  --
---24
---Type: Union(f1: OrderedCompletion Expression Integer,...)
-
 in251a:=integrate((-1)^z*exp(-z)*sin(z), z= 0..%plusInfinity,"noPole")
 --
 -- Argument not in domain of power.

-- 
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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [PATCH v1] add a special case in lg2func; fix serval integrals

2017-02-16 Thread oldk1331
> As I wrote in other mail I would like to generate 'rootSum'
> instead of expanding roots.  In principle after such change
> definite integrator would work with 'rootSum' directly
> skiping Rioboo, tantrick, etc.

I don't understand. Why should integrate(1/(x^8-1),x) and
integrate(8*sqrt(2)/(x^8-1),x) be so different?
If you want to get 'rootSum', you probably will get complex
result.

On the other hand, in "x^4 + r", if we know that "r" is a quartic,
then no more extra roots will be introduced, I think.

Just compare current result and following reuslt.

(1) -> integrate(a/(x^8-1),x)

   (1)
 +-+2  +-+   +-+
   - a log(x\|2  + x  + 1) - a\|2 log(x + 1) + a\|2 log(x - 1)
 +
 +-+2  +-+  +-+
   a log(- x\|2  + x  + 1) - 2a atan(x\|2  + 1) - 2a atan(x\|2  - 1)
 +
+-+
   - 2a\|2 atan(x)
  /
   +-+
 8\|2

-- 
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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [PATCH v1] add a special case in lg2func; fix

2017-02-16 Thread Waldek Hebisch
oldk1331 wrote:
> 
> > As I wrote in other mail I would like to generate 'rootSum'
> > instead of expanding roots.  In principle after such change
> > definite integrator would work with 'rootSum' directly
> > skiping Rioboo, tantrick, etc.
> 
> I don't understand. Why should integrate(1/(x^8-1),x) and
> integrate(8*sqrt(2)/(x^8-1),x) be so different?

Compare:

(5) -> factor(x^8 - 1)

2   4
   (5)  (x - 1)(x + 1)(x  + 1)(x  + 1)
  Type: Factored(Polynomial(Integer))
(6) -> factor(x^8 - 1, [sqrt(2)])

2+-+2   2+-+
   (6)  (x - 1)(x + 1)(x  - \|2 x + 1)(x  + 1)(x  + \|2 x + 1)
  Type: Factored(Polynomial(AlgebraicNumber))
(7) -> factor(x^8 - 1, [sqrt(3), sqrt(6)])

 +-+ +-+  +-+ +-+
2   \|3 \|6  2   2   \|3 \|6
   (7)  (x - 1)(x + 1)(x  -  x + 1)(x  + 1)(x  +  x + 1)
33
  Type: Factored(Polynomial(AlgebraicNumber))

The first factorization is right if our field does not contain
'sqrt(2)'.  In fact for integration 'sqrt(2)' may be present
in our field, but integration result is correct if
the term we are integrating is contained in a field which
does not contain 'sqrt(2).

In the second case 'sqrt(2)' is already present in our
field.  In some cases to get correct result we have to
ensure irreducible factors.  If this is the case we
have to use 'sqrt(2)' for factorization.  In case of
rational integration we have some freedom and in some
places we can opt for reducible polynomials and still
get correct results.  But since 'sqrt(2)' is present we may
use it if we think it helps.

Important point is that in general we may have several
terms.  Given routine sees only one term.  If this terms
contains 'sqrt(2)' we know that 'sqrt(2)' is contained
in our field.  But 'sqrt(2)' may be contained in other
terms so given routine can not exclude possibility
that introducing 'sqrt(2)' will add redundant root.
As the result '(7)' shows 'sqrt(2)' may be hidden.

BTW: In parametric integration routines I solved problem
with partial knowledge by passing whole list of kernels
to integration routines.  In principle we could do this
in other part of integrator (and probably will do in
the future).

> If you want to get 'rootSum', you probably will get complex
> result.

You will get complex results only if you expand 'rootSum'
to explicit sum.  Beauty of 'rootSum' is that you can compute
with it without such expansion.

> On the other hand, in "x^4 + r", if we know that "r" is a quartic,
> then no more extra roots will be introduced, I think.

Look at:

(8) -> integrate(1/(x^2 - 2) + 1/(x^2 - 6) + 1/(x^2 - 3), x) 

   (8)
 2  +-+2  +-+
+-+ +-+(x  + 6)\|6  - 12x +-+ +-+(x  + 3)\|3  - 6x
   \|2 \|3 log(--) + \|2 \|6 log(-)
  2 2
 x  - 6x  - 3
 + 
 2  +-+
+-+ +-+(x  + 2)\|2  - 4x
   \|3 \|6 log(-)
  2
 x  - 2
  /
   +-+ +-+ +-+
 2\|2 \|3 \|6
 Type: Union(Expression(Integer),...)

We introduce here dependent set of roots {sqrt(2), sqrt(3), sqrt(6)}.
We could avoid this problem either by using 'rootSum' or by
replacing above 'sqrt(6)' by 'sqrt(2)*sqrt(3)'.  But without
some resolution introducing new roots makes the problem
worse.

-- 
  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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [PATCH v1] add a special case in lg2func; fix serval integrals

2017-02-16 Thread Waldek Hebisch
oldk1331 wrote:
> 
> Compare the result of
>   integrate(1/(x^8-1),x)
>   integrate(8*sqrt(2)/(x^8-1),x)
>   integrate(a/(x^8-1),x)
> 
> The first is more complex than the second one.
> Why? Because:
> (1) -> factor(x^4+1)
> 
>  4
>(1)  x  + 1
>   Type: Factored(Polynomial(Integer))
> (2) -> factor(x^4+4)
> 
>   22
>(2)  (x  - 2x + 2)(x  + 2x + 2)
>   Type: Factored(Polynomial(Integer))
> 
> The factorization of "x^4+r" depends on r, or else it will
> introduce extra algebraic kernels.
> 
> In rational function integration, sum logs over roots of
> "x^4+r=0" is pretty common, but "lg2func" doesn't deal
> with this case.  So I manually facor "x^4+r" into quadratics.
> 
> This patch improves 1190a 1191a 1207a 1217a 1218a 1228a
> of mapleok.input, making 1191a 1207a 1217a continuous.
> 
> I have to use "rootSimp" in the patch, I'm not sure if this
> will causes trouble elsewhere.

That is move in wrong direction.  In purely symbolic setting
extra algebraic kernels cause trouble.  Especially when
there is no check if equivalent kernel is already present.

As I wrote in other mail I would like to generate 'rootSum'
instead of expanding roots.  In principle after such change
definite integrator would work with 'rootSum' directly
skiping Rioboo, tantrick, etc.  Of course definite integrator
will have to do some work to avoid branch problems, but
using 'rootSum' will automatically avoid some problems
and for other definite integrator have more information
to resolve them properly than indefinite integrator.

I understand that some people would like to see results
with extra roots.  So it would make sense to add this
as an optional behaviour.  But as _default_ in FriCAS this
would cause more problems than it would resolve.
Namely, nontrivial parts of branch problems are due
to dependent roots.  I fixed several of them by
avoiding introducing new roots.

-- 
  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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [BUG] ")compile" modifies kernel cache?

2017-02-16 Thread Waldek Hebisch
oldk1331 wrote:
> 
> > so ')compile'
> > invalidates them all.  Smarter ')compile' could
> > track dependencies and try to invalidate only
> > minimal set of constructors, but this is tricky
> > to implements.
> 
> Can you point out where does "invalidates
> all kernel caches" happen?
> (So that I can disable it when I'm sure it's safe.)

Directly this is done by 'clearConstructorCache'.  Without
'clearConstructorCache' if you load new version of constructor
you will get strange mix of old and new routines.  So
during developement skipping 'clearConstructorCache' is
essentially never safe.

> BTW, does this affect your development loop?
> I mean, after compiling a file, you have to
> re-eval all variables?

Well, expressions.  For short seqences of commands I recall
them from command history.  Longer ones I put in files.


-- 
  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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [BUG] rootSimp sqrt(2 * sqrt(a^4))

2017-02-16 Thread Waldek Hebisch
oldk1331 wrote:
> 
> The documentation of rootSimp says it
> "transforms every radical of the form ..."
> 
> (1) -> rootSimp sqrt(2 * sqrt(a^4))
> 
>  +--+
>  |  +--+
>  |  | 4
>(1)  \|2\|a
> 
> rootSimp returns itself, I think rootSimp should return "a*sqrt(2)".
> 
> I don't know where went wrong.
> 
> Maybe the evaluation order of "eval : (%, List Kernel %, List %) -> %"
> in the definition of rootSimp is wrong, it should eval one kernel
> at a time and then recursively call rootSimp?

Yes, it is evaluation order.  I have commited a fix.

-- 
  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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] Re: [aldor-devel] foldl and foldr

2017-02-16 Thread Peter Broadbery
On 14 Feb 2017 08:03, "Ralf Hemmecke"  wrote:

On 02/14/2017 08:38 AM, Peter Broadbery wrote:
> Interesting.  It definitely does work in .spad files (search for ^+\[).

Oh...

https://github.com/fricas/fricas/blob/master/src/algebra/aggcat.spad#L146

count(f : S -> Boolean, c : %) == _+/[1 for x in parts c | f x]

Then it even looks like a compiler builtin in FriCAS, if it appears
already in aggcat.spad.

Maybe FriCAS should also make this into a library feature?

> In any case,  as written it's left to right. There's an argument that it
should
> be undefined - ie require an associative argument (for parallel
accumulation)
> but that is likely to be more work than I have time for at the moment.

Peter, that's not urgent. I just wanted to make some comments that
related to your aldor-patch series.


Thanks - will add a fold and foldr as then '/' can be left as possibly
needing an associative argument.

Will be after the current patch is merged.


Ralf

--
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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


[fricas-devel] [PATCH] rootPower(): handle embedded roots

2017-02-16 Thread oldk1331
(1) -> rootPower atan(2*(x^(1/6))^3)

  6+-+3
   (1)  atan(2\|x  )

After patch:

(2) -> rootPower atan(2*(x^(1/6))^3)

   +-+
   (2)  atan(2\|x )

Similar to previous rootSimp, rootPower doesn't handle
nested roots correctly: it overlooked the case when
root appears at argument.

diff --git a/src/algebra/manip.spad b/src/algebra/manip.spad
index 13ce3fe2..1fa3a97c 100644
--- a/src/algebra/manip.spad
+++ b/src/algebra/manip.spad
@@ -376,8 +376,13 @@
 x

   rootPower x ==
-for k in rootkernels tower x repeat
-  x := radeval(numer x, k) / radeval(denom x, k)
+for k in tower x repeat
+  if is?(operator k, 'nthRoot) then
+  x := radeval(numer x, k) / radeval(denom x, k)
+  else
+  nargs := map((e : F) : F +-> rootPower(e), argument k)
+  nk : K := kernel(operator k, nargs, height k)
+  x := eval(x, k, nk::F)
 x

 -- replaces (a^(1/n))^m in p by a power of a simpler radical of a if

-- 
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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.


[fricas-devel] DoubleFloat literal in spad file?

2017-02-16 Thread oldk1331
It seems that all float number literal appeared
in a spad file are treated as Float, you have
to manually convert it to DoubleFloat if you
want a DoubleFloat literal.

Is that intentional?

FriCAS is not specialized at numerical computation,
but not having doublefloat literal? That's unimaginable.

-- 
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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.