I have a Spline function defined as follows.
Points = {{0, 0}, {0, 1}, {1, 1}, {1, 0}, {0, 0}};
bsf = BSplineFunction[Points, SplineDegree -> 1];
A Parametric Plot look like this:
ParametricPlot[bsf[r], {r, 0, 1}]
But when I try to do NIntegrate, I get for the first component
NIntegrate[bsf[t][[1]], {t, 0, 1}]
An output of 0.5 as it should be, but for the second component
NIntegrate[bsf[t][[2]], {t, 0, 1}]
I get as an output
I still get the correct output though. But If I just type
NIntegrate[bsf[t], {t, 0, 1}]
I just get error
Why is this and how can I fix this?
Thanks in advance!
InputForm[bsf]
to see what you are extracting with your part specifications. I don't think you are getting what you intend. Also, I think we are running in circles here because you haven't disclosed your true goal. From your previous question, for what purpose do you want a parametric representation of those lines? If you are trying to get the area enclosed by some points there are other more direct ways. Please explain your underlying problem (perhaps in a new question) and we may be able to help you better. $\endgroup$gg[t_?NumericQ, index_] := bsf[t][[index]]
. Then you can feed this toNIntegrate
, e.g.NIntegrate[gg[t, 2], {t, 0, 1}]
yields0.5
. The issue is thatbsf[t]
doesn't evaluate to a list of two elements until after you have entered a numerical value fort
. I haven't figured out yet if there's a way to extract the two component functions. $\endgroup$