2023-02-08
Differential Equations: Ode (Ordinary Differential Equation), Sde (Stochastic Differential Equation), Dde (Delay Differential Equation), Dae (Differential Algebraic Equation)

ODEs, SDEs, DDEs, and DAEs are types of mathematical models used to describe various systems and processes in different fields such as physics, engineering, economics, and many others.

ODE (Ordinary Differential Equation) represents a relationship between an unknown function and its derivatives. It is a mathematical description of how a quantity changes with respect to one independent variable. ODEs are used to model physical systems where the rate of change of a state variable can be expressed as a function of the state itself.

SDE (Stochastic Differential Equation) is a type of differential equation that contains a random term, which accounts for the uncertainty or randomness in the system being modeled. SDEs are used to model systems where the rate of change of a state variable is not only a function of the state but also of a random process.

DDE (Delay Differential Equation) is a type of differential equation where the current state of a system depends not only on its present values but also on the values of the state in the past. DDEs are used to model systems where there is a delay between the time a change occurs and its effect on the state of the system.

DAE (Differential Algebraic Equation) is a type of mathematical model that combines aspects of differential equations and algebraic equations. DAEs are used to model systems where the equations of motion cannot be expressed solely in terms of derivatives of the state variables.

In conclusion, these types of models are used to describe and analyze complex systems by mathematically representing the relationships between variables and their derivatives, and they are crucial in many fields to make predictions and understand the behavior of various systems.

Read More

2022-09-18
Trainable Bezier Curve Multiparameter Regressor

bezier

first, we need a bezier curve connects (0,0) and (1,1)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import numpy as np
import bezier
def bezierCurve(start=(0,0), end=(1,1), skew=0):
# skew: (-0.5,0.5) otherwise this shit will look ugly.
assert skew >=-0.5
assert skew <=0.5
x_start, y_start = start
x_end, y_end = end
x_diff = x_end - x_start
y_diff = y_end - y_start
nodes1 = np.asfortranarray(
[
[x_start, x_diff * (0.5 + skew), x_end],
[y_start, y_diff * (0.5 - skew), y_end],
]
)
curve1 = bezier.Curve(nodes1, degree=2)
curve_params = {'x_start':x_start, 'x_diff':x_diff,'x_end':x_end}
return curve1, curve_params
def evaluateBezierCurve(input_value:float,curve, curve_params:dict)
x_start = curve_params['x_start']
x_end = curve_params['x_end']
assert x_start <= input_value
assert x_end >= input_value
x_diff = curve_params['x_diff']
s = (input_value - x_start)/x_diff
points = curve.evaluate(s)
# we only get the single point.
point = points.T[0]
x,y = point
result = y
return result

then, we define our very recursive or flexible regressor:

1
2
3
4
5
6
7
8
9
def multiParameterExponentialNetwork(*args, input_bias=0.05, curve_function=bezierCurve, curve_function_kwargs = {'start':(0,0),'end':(1,1)'skew':0}, evaluate_function=evaluateBezierCurve):
curve, curve_params = curve_function(**curve_function_kwargs)
value = evaluate_function(input_bias, curve, curve_params)
for index, input_value in enumerate(args):
apply_list = [input_value]*(index+1)
for apply_item in apply_list:
value += (1-value)*function(apply_item, **function_kwargs)
return value

Read More