A friend sent me a mathematica notebook containing the following line:

Plot3D[Binomial[50,x+y] * Binomial[x+y,y],{x,0,50},{y,0,50-x},
AxesLabel->{"A","B","Num"},PlotRange->Full,PlotLabel->"Number of sequences",

I can see that he evaluated the expression and can see that the plot was generated, however, when i try to evaluate the expression, i get the following error:

Plot3D::plln: Limiting value -50+x in {y,0,-50+x} is not a machine-sized real number.

I am using Mathematica version 11.2, I am not sure what version he was using. My guess is that my version is newer than his. what changes to the code can be done to get the same output?

  • $\begingroup$ it works for me, on 11.3. No errors. Try with clean kernel. $\endgroup$
    – Nasser
    Apr 4 '18 at 19:48
  • $\begingroup$ I have tried it (evaluation->quit kernel->local), still no luck. $\endgroup$
    – Shak
    Apr 4 '18 at 20:01
  • $\begingroup$ 11.3 can handle it. But not 11.2. But I do not understand the limits on y any way. You are saying y goes from 0 to 50-x? But x itself changes. So the upper limit of y is not fixed by also changes all the time. That is why Plot3D got confused in 11.2. It seems they did something in 11.3 to handle this confusing situation. $\endgroup$
    – Nasser
    Apr 4 '18 at 20:15
  • $\begingroup$ I want the plot to stop at the line y = 50-x (meaning the plot should look like half a square when looking at the xy plane). $\endgroup$
    – Shak
    Apr 4 '18 at 20:21

First, define the region in $x,y$-plane and then plot over that reqion, like this:

reg = ImplicitRegion[0 <= x <= 50  &&  0 <= y <= 50 - x, {x, y}];

Plot3D[Binomial[50, x + y]*Binomial[x + y, y],
 {x, y} ∈ reg,
 AxesLabel -> {"A", "B", "Num"}, PlotRange -> Full, 
 PlotLabel -> "Number of sequences", LabelStyle -> FontSize -> 20]

This works with Mathematica 10.4. You can make that "element of" symbol by typing Esc el Esc.

  • $\begingroup$ this is a good workaround. thanks! $\endgroup$
    – Shak
    Apr 4 '18 at 20:44

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.