BioMath - Overdrive77/BioSynapStudio-Public GitHub Wiki


BioMath Class

Utility class for performing mathematical operations relevant to biologically inspired neural simulations.


Namespace

BioSynapStudio.Net.Core.Utils

Assembly

BioSynapStudio.Net.Core.dll

Summary

The BioMath class provides core mathematical helpers for neural simulation tasks such as clamping, safe division, and shared random number generation. These utilities ensure numerical stability and consistency across simulation modules.


Static Properties

Name Type Description
Rnd Random Singleton instance of a Random generator, initialized with system time seed. Used for probabilistic simulations.

Static Methods

Clamp(double value, double min, double max)

Clamps a value between the specified minimum and maximum bounds.

double result = BioMath.Clamp(1.5, 0.0, 1.0); // result = 1.0

Parameters:

  • value – The input value to clamp.
  • min – The minimum allowed value.
  • max – The maximum allowed value.

Returns: A value constrained between min and max.


SafeDiv(double numerator, double denominator, double epsilon = 1e-9)

Performs safe division, avoiding division-by-zero errors by returning 0 if the denominator is near zero.

double result = BioMath.SafeDiv(10.0, 0.0); // result = 0.0

Parameters:

  • numerator – The top value in the division.
  • denominator – The bottom value (may be near zero).
  • epsilon – Optional safety threshold to treat small values as zero.

Returns: The quotient of the division or 0.0 if denominator is too small.


Remarks

This utility class plays a foundational role in simulations where mathematical precision and randomness must be managed carefully. Its methods reduce the risk of runtime errors and help maintain simulation stability under biological constraints.


See Also


Legal Notice This software constitutes original intellectual property of the author, protected under international copyright and patent law. Patent: GB2506327.2 – Synthesized Emotional Cognition (SEC) DOI: 10.17605/OSF.IO/XERKF