|
From: Michel T. <ta...@lp...> - 2025-11-23 14:22:30
|
Le 23/11/2025 à 13:37, David Scherfgen via Maxima-discuss a écrit : > Rubey, Martin <mar...@tu...> schrieb am So., 23. Nov. > 2025, 03:03: > > is(equal(a, b)) returns true (or false) if and only if a and b are > equal (or not equal) for all possible values of their variables, > as determined by evaluating ratsimp(a - b); > > Does this mean that is(equal(a, b)) is false if and only if the > function (a, b) \mapsto a-b does not have any zeros? > > > Yes. > > As far as I know, this is how it works: > - If ratsimp(a-b) gives 0, then is(equal(a,b)) is true. > - If ratsimp(a-b) gives a non-zero constant (no variables), then > is(equal(a,b)) is false. > - Otherwise, is(equal(a,b)) is unknown. > > Of course, this is quite limited, because it only works reliably with > rational expressions due to relying on ratsimp. > > To get better results, first convert trigonometric/hyperbolic > functions to exponential form using "exponentialize" and inverse > trigonometric/hyperbolic functions to logarithmic form using "logarc". > You may also want to denest roots using "sqrtdenest". > If you are curious, these things are defined in compar.lisp, notably the function "is" is defmspec $is, which calls mevalp1 which calls alike1. Looking at alike1 one sees a lot of cases in which things are supposed equal or not. If you trace mevalp1 and alike1 you may be surprised by the number of calls generated by the command is(equal(x,y)) 0: (MAXIMA::MEVALP1 ((MAXIMA::$EQUAL) MAXIMA::$X MAXIMA::$Y)) 1: (MAXIMA::ALIKE1 MAXIMA::$X MAXIMA::$Y) 1: ALIKE1 returned NIL 1: (MAXIMA::ALIKE1 MAXIMA::$Y MAXIMA::$X) 1: ALIKE1 returned NIL .............. A lot of ratsimps in between. 1: (MAXIMA::ALIKE1 MAXIMA::$X MAXIMA::$MINF) 1: ALIKE1 returned NIL 0: MEVALP1 returned ((($EQUAL) $X $Y) (($EQUAL SIMP) $X $Y)) (%o5) unknown -- Michel Talon |