1
$\begingroup$

I'm new to Mathematica and I keep getting this error(in the title) when I'm trying to solve this definite integral numerically. This is for a math class where we have to use the arc length.

f[x_] := 6 x[1 - x]
NIntegrate[Sqrt[1. + f'[x]^2], {x, 0., 1.}]

Any help would be appreciated. I've googled several times and while a lot of people are getting the same error, their solutions/problems aren't really the same as mine. My instructor showed us this exact syntax I am pretty sure and he was getting the correct answer.

The error is

NIntegrate::inumr: The integrand Sqrt[1. +36 (1[1+Times[<<2>>]]-(x^[Prime])[Plus[<<2>>]])^2] has evaluated to non-numerical values for all sampling points in the region with boundaries {{0.,1.}}.

EDIT: Thank you. I thought it was brackets for some reason.

$\endgroup$
2
  • 1
    $\begingroup$ Try f[x_] := 6 x(1 - x): Parentheses for grouping, square brackets for function calls. $\endgroup$
    – Michael E2
    Oct 16, 2016 at 22:44
  • $\begingroup$ Zach, if you forget your password, see mathematica.stackexchange.com/users/account-recovery. If not, then there some other person trying to edit your post and pretend to be you. $\endgroup$
    – Michael E2
    Oct 16, 2016 at 23:00

1 Answer 1

0
$\begingroup$
f[x_] := 6 x[1 - x]

This is a mistake!

The right definition of a function is:

f[x_]:=6x(1-x)

Please remember: [] is a function flag. () is grouping the terms of a expression.

$\endgroup$
1
  • $\begingroup$ Pretty much what I said in my comment! $\endgroup$
    – Michael E2
    Oct 17, 2016 at 2:08

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