I read this (Six Reasons Why the Wolfram Language Is (Like) Open Source), which inspired me to re-investigate Mathematica's implementation of some numerical methods. I would like to see the code that evaluates, say, a differential equation via NDSolve[___,Method->((Some Method))].
I've tried the approaches given in the blog post (i.e., ResourceFunction["PrintDefinitions"][NDSolve]), but this only gives me a list of available NDSolve options. Some searching around revealed this beautiful package, Spelunking, but that seems to do more or less the same thing.
Spelunk[NDSolve]
{
{{
{Options[NDSolve] = {AccuracyGoal -> Automatic,
Compiled -> Automatic, DependentVariables -> Automatic,
DiscreteVariables -> {}, EvaluationMonitor -> None,
InitialSeeding -> {}, InterpolationOrder -> Automatic,
MaxStepFraction -> 1/10, MaxSteps -> Automatic,
MaxStepSize -> Automatic, Method -> Automatic,
NormFunction -> Automatic, PrecisionGoal -> Automatic,
StartingStepSize -> Automatic, StepMonitor -> None,
WorkingPrecision -> MachinePrecision}}
}}
}
I've also attempted defining functions that call NDSolve with a specific method, but that did not reveal anything useful. I also found other Q/A pairs that pointed to Trace[] and TracePrint[], but those also didn't reveal anything substantive.
If Mathematica is (like) open source, how can I find the source for this example (or ones like it)?
Update: I found the option Trace[NDSolve[{x'[t] == t, x[0] == 0}, x, {t, 0, 6}], TraceInternal -> True] that opens up a can of back-end worms. This might be the best we can do (h/t this post).
NDSolveis in C for efficiency, or that it calls functions from other libraries. Very interesting question, though. $\endgroup$NDSolvecalls are surely in C/C++, but I'm also confident that there's more of a Wolfram Language backend toNDSolvethan what appears here. I ran into the same situation withNIntegrate. $\endgroup$