# Unexpected behavior of BSplineFunction and BezierFunction

\$Version
ParametricPlot[BezierFunction[RandomInteger[100,{3,2}]][t],{t,0,1}]


10.4.1 for Microsoft Windows (64-bit) (April 17, 2016)

Crazy result.But the documentation have not any specification for this.And the BezierFunction and BSplineFunction have a same behavior in my PC.

And when I input like this

temp = RandomInteger[100, {3, 2}];
ParametricPlot[BezierFunction[temp][t], {t, 0, 1}]


We'll get the right answer.If anybody can confirm this.I'll add a bug for this post and give a support to wolfram.

• happens also in V9.
– kglr
Commented Apr 24, 2016 at 5:27
• You say BSplineFunction[] in the title, but BezierFunction[] in the body. Which one do you actually want? Commented Apr 24, 2016 at 5:38
• try ParametricPlot[ Evaluate@BezierFunction[RandomInteger[100, {3, 2}]][t], {t, 0, 1}]?
– kglr
Commented Apr 24, 2016 at 5:41
• ... or ParametricPlot[ BezierFunction[RandomInteger[100, {3, 2}]][t], {t, 0, 1}, Evaluated -> True]
– kglr
Commented Apr 24, 2016 at 5:42
• @J.M. It's a typo.And thanks for your point out that.
– yode
Commented Apr 24, 2016 at 5:45

What is happening: For every value of t that is sampled a new triple of Randominteger pairs is generated and a new BezierFunction is constructed. So every t that is sampled is processed with a different function. This can be seen using Trace on a simpler version of the problem.

Trace[ParametricPlot[BezierFunction[RandomInteger[100, {3, 2}]][t], {t, 0, 1},
PlotPoints ->3, MaxRecursion -> 0,  AspectRatio -> 1], BezierFunction| RandomInteger]


Solution: Evaluateing the first argument of ParametricPlot or using the option Evaluated->True gives the expected output.

ParametricPlot[Evaluate@BezierFunction[RandomInteger[100, {3, 2}]][t], {t, 0, 1},
AspectRatio -> 1]


ParametricPlot[BezierFunction[RandomInteger[100, {3, 2}]][t], {t, 0, 1},
Evaluated -> True, AspectRatio -> 1]