Subject: Assume database: work on a function learn-numer
From: Dieter Kaiser
Date: Mon, 05 Oct 2009 01:20:14 +0200
I have already reported some work on a function learn-numer, which puts
additional information into the database. The additional facts are added
to the context learndata and not seen by the user with the command
facts(). The commands forget and kill remove the additional facts too.
I think I have finished a first implementation. I have no longer
problems with the testsuite and the share_testsuite after correcting
problems with the assume database (reset() and killing of contexts which
are in the list $activecontexts).
Here are some examples:
It will work for any constant expression:
(%i2) assume(x<%pi/2+1);
(%o2) [%pi/2+1 > x]
(%i3) is(x<%pi);
(%o3) true
(%i4) is(x<2*%pi-1);
(%o4) true
We can combine it with the absolute value too. To do this I have
somewhat changed the existing implementation of learn-abs.
(%i5) kill(all);
(%o0) done
(%i1) assume(abs(x)<%pi/2+1);
(%o1) [%pi/2+1 > abs(x)]
Switch to the context learndata to have a look what is assumed in
addition:
(%i2) context:learndata;
(%o2) learndata
(%i3) facts();
(%o3) [%pi/2+1 > x,x > -%pi/2-1,2.570796326794897 > x,x >
-2.570796326794897,
2.570796326794897 > abs(x)]
We go back to the user context:
(%i4) context:initial;
(%o4) initial
We get the expected answers:
(%i5) is(x<%pi);
(%o5) true
(%i6) is(abs(x)<%pi);
(%o6) true
(%i7) is(abs(x)>-%pi);
(%o7) true
(%i8) is(abs(x)<%pi+1);
(%o8) true
It works for any expression with the build in constants %pi, %e, ...
Any suggestions or comments?
Dieter Kaiser