#2257 ERROR: quad_qags and matrix


The problem is that it isn't possible integrate a matrix with quad_qags function.
I have a 4x1 matrix, for example, and I want integrate componet by component with a bucle, but it doesn't work... I used a trap to get my objetive: I used determinant() function to convert the 1x1 vector to a number.


  • Barton Willis

    Barton Willis - 2011-08-24

    You can do want you want by mapping a lambda form onto the matrix:

    (%i37) matrixmap(lambda([s], first(quad_qags(s,x,0,1,'epsrel=1.0d-10))), matrix([1,x],[x^2,x^3]));
    (%o37) matrix([1.0,0.5],[0.333333333333333,0.25])

    Correct me if I'm mistaken, but isn't your report a feature request, not a bug?

  • Barton Willis

    Barton Willis - 2011-08-24

    Another thing: you didn't need to use determinant to extract the 1,1 entry of a 1x1 matrix. Here are two ways:

    (%i56) m : matrix([42]);
    (%o56) matrix([42])
    (%i57) first(first(m));
    (%o57) 42
    (%i58) m, scalarmatrixp : 'all;
    (%o58) 42

  • Robert Dodier

    Robert Dodier - 2011-09-24

    Hi, this problem is not a bug. I think the best way to handle it is by mapping a lambda expression over the matrix, as suggested in a previous comment. I'm closing this report as "won't fix".

  • Robert Dodier

    Robert Dodier - 2011-09-24
    • status: open --> closed

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks