Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting - missing multiplication #30

Open
soegaard opened this issue May 19, 2024 · 2 comments
Open

Formatting - missing multiplication #30

soegaard opened this issue May 19, 2024 · 2 comments

Comments

@soegaard
Copy link
Owner

image image
@soegaard
Copy link
Owner Author

(define (tree-replace t x y)
  ; replace all occurences of x with y in the tree t
  (def (tr t) (tree-replace t x y))
  (cond
    [(equal? t x) y]
    [(list? t)    (map tr t)]
    [else         t]))

(let ([a -4] [b -1] [c 5] [d -9] [x 'x] [y 'y])
                  (tex (tree-replace (tree-replace `(+ (* ,a (sqr ,x)) (* ,b (sqr ,y)) (* ,c x y) (* ,d x))
                                                 'x 2)
                                    'y 5)))
                                                                        
> (let ([a -4] [b -1] [c 5] [d -9] [x 'x] [y 'y])
                  (tex (tree-replace (tree-replace `(+ (* ,a (sqr ,x)) (* ,b (sqr ,y)) (* ,c x y) (* ,d x))
                                                 'x 2)
                                    'y 5)))
"$-42^{2}-5^{2}+5\\cdot 2\\cdot 5-9\\cdot 2$"

@soegaard
Copy link
Owner Author

Problemet løst ved at erstatte (sqr x) med (expt x 2).

@soegaard soegaard reopened this May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant