On Wed, Nov 22, 2023 at 08:20:30AM +0800, Qian Yun wrote:
> 
> 
> On 11/21/23 20:10, Waldek Hebisch wrote:
> > > 
> > > If current limit can handle result from integrate, then the limit
> > > can expand the rootSum just like integrate does.  Not an improvement,
> > > but also not a step back, right?
> > 
> > Well, we want to handle more cases.  But there is also problem
> > of incorrect results.  Old limit code has a few fundamental
> > problems, basically parts of it work on principle "this
> > usually produces correct result".  But sometimes we get
> > wrong results.  Handling of symbolic roots is in this category.
> > In MRVLIM I tried to avoid such things.  There is still possiblity
> > that MRVLIM gets something which breaks assumptions from
> > other parts of FriCAS (or from the user), but I do not want
> > to deliberatly include unsound code in MRVLIM.  To put it
> > differently, if we allow the same liberty for new code as
> > for old code, then we will never get rid of unsound parts.
> > 
> > You may ask why unsound parts were included at all?  Well,
> > one thing is research: in research you concentrate on
> > one part and take other as given, that is the only sane
> > way of doing research.  But when it comes to implementation
> > it may happen that part treated "as given" is in fact
> > unavailable.  Then you need to substitute something
> > which works well enough to test the new part.  There
> > is also competitive pressure: if competitor uses
> > unsound method there is strong pressure to "do something"
> > which frequently boils down to using the same unsound
> > method.  But IMO there is no compeling reason _now_
> > to include unsound methods in MRVLIM.
> > 
> 
> Can you give a concrete example that limit fails to do
> rootSum?  Also, is limit on rootSum generally solvable?

ATM limit just refuses to do rootSum:

(1) -> ff2 := rootSum(l*log(x - l), univariate(x^2 + 1)::SUP(EXPR(INT)), 'l)

           --+
   (1)     >        l log(x - l)
           --+
         2
        l  + 1 = 0
                                                    Type: Expression(Integer)
(2) -> limit(ff2, x=%minusInfinity) 

   (2)  "failed"
                                                    Type: Union("failed",...)

In my developement vesrion I pass rootSum to to MRVLIM and I get:

(12) -> limit(ff2, x=%minusInfinity)                                         

   (12)  0
                      Type: Union(OrderedCompletion(Expression(Integer)),...)
(13) -> limit(ff2, x=%plusInfinity)                                          

   (13)  0
                      Type: Union(OrderedCompletion(Expression(Integer)),...)
(14) -> D(ff2, x)

              2
   (14)  - ------
            2
           x  + 1
                                                    Type: Expression(Integer)

As you can see the result from limit is wrong.

In general, rootSum leads to tricky problems because theory underlying
MRVLIM is real, while complex roots introduce complex functions.
But cases like above should be doable with moderate effort.  Namely,

log(x - c) = log(x)*log(1 - c/x)

the second term goes to 1 when x goes to infinity, and we can
write asymptitic expansion of log(x - c).  For single term we
get complex coefficients, but rootSum has property that coeficients
of expansion are again rootSum-s and give real values.  So
given

\sum_{p(c) = 0} c*log(x - c)

we can compute its asymptotic expansion when x goes to infinity.
In case of convergent integral real parts will give 0.  So value
is decided by imaginary parts, that is argument of logs, but this
also goes to 0.  A bit more tricky is case when x goes to -infinity.
We can write this as log(-x - c).  As first approximation, we
rewrite it as log(-1) + log(x + c).  The log(x + c) parts can be
handled as before.  The log(-1) part requires extra care, it is
%i*%pi when imaginary part of c is positive and -%i*%pi when imaginary
part of c is negative.  So we need to compute

\sum_{Im(c) > 0} c - sum_{Im(c) < 0} c

Multiplied by %i this is real algebraic number and in principle
we should be able to compute its minimal polynomial.  If p
has degree 2*k, than degree of minimal polynomial may be
as high as binomial(2*k, k)/2.  In first relevant case, that is k=2,
degree will be 3 or less, so quite managable.  When degree is 3,
there is one real root and two complex ones.  So we get reasonably
satisfactory answer.

When x has finite limit we can simply return rootSum with x replaced
by limiting value.  Simplifying such rootSum may be quite tricky,
but is valid result.

In more general case we may have some rational function of c before
log, the computation should go on with little changes.

The above is most general integral of rational function over
real numbers, that is when we split polynomials into linear
factors over complex numbers.  In practice we get logs of
polynomials of degree bigger than 1.  Splitting into linear
factors theoreticaly should work, but is quite heavy.  ATM I have
no significantly better idea.

-- 
                              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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/ZV13AitR0xhN_R2S%40fricas.org.

Reply via email to