On Sat, 5 Jun 2021 21:55:53 +0000, "Vladimir V. Kisil" <V.Kisil@leeds.ac.uk> said:
VVK> You are right, normal() shall be called by VVK> the user if needed. I am attaching the amended patch. Yet, if some simplification to a relational appears from cancellations between the left- and the right-hand sides, then application of normal() before the conversion to bool will miss it. Thus, I propose an additional method relational::canonical(), which returns an equivalent relational with the zero right-hand side. With this method the following is possible: possymbol p("p"); relational rel =(p >= (p*p-1)/p); if (ex_to<relational>(rel.canonical().normal())) cout << "correct inequality" << endl; The respective patch (including the tutorial) is attached. Best wishes, Vladimir -- Vladimir V. Kisil http://www.maths.leeds.ac.uk/~kisilv/ Book: Geometry of Mobius Maps https://doi.org/10.1142/p835 Soft: Geometry of cycles http://moebinv.sourceforge.net/ Jupyter notebooks: https://github.com/vvkisil/MoebInv-notebooks
On Sat, 5 Jun 2021 22:14:33 +0200, "Richard B. Kreckel" VVK> <kreckel@in.terlu.de> said:
RK> Dear Vladimir, RK> On 04.06.21 10:31, Vladimir V. Kisil wrote: >>> I am attaching a small patch. With it the following conversions >>> from relational to Boolean will become "true" from the current >>> "false": >>> >>> realsymbol x("x"); possymbol p("p"); cout << bool(p>0) << endl; >>> cout << bool(abs(x)>=0) << endl; RK> Thank you for submitting this patch! RK> What is the reason to call .normal() in the symbolic case? RK> Generally, we never do automatic evaluation of expressions with RK> complexity worse than O(n log n). See section 4.2 of the RK> tutorial. RK> The reason we don't do this is to not surprise the user with RK> skyrocketing run-times, especially when expressions get longer RK> or nested. It is a different story when the user calls a special RK> transformation explicitly. RK> Admittedly, this case here is not exactly automatic RK> evaluation. But still, it is a normal() hidden deep inside a RK> seemingly innocent coercion to Boolean. I think it would be more RK> appropriate to let the user call .normal() explicitly, it that RK> is desired. RK> May I suggest to remove this one line? RK> All my best, -richy. -- RK> Richard B. Kreckel RK> <https://in.terlu.de/~kreckel/>