(defn tfassoc [x idxs func]
(if (empty? idxs)
(func x)
- (assoc x
+ (assoc (vec x)
(inc (first idxs))
(tfassoc (nth x (inc (first idxs)))
(rest idxs)
; A = (d2 d2 L)^(-1) (d1 L - d0 d2 L - (d1 d2 L)I2)
(defn L->accer [L]
(fn [x] ; x -> [up t q qdot]
- (println x)
- (println (partial-val L [] x))
- (t* (tinv (partial-val L [2 2] x))
+ (t* (tinv (partial-val (fn [x] (partial-val L [2] x))
+ [2] x))
(t- (partial-val L [1] x)
- (partial-val L [2 0] x)
- (t* (partial-val L [2 1] x)
+ (partial-val (fn [x] (partial-val L [2] x))
+ [0] x)
+ (t* (partial-val (fn [x] (partial-val L [2] x))
+ [1] x)
(nth x 3)
)))))
(def *h* 0.02)
(defn next-iter [phys xis]
- (println phys)
- (println xis)
(let [jaco (partial-val phys [] xis)
- _ (println jaco)
lhs (m-m (i-mat (dec (count xis)))
(s*m *h*
(vec (apply map vector ; transpose