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$
2
  • 1
    $\begingroup$ Have you seen Dealing with nested options? $\endgroup$
    – jkuczm
    Feb 5, 2016 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$
    – Acus
    Feb 8, 2016 at 7:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.