3
$\begingroup$

In Mathematica 5.x days many packages used the following standard mechanism to read option values

Options[myfun]={myQuiet->True};

myfun[arg_,opts___?OptionQ]:=Module[{theQuiet},
theQuiet=((myQuiet/.{opts})/.Options[myfun,myQuiet]);
someCode
]

However it does not cover passing values of more complex options like myMethod->{"TensorProduct", myOrdering->1,myStart->someValue}

Sure I can use First/Rest commands to read values of myMethod suboptions, however, I would like to know what is the standard/recommended way to deal with suboptions and how to set their default values.

$\endgroup$
  • 1
    $\begingroup$ Have you seen Dealing with nested options? $\endgroup$ – jkuczm Feb 5 '16 at 15:05
  • $\begingroup$ Thanks, I didn't seen beforer, however it is not about the same think I want. My wish to learn how for example NDSolve[system, Method -> {"ExplicitRungeKutta", "DifferenceOrder" -> 5, "Coefficients" -> DOPRICoefficients}]; options are passed. $\endgroup$ – user18792 Feb 8 '16 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.