approx-alike bug



Hmm, I'd have thought that a regression test should check that taylorinfo
of two taylor expressions was the same, not just the ratdisrep.  The list
of vars of a CRE probably doesn't matter, because the ratdisrep will be
different except in degenerate cases, and anyway doesn't have any
mathematical importance (unlike the order of a taylor expansion, which
does).

          -s

On Thu, Dec 6, 2012 at 3:44 PM, Barton Willis <willisb at unk.edu> wrote:

> For now I plan to fix the bug and clean up the code somewhat. Equality of
> the CRE expressions is done by converting to general form.
> This means that a test such as
>
>   taylor(0,x,0,12);
>   0$
>
> will pass--this is the way the testing code worked before I re-wrote it
> (previously the testing code tried various checks including string
> equality of the grind form).
>
> Both Richard Fateman and Stavros helped me clean up the code. Additional
> suggestions are welcomed.
>
> --Barton
>
> (defun approx-alike (f g)
>   (cond ((floatp f) (and (floatp g) ($float_approx_equal f g)))
>     (($bfloatp f) (and ($bfloatp g) ($bfloat_approx_equal f g)))
>     (($ratp f) (approx-alike g (ratdisrep f)))
>     (($ratp g) (approx-alike g f))
>     ((atom f) (and (atom g) (equal f g)))
>     ;; allow a test such as sign(z); 'pnz$ to pass
>     ((and (eq  'mquote (mop f)) (not (and (consp g) (consp (car g)) (eq
> 'mquote (mop g)))))
>      (approx-alike (second f) g))
>     ((atom g) (equal f g))
>     ((eq 'lambda (mop f))
>      (and (eq 'lambda (mop g))
>           (approx-alike-list (mapcar #'(lambda (s) (simplifya s nil))
> (margs f))
>                  (mapcar #'(lambda (s) (simplifya s nil)) (margs g)))))
>     ((arrayp f)
>      (and (arrayp g) (approx-alike ($listarray f) ($listarray g))))
>     ((hash-table-p f)
>      (and (hash-table-p g) (approx-alike ($listarray f) ($listarray g))))
>     ((and (eq (not (memq 'array (car f))) (not (memq 'array (car g))))
>           (or (approx-alike (mop f) (mop g))
>           (and (symbolp (mop f)) (symbolp (mop g)) (approx-alike ($nounify
> (mop f)) ($nounify (mop g))))))
>      (approx-alike-list (margs f) (margs g)))
>     (t nil)))
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>