I am trying to give options to a user to enter an advance options to a calculation. Like doing NIntegrate[f,{z,1,4},WorkingPrecision->40] this works without WorkingPrecision and more options. For example
Dummyfunc[f_, g_, din_] := Module[{d,h},
If[din == {}, d = 16, d = din];
h = SetAccuracy[f g, d];
Return[h]];
f = 2/3;
g = 7/6;
test1 = Dummyfunc[f, g];
test2 = Dummyfunc[f, g, 50];
In here I want accuracy default 16 if the user doesn't enter any, but if the user enters it will use that for SetAccuracy.
How can I do that?
Thank you
Update with OptionPattern
Dummyfunc[f_, g_, OptionsPattern[{}]] := Module[{d},
If[OptionValue == {}, d = 16, d = OptionValue];
h = SetAccuracy[f g, d];
Return[h]];
f = 2/3;
g = 7/6;
test1 = Dummyfunc[f, g];
test2 = Dummyfunc[f, g, 50];
Print[test1];
Print[test2];
This also fails.