On 12/5/20 11:26 PM, Waldek Hebisch wrote:
On Sat, Dec 05, 2020 at 09:06:22PM +0800, oldk1331 wrote:
Almost sure it is bug when adding new kernel in cache, in function
"enterInCache".

ATM our handling of kernel cache is unsound.  Basicaly, kernel
cache assumes order and in fact there are no consistent order
on kernels.  Many problems would go away if we would switch
to linear search for kernels (awoiding use of order).  But
that would slow down unormously routines making heavy
use of kernels (mainly series expansion and limits).  And
some problem would remains.

In 2015 March 20, email titled "Re: Troubles with kernels",
you said:

There is potential problem with binary search that we use.
Linear search trough all of the cache should work fine.
Surprisingly after fixing a few other bugs I was not able to
produce example of failure due to wrong sort, so I keep it
as is.

Do you have other failure examples since then?

I expect that sooner or later problem will show up,
then we will have to think about solution.  One possibility is
to use linear search, which is slow.  Another possibility is
to force removal of irrationalities from denominators.
That would make representation canonical and allow
sorting/hashing at representation level.

To record the problem we encountered this time, it boils down to

y := (complex(0,1)*x*exp((complex(0,2)*x)/complex(1,0))+complex(-1,0)*x)/(complex(1,1)*exp((complex(0,2)*x)/complex(1,0))+complex(1,1)) a := (complex(0,-1)*exp((complex(0,1)*x)/complex(1,0))^2+complex(0,-1))/(complex(2,0)*exp((complex(0,1)*x)/complex(1,0))) b := (complex(-2,0)*exp((complex(0,1)*x)/complex(1,0)))/(complex(1,0)*exp((complex(0,1)*x)/complex(1,0))^2+complex(-1,0))

And smaller?(y,a) smaller?(a,b) smaller?(b,y) are all true,
causing it impossible to order kernel exp(y),exp(a),exp(b).


About possible solution: we can do better than linear search,
we should be able to classify kernels into groups, and groups
are strictly ordered.  Then search and insert of kernel into
cache would be quicker.

--
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/5492bb8e-77f4-5e88-6424-8e328bcb87e5%40gmail.com.

Reply via email to