MCPcopy Create free account
hub / github.com/Notgnoshi/generative / build_dynamical_system_function

Function build_dynamical_system_function

tools/attractor.rs:109–122  ·  view source on GitHub ↗
(args: &CmdlineOptions)

Source from the content-addressed store, hash-verified

107type DynamicalSystemFn = Box<dyn Fn(f64, f64) -> (f64, f64) + 'static>;
108
109fn build_dynamical_system_function(args: &CmdlineOptions) -> eyre::Result<DynamicalSystemFn> {
110 // Interpret the CLI arguments to build the dynamical system function
111 if !args.math.is_empty() || args.script.is_some() {
112 build_dynamical_system_function_from_args(args)
113 } else {
114 // If no --math arguments are provided, use a default function useful for prototyping
115 Ok(Box::new(|x, y| {
116 (
117 f64::sin(0.97 * y) - f64::cos(-1.899 * x),
118 f64::sin(1.381 * x) - f64::cos(-1.506 * y),
119 )
120 }))
121 }
122}
123
124fn build_dynamical_system_function_from_args(
125 args: &CmdlineOptions,

Callers 1

mainFunction · 0.85

Tested by

no test coverage detected