0
$\begingroup$

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.

$\endgroup$

closed as off-topic by MarcoB, gwr, m_goldberg, happy fish, corey979 Mar 1 '17 at 15:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – MarcoB, gwr, happy fish
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\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
1
$\begingroup$

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}

$\endgroup$

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