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

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

Mathematica graphics

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.

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

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]

Mathematica graphics

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]

Mathematica graphics

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

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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