Yes they are the same for x>0
. However Mathematica evaluates the function over the full domain first. and the 'masks' it using region function after that. You can check that by checking the EvaluationMonitor
Reap[Plot[Surd[x + 1, 2], {x, -3, 3},
RegionFunction -> Function[x, x >= 0], EvaluationMonitor :> Sow[x],
PlotPoints -> 40, MaxRecursion -> 0]]
It shows all the points where Surd gets evaluated. To avoid these errors there are multiple options, specify directly where the function is 'valid':
Plot[Surd[x + 1, 2], {x, -1, 3}]
or just 'gag' Mathematica by telling it to be quiet:
Quiet[Plot[Surd[x + 1, 2], {x, -3, 3}, RegionFunction -> Function[x, x >= 0]]]
@Moderation Team How is this a staff pick? Is that correct?