auto(0129): agents_dashboard — secret_store_cpp_infra + CMakeLists register #4
@@ -0,0 +1,43 @@
|
||||
package datascience
|
||||
|
||||
// LorenzState representa el estado del atractor de Lorenz en 3D.
|
||||
type LorenzState struct {
|
||||
X, Y, Z float64
|
||||
}
|
||||
|
||||
// LorenzParams define los parámetros del atractor de Lorenz.
|
||||
type LorenzParams struct {
|
||||
Sigma float64 // Rate of rotation (default 10)
|
||||
Rho float64 // Size of attractor (default 28)
|
||||
Beta float64 // Damping (default 8/3)
|
||||
}
|
||||
|
||||
// DefaultLorenzParams retorna los parámetros clásicos del atractor de Lorenz.
|
||||
func DefaultLorenzParams() LorenzParams {
|
||||
return LorenzParams{Sigma: 10.0, Rho: 28.0, Beta: 8.0 / 3.0}
|
||||
}
|
||||
|
||||
// LorenzStep calcula un paso del atractor de Lorenz usando integración de Euler.
|
||||
// dx/dt = sigma*(y-x), dy/dt = x*(rho-z)-y, dz/dt = x*y - beta*z
|
||||
func LorenzStep(s LorenzState, dt float64, p LorenzParams) LorenzState {
|
||||
dx := p.Sigma * (s.Y - s.X)
|
||||
dy := s.X*(p.Rho-s.Z) - s.Y
|
||||
dz := s.X*s.Y - p.Beta*s.Z
|
||||
|
||||
return LorenzState{
|
||||
X: s.X + dx*dt,
|
||||
Y: s.Y + dy*dt,
|
||||
Z: s.Z + dz*dt,
|
||||
}
|
||||
}
|
||||
|
||||
// LorenzSeries genera N pasos del atractor y retorna la serie completa.
|
||||
func LorenzSeries(initial LorenzState, dt float64, p LorenzParams, steps int) []LorenzState {
|
||||
series := make([]LorenzState, steps)
|
||||
state := initial
|
||||
for i := 0; i < steps; i++ {
|
||||
state = LorenzStep(state, dt, p)
|
||||
series[i] = state
|
||||
}
|
||||
return series
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: lorenz_step
|
||||
kind: function
|
||||
lang: go
|
||||
domain: datascience
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "LorenzStep(s LorenzState, dt float64, p LorenzParams) LorenzState"
|
||||
description: "Paso del atractor de Lorenz (sistema caótico determinista). Integración Euler con parámetros configurables. Incluye LorenzSeries para generar N pasos."
|
||||
tags: [lorenz, chaos, attractor, simulation, math, dynamical-systems]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/datascience/lorenz_step.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
p := DefaultLorenzParams()
|
||||
state := LorenzState{X: 1, Y: 1, Z: 1}
|
||||
|
||||
// Un paso
|
||||
next := LorenzStep(state, 0.005, p)
|
||||
|
||||
// Serie completa
|
||||
series := LorenzSeries(LorenzState{X: 1, Y: 1, Z: 1}, 0.005, p, 10000)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
El atractor de Lorenz es un sistema de ecuaciones diferenciales que produce comportamiento caótico determinista. Con los parámetros clásicos (sigma=10, rho=28, beta=8/3), el sistema converge al famoso "butterfly attractor". X oscila típicamente entre -20 y 20.
|
||||
Reference in New Issue
Block a user