I am trying to solve the function below for values of y of 0.5, 1, 1.5, 2, 2.5, and 3.

This is how I defined the function:

f[y_]:=1-0.484*Integrate[E^(-x)Sinh[Sqrt[2x]],{x, 0, y}]

When I input f[0.5] I receive an output with the definite integral in terms of x written out but not solved. When I attempt to solve for a numerical answer I get the error message NIntegrate::inumr NIntegrate::inumr: The integrand E^-x sinh[Sqrt[2] Sqrt[x]] has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,0.5}}.

Is this a syntax error on my part? How should I go about fixing this error? Thank you in advance for any responses.

  • $\begingroup$ Just typing in your integral directly gives the solution for any y: f[y_] :=1 - 0.121 (Sqrt[ 2 E \[Pi]] (-Erf[1/Sqrt[2] - Sqrt[y]] + Erf[1/Sqrt[2] + Sqrt[y]]) + 4 Sinh[Sqrt[2] Sqrt[y]] (-Cosh[y] + Sinh[y])) $\endgroup$ – Felix Mar 1 '17 at 5:12
  • 1
    $\begingroup$ I'm voting to close this question as off-topic because I cannot reproduce the problem the user is experiencing; $\endgroup$ – m_goldberg Mar 1 '17 at 10:58

There is no issue with the piece of code you provided. BTW, you can get the values of the expression involving the integral for varying the upper limit, like this,

Table[1 - 0.484*Integrate[E^(-x) Sinh[Sqrt[2 x]], {x, 0, y}], {y, 0, 0.5, 0.1}]

{1., 0.986135, 0.962314, 0.93346, 0.901524, 0.867685}


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