Menu

#4325 Maxima can't differentiate beta function

None
closed
5
2024-08-08
2024-06-30
Raymond Toy
No

An example:

(%i3) diff(beta(m,x),x);
                                d
(%o3)                           ── (beta(m, x))
                                dx

But if we convert the beta function to gamma functions, we get a derivative:

(%i7) makegamma(beta(m,x));
                               gamma(m) gamma(x)
(%o7)                          ─────────────────
                                 gamma(x + m)
(%i8) diff(%,x);
           gamma(m) psi (x) gamma(x)   gamma(m) gamma(x) psi (x + m)
                       0                                    0
(%o8)      ───────────────────────── - ─────────────────────────────
                 gamma(x + m)                  gamma(x + m)

This could be rewritten in terms of beta and psi[0]. There doesn't seem to be a function to convert gamma to beta functions.

Discussion

  • Robert Dodier

    Robert Dodier - 2024-07-10
    • labels: --> diff, beta
     
  • David Billinghurst

    The following works. I am not familiar with MQAPPLY and would welcome guidance on style.

    ;; Derivative of beta function
    ;; https://functions.wolfram.com/GammaBetaErf/Beta/
    ;; https://en.wikipedia.org/wiki/Beta_function
    
    (defprop %beta
      ((a b)
        ; derivative wrt a
        ((mtimes)
          (($beta) a b)
          ((mplus)
            ((mqapply) (($psi array) 0) a)
            ((mtimes) -1
              ((mqapply) (($psi array) 0) ((mplus) a b)))))
         ; derivative wrt b
         ((mtimes)
          (($beta) a b)
          ((mplus)
            ((mqapply) (($psi) 0) b)
            ((mtimes) -1
              ((mqapply) (($psi array) 0) ((mplus) a b))))))
      grad)
    
    (%i4) diff(beta(a,b),a);
    (%o4) -(beta(a,b)*(psi[0](b+a)-psi[0](a)))
    (%i5) diff(beta(a,b),b);
    (%o5) -(beta(a,b)*(psi[0](b+a)-psi[0](b)))
    (%i6) diff(beta(a,b),a,2);
    (%o6) beta(a,b)*(psi[0](b+a)-psi[0](a))^2-beta(a,b)*(psi[1](b+a)-psi[1](a))
    (%i7) diff(beta(a,b),b,2);
    (%o7) beta(a,b)*(psi[0](b+a)-psi[0](b))^2-beta(a,b)*(psi[1](b+a)-psi[1](b))
    (%i8) diff(beta(a,b),a,1,b,1);
    (%o8) beta(a,b)*(psi[0](b+a)-psi[0](a))*(psi[0](b+a)-psi[0](b))
     -beta(a,b)*psi[1](b+a)
    
     
  • Raymond Toy

    Raymond Toy - 2024-08-07

    I think this is fine. Something similar is used in derivative of bessel_j. It seems that mqapply is how things like psi[0](x) are represented.

     
  • David Billinghurst

    Fixed with commit [1be377]

     

    Related

    Commit: [1be377]


    Last edit: David Billinghurst 2024-08-08
  • David Billinghurst

    • status: open --> closed
    • assigned_to: David Billinghurst
     

Log in to post a comment.