I have a matrix nxn with coefficients a[i,j] like:

a[i,j]=NIntegrate[T[r], {r, -le, le}] - NIntegrate[T[r] Abs[r]/le, {r, -le, le}]

I can solve the matrix but I want to know if there is a method to show the matrix simbolically before the solve. Then I don't want to see only the end solution but even the composition of the matrix with the integrals for extended. Is it possible?

  • $\begingroup$ What do you mean by "solve"? I don't see any equation! $\endgroup$ Jul 9 '15 at 14:15
  • $\begingroup$ Are all entries equal? $\endgroup$
    – Coolwater
    Jul 9 '15 at 14:19
  • $\begingroup$ no, the a[i,j] are different. I posted here only a term . for "solve" I mean that I don't want that mathematica solves the Nintegral in the coefficient. At the end I obtain a matrix like: [{1,3,5},{3,1,4},{5,4,1}]. but i want to see the matrix composed by integral $\endgroup$
    – diana
    Jul 9 '15 at 14:20

You're going to have to write a separate function that uses Integrate instead of NIntegrate if you want something that looks like a matrix of traditional integrals, which is what I think you want. You also need to use HoldForm to keep the integral from evaluating. You also need someway to set the values that you want in the held version of the expression. I've used With, someone else may have a better idea. Without this you'll get the symbol used as the table iterator in your integral.

  With[{f = i, g = j},
   HoldForm@Integrate[x, {x, f, g}]]
  , {i, 1, 4}
  , {j, 1, 4}
  ] // MatrixForm


enter image description here

  • 1
    $\begingroup$ thank you!!!! this is what i was looking for! $\endgroup$
    – diana
    Jul 9 '15 at 14:38
  • $\begingroup$ What I have noticed is m.n would "work" to produce a meaningful result for matrices m and n but m//MatrixForm . n//MatrixForm does not compute. This would seem to be not explicit in the documentation? $\endgroup$
    – dearN
    Jul 9 '15 at 15:12
  • 1
    $\begingroup$ MatrixForm is a formatting function that produces readable output. You don't want to do calculations on lists that you've applied MatrixForm to. $\endgroup$
    – N.J.Evans
    Jul 9 '15 at 15:37
  • $\begingroup$ @diana since this answer seems to solve your problem, you might want to accept it by clicking on the gray check mark next to it. $\endgroup$
    – MarcoB
    Jul 11 '15 at 3:29
  • $\begingroup$ @MarcoB thank you I dind't know it! $\endgroup$
    – diana
    Jul 11 '15 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.