The following quits with message $Failed and no other information on Mathematica 13.2 (also on cloud), are there any debugging tricks to find the source of the error?
d = 10;
R2toSpectrum[R_, d_] := Module[{h, dd, decay},
decay =
If[R < 1.001, 100.,
dd /. FindRoot[
HarmonicNumber[d, dd]^2/HarmonicNumber[d, 2 dd] == R, {dd, 2,
0, 100}]];
h = Table[i^-decay, {i, 1, d}];
h/Total[h]
];
rrPlot2[R_] := Plot[Max[R2toSpectrum[R, d]], {R, 1, d}]
rrPlot2[5]

rrPlot2[5]returns$Failed, so looking at the definition forrrPlot2[R_], we replace the instances ofRwith 5, and see what happens.Plot[Max[R2toSpectrum[5, d]], {5, 1, d}]returns$Failed. But that variable specification is weird. Did you mean to userrPlot2[d_] :=when defining the function? $\endgroup$