(setq Dst2 (/ Dist 2)
Dst1 (* 0.1 Dist)
S (* 0.8 Dist)
SS (* S S)
SS2 (/ SS 2)
SS4 (/ SS 4)
S42 (- SS4 SS2)
X1 (* idx step)
X (- (* idx step) Dst1)
XX (* X X)
Lc (- *L* *c*)
Lc1 (* Lc 0.1)
LcD (* Lc1 Dist)
a1 (/ LcD Dst2)
ys1 (- *L* a1)
yc (- *c* ys1)
A (/ yc S42)
AS (* A S)
B (- AS)
XXA (* A XX)
XB (* B X)
XAB (+ XXA XB)
y (+ XAB ys1)
yt (rtos (round y 5) 2 0)
)
(setq X (- (* idx step) (* 0.1 Dist))
A (/ (- *c* (- *L* (/ (* (* (- *L* *c*) 0.1) Dist) (/ Dist 2))))
(- (/ (* (* 0.8 Dist) (* 0.8 Dist)) 4) (/ (* (* 0.8 Dist) (* 0.8 Dist)) 2)))
B (- (* A (* 0.8 Dist)))
XB (* B X)
yt (rtos (round (+ (+ (* A (* X X)) (* B X)) (- *L* (/ (* (* (- *L* *c*) 0.1) Dist) (/ Dist 2)))) 5) 2 0)
)
Untested, but I think the whole thing could be simplified to:I was not asking about simplifying the equation, but I found your way is very good and I'll replace mine with yours when test and get the same results.Code - Auto/Visual Lisp: [Select]
(setq X (- (* idx step) (* 0.1 Dist))
C (- *L* (* (- *L* *c*) 0.2))
A (/ (- *c* C) (* -0.16 Dist Dist))
yt (rtos (round (+ (* A X X) (* -0.8 A X Dist) C) 5) 2 0)
)
Eq2(setq yt (rtos (round (+ (* (/ (- *c* (- *L* (* (- *L* *c*) 0.2))) (* -0.16 Dist Dist))
(- (* idx step) (* 0.1 Dist)) (- (* idx step) (* 0.1 Dist)))
(* -0.8 A (- (* idx step) (* 0.1 Dist)) Dist) (- *L* (* (- *L* *c*) 0.2)))
5) 2 0)
)
There's no right answer.Thanks irneb I got it
...
(setq yt (rtos (round (+ (+ (* (/ (- *c* (- *L* (/ (* (* (- *L* *c*) 0.1) Dist) (/ Dist 2)))) (- (/ (* (* 0.8 Dist) (* 0.8 Dist)) 4) (/ (* (* 0.8 Dist) (* 0.8 Dist)) 2))) (* (- (* idx step) (* 0.1 Dist)) (- (* idx step) (* 0.1 Dist)))) (* (- (* (/ (- *c* (- *L* (/ (* (* (- *L* *c*) 0.1) Dist) (/ Dist 2)))) (- (/ (* (* 0.8 Dist) (* 0.8 Dist)) 4) (/ (* (* 0.8 Dist) (* 0.8 Dist)) 2))) (* 0.8 Dist))) (- (* idx step) (* 0.1 Dist)))) (- *L* (/ (* (* (- *L* *c*) 0.1) Dist) (/ Dist 2)))) 5) 2 0)
WHat :evil: you areCode: [Select](setq yt ...)
This is clearly the right answer! :lmao:
(defun foo ()
(setq a 10)
)
(defun bar ()
(princ a)
)
(defun foo ()
(setq a 10)
)
(defun bar ()
(princ a)
)
(defun test()
(setq a 42)
(foo)
(bar)
)
This seems to be a quite lengthly equation. Why not create a function for the equation?I did. This is the code (http://www.theswamp.org/index.php?topic=41670.msg470766#msg470766)