# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import numpy as np
import scipy as sp

dU = 2
dX = 12
acc = gains = np.ones(dU)
dt = 0.02

    Fd = np.vstack([
        np.hstack([
            np.eye(dU), dt * np.eye(dU), np.zeros((dU, dX - dU*2)),
            dt ** 2 * np.diag(gains)
        ]),
        np.hstack([
            np.zeros((dU, dU)), np.eye(dU), np.zeros((dU, dX - dU*2)),
            dt * np.diag(gains)
        ]),
        np.zeros((dX - dU*2, dX+dU))
    ])
    fc = np.hstack([acc * dt ** 2, acc * dt, np.zeros((dX - dU*2))])

Fd.shape

np.hstack([
    np.eye(dU), dt * np.eye(dU), np.zeros((dU, dX - dU*2)),
    dt ** 2 * np.diag(gains)
])

(dt ** 2 * np.diag(gains)).shape

np.zeros((dU, dX - dU*2)).shape

np.hstack([
    np.zeros((dU, dU)), np.eye(dU), np.zeros((dU, dX - dU*2)),
    dt * np.diag(gains)
])

np.diag(np.eye(5,5))

    Ltt = np.diag(np.hstack([
        1 * np.ones(dU),
        1 * 2 * np.ones(dU),
        np.zeros(dX - dU*2), np.ones(dU)
    ]))

Ltt.shape

np.hstack([
        1 * np.ones(dU),
        1 * 2 * np.ones(dU),
        np.zeros(dX - dU*2), np.ones(dU)
    ])

x0 = np.ones(12)

lt = -Ltt.dot(np.r_[x0, np.zeros(dU)])

lt.shape

import scipy.linalg as linalg





StarcoderdataJupyterScriptsDedupFiltered