1
$\begingroup$

This must be a very simple matter--but how to address it eludes me at the moment.

I have a series of integrands--and want to flag whether the symbolic integation has succeeded or not (in order to avoid having to deal with certain possibly cumbersome results).

NumberQ[result] gives False either way--and True if I use NumberQ[N[result]]--so that doesn't seem to succeed for my purpose.

$\endgroup$
  • 2
    $\begingroup$ It would help to have an example of what kinds of results you have that are successful and what they look like when they are unsuccessful. $\endgroup$ – bill s May 4 at 16:32
  • 1
    $\begingroup$ When you say failed, do you mean the cases where MMA returns your input to show you it couldn't deal with it, or do you need to test if the integration is correct based on some criteria? $\endgroup$ – MassDefect May 4 at 17:42
2
$\begingroup$

I assume you mean something like the following

{Integrate[Sin[Sin[Sin[x]]], {x, 0, 1}], Integrate[Sin[x], {x, 0, 1}]}
(* {Integrate[Sin[Sin[Sin[x]]], {x, 0, 1}], 1 - Cos[1]} *)

You can check which integrals have been successful by looking for residual Integrates.

FreeQ[#, Integrate] & /@ %
(* {True, False} *)
$\endgroup$
  • $\begingroup$ This certainly successfully addresses the specific question I had in mine. Didn't know of the FreeQ command. I'll accept the answer. $\endgroup$ – Paul B. Slater May 4 at 19:08

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.