On Wed, May 15, 2024 at 07:19:08AM +0200, Ralf Hemmecke wrote:
> On 5/15/24 01:21, Qian Yun wrote:
> > One possible explanation:
> > 
> > )compile a spad file clears internal Kernel cache.
> > 
> > So the following computation can have messed up Kernel order.
> > 
> > So after compiling a spad file, do not use kernels created before that.
> 
> 
> OK, that explains some of the oddity, but not why "digits 20" makes it to
> fail and "digits 21" sometimes helps to make it work and sometimes not.

TrigonometricManipulations (which implements imag) is using
sign$ElementaryFunctionSign to determine if a root is complex.
'sign' may return "failed" and 'imag' treats this the same as
nonnegative, so assumes that root is real.  'sign' for numbers
tries interval approximation.  If precision it too low, then
this fails and 'sign' returns "failed"...

Mathematically determining sign of numbers (which is needed to choose
form of roots) requires numerical computation potentially of much
higher precision than input data.  So there will be a cutoff or
we would run out of memory (or time) in some cases.  So one question
is how hard FriCAS should try, currently FriCAS just uses current
numeric preciion and do not try to escalate.  Another question
is what to do in case of failure.  Honestly FriCAS should return
"failed" or signal error in such case.  'sign' returns "failed"
which IMO is OK.  Probably 'imag' should signal error.  I can
guess that possibly users call 'imag' and related functions
without real need, so lying (as done now) could be a pragmatic
choice.  Or simply this is piece of research code that never
really get finished.

-- 
                              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 view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/ZkSDlnGKt-C-mlBf%40fricas.org.

Reply via email to