rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

specint calls asksign about internal variable PSEY #1032

Open rtoy opened 4 months ago

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-03 22:28:23 Created by robert_dodier on 2007-01-14 21:00:40 Original: https://sourceforge.net/p/maxima/bugs/1066


assume(p > 0, a > 0); t^(1/2)*%e^(-p*t-a/t); specint(%,t); => "Is psey positive, negative, or zero?"

PSEY is an internal variable, should not be visible to user.

See comments in src/hypgeo.lisp about PSEY.

From the comments, PSEY represents the parameter in a Laplace transform. Maybe it will resolve the problem to do assume(psey > 0) or something like that. Ideally that assumption would be attached to the result (after substituting the original parameter symbol for PSEY).

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-03 22:28:24 Created by robert_dodier on 2007-01-14 21:31:49 Original: https://sourceforge.net/p/maxima/bugs/1066/#717a


Logged In: YES user_id=501686 Originator: YES

Another example:

assume (a > 0, p > 0); t*bessel_i(0,a*t/2)*bessel_i(1,a*t/2)*%e^(-p*t); specint(%,t); => Is (psey - a) (psey + a) positive, negative, or zero?

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-03 22:28:27 Created by rtoy on 2007-01-17 14:18:58 Original: https://sourceforge.net/p/maxima/bugs/1066/#2f25


Logged In: YES user_id=28849 Originator: NO

By not doing the substitution, maxima no longer asks questions about psey. That's good.

However, problem 53 in rtest14 and problems 111, 112 in rtesthyp.

I think problem 53 is ok, just a different respresntation that maxima didn't simplify.

However problems 111 and 112 are more fundamental. It calls LTEP to match a form, but the Laplace variable is p+%i*a instead of a simple variable. Perhaps some changes to LTEP could fix this.

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-03 22:28:31 Created by crategus on 2008-05-17 15:43:17 Original: https://sourceforge.net/p/maxima/bugs/1066/#bf2c


Logged In: YES user_id=2039760 Originator: NO

I had a look at the PSEY-problem.

Must of the questions for the sign of the parameters which are involved in the Laplace transform arise after calling the subroutine hgsimp-exec. This routine is part of the file hyp.lisp.

In some cases we transfer the parameter PSEY to hgsimp-exec. An example is the routine simpktf which will be called for functions involving terms e.g. like %e^(-a/t). When we do so, we are asked sometimes for the sign of PSEY. That's the case when hgsimp-exec has to calculate a square root and PSEY is involved.

In the routine negtest we check the sign of the parameter of the Laplace transform. But because we substitute the parameter with PSEY we lost the information of the sign check.

I think, the best we can do, is to give a Maxima a rule for the sign of PSEY. After addition of the following code to the routine negtest in the file hypgeo.lisp, we no longer get a question for the sign of PSEY. The testfile test_eqworld.mac I have appended to the bug report [1965640] no longer stops.

;; We know psey must be positive. psey is a substitution ;; for the parameter a and we have checked the sign. So it is the ;; best to add a rule for the sign of psey.

(mfuncall '$assume `((mgreaterp) psey 0))

(return (prog1 (maxima-substitute (mul -1 a) 'psey (ltscale u var 'psey c 0 e f))

;; We forget the rule after finishing the calculation. (mfuncall '$forget `((mgreaterp) psey 0)))))

Dieter Kaiser

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-03 22:28:34 Created by robert_dodier on 2008-05-17 19:04:27 Original: https://sourceforge.net/p/maxima/bugs/1066/#a1e7


Logged In: YES user_id=501686 Originator: YES

I'm inclined to commit the patch suggested by Dieter. What do you think, Ray?

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-03 22:28:38 Created by robert_dodier on 2015-12-16 21:59:48 Original: https://sourceforge.net/p/maxima/bugs/1066/#8872


The patch seems to have been applied in commit 7b7aff1. That seems to fix this example:

(%i1) assume(p > 0, a > 0);
(%o1)                           [p > 0, a > 0]
(%i2) t^(1/2)*%e^(-p*t-a/t);
                                      (- p t) - a/t
(%o2)                       sqrt(t) %e
(%i3) specint(%,t);
(%o3) 
                   3                                3                       3/4
   %pi (bessel_i(- -, 2 sqrt(a) sqrt(p)) - bessel_i(-, 2 sqrt(a) sqrt(p))) a
                   2                                2
 - ----------------------------------------------------------------------------
                                        3/4
                                       p

but not this one:

(%i1) assume (a > 0, p > 0);
(%o1)                           [a > 0, p > 0]
(%i2)        t*bessel_i(0,a*t/2)*bessel_i(1,a*t/2)*%e^(-p*t);
                              a t              a t      - p t
(%o2)             bessel_i(0, ---) bessel_i(1, ---) t %e
                               2                2
(%i3)        specint(%,t);
Is psey - a positive, negative or zero?