# Why doesn't the 'If' statement work in Mathematica 12 for plotting?

I have the following code:

Subscript[a, 0] = 3.88/10^14;
G = 6.67384/10^20;
solarMass = 1.9891*10^30;
fundamentalPlane = Plot3D[massFunction[v, r], {v, 50, 700}, {r, 0, 1*10^19}, AxesLabel -> {Style["velocity", FontSize -> 14], Style["radius", FontSize -> 14], Null}, ImageSize -> Large];
maximumMass = Graphics3D[Point[Table[{v, v^2/(2*Subscript[a, 0]), 49*v^4}, {v, 50, 700}]]];
Show[fundamentalPlane, maximumMass]


In Mathematica 10.3, it produced this graph: In Mathematica 12, it produces this graph (I haven't changed the code): The problem appears to be the 'If' statement. I'm using the conditional function to crop out values that are not physical (such as negative mass). What am I doing wrong and is there a better, more supportable way of removing values from a 3D plot that are not part of the solution domain?

• In 12.1 Windows10, simply adding PlotPoints->10 causes Mathematica to hang. It does complete though with an undesirable result. Jun 7 '20 at 13:22
• It's not specific to theIf statement - you can replace it with a UnitStep and product but it's still bad: UnitStep[velocity^2 - Subscript[a,0]*radius]*((velocity^2 - Subscript[a,0]*radius)*radius)/(G*solarMass) Jun 7 '20 at 13:33
• You can use PlotRange -> {0, Automatic} if you want to crop out negative values and this looks much better. But still it doesn't explain the regression in Plot3D behaviour. There's nothing wrong with your code in my opinion, as this looks correct: ListPointPlot3D[Flatten[Table[{v, r, massFunction[v, r]}, {v, 50, 700, 10}, {r, 0, 1*10^19, 10^17}], 1]] so I'm guessing Plot3D changed how it handled large plot ranges in v11 or 12. Jun 7 '20 at 13:46
• @flinty - The PlotRange appears to have done the trick. I don't know if there's a more elegant way of doing this using domains, but if you'd like to post this as an answer, I'll up-vote it. Jun 7 '20 at 14:11
• I think an answer should also explain why the Plot3D plot range behaviour has changed and I don't know this. I'd prefer if somebody with deeper knowledge would answer it. Jun 7 '20 at 14:13

Specify Exclusions -> None:
Plot3D[massFunction[v, r], {v, 50, 700}, {r, 0, 1*10^19}, 