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

def= or equivalent. Way to define an equation for use and display #75

Open
light-matters opened this issue Jul 17, 2024 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@light-matters
Copy link
Contributor

light-matters commented Jul 17, 2024

The idea is to make something like

(def= F (w/* 'm 'a))
(wl/eval (Something... F ...))

possible, where def= would act like Clojure's (def ...) and yet automatically assign a Wolfram equation (w/== 'F (w/* m a)) to the symbol F. Ideally, this would also store 'kind' data such that it could automatically be visualised by literate programming tools like clay.

@light-matters light-matters added the enhancement New feature or request label Jul 17, 2024
@holyjak
Copy link
Member

holyjak commented Jul 22, 2024

Excuse my clueless questions :) but what is a Wolf equation used for, and why would we want to assign it to a symbol? How/why is this useful?

@light-matters
Copy link
Contributor Author

light-matters commented Jul 23, 2024

So a Wolfram equation is just Wolfram's way of writing mathematical equations. In Wolfram, I would write c^2 == a^2 + b^2 (if I was a friend of Pythagoras).

It's about user convenience. If I wanted to find 'a' then I would copy it across to a Solve function, i.e. Solve[c^2 == a^2 + b^2, a]. If I want to use it in many places then I would have to give the equation a name, e.g. ptheorem=c^2 == a^2 + b^2 and then use that: Solve[ptheorem, a]. In this case, there isn't really a problem but when you're working with lots of equations and different steps through them then having to name them individually becomes a bit of an anti-pattern.

It's also the case that there are different ways of representing such things. The solution above is given as a -> Sqrt[-b^2 + c^2], but you could equally write an actual equation, i.e. a== Sqrt[-b^2 + c^2]. You can see this in the cavity-physics ns where I have the symbol 'E4 and the expression E4 and at some point an equation, which is simply (w/== 'E4 E4).

It seems like it would be more efficient to have a single definition of an equation that covers all of these bases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants