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

Use . (dot) as an option in makeFun() #9

Open
dtkaplan opened this issue May 2, 2021 · 5 comments
Open

Use . (dot) as an option in makeFun() #9

dtkaplan opened this issue May 2, 2021 · 5 comments

Comments

@dtkaplan
Copy link
Contributor

dtkaplan commented May 2, 2021

Things are still a bit of a mess with the order of arguments created by makeFun(), D(), and antiD(). For instance, makeFun() will use the symbols to the right of tilde as the arguments to the function created, in the order specified. But parameters might come in any order, depending on how the tilde expression is composed. D() will insert its "with respect to" argument in the first argument position, which means that D(x*y^2 ~x) and D(x*y^2~y) will have the arguments in different orders.

I'm not entirely sure how to handle this in D(). Perhaps encourage a style where one writes f <- makeFun(x*y^2 ~ x + y) and then D(f(x,y) ~ y). [[Right now, this is awkward, because D() doesn't know to look inside a non-standard function such as f() for a symbolic formula. Instead, it applies numerical differentiation. Good to fix that.]] What's in the brackets is now fixed as of the conversion to Deriv::Deriv() for the symbolic derivatives.

But I'm thinking it might be nice to have an option in makeFun() that lets you write makeFun(x*y^2 ~ .) or similar, so that makeFun() knows to choose a canonical ordering of the arguments.

@nicholasjhorton
Copy link
Contributor

@dtkaplan would it be useful to find a time to talk about this and any other related mosaic package suite issues?

@dtkaplan
Copy link
Contributor Author

dtkaplan commented May 28, 2021 via email

@rpruim
Copy link
Contributor

rpruim commented Jun 10, 2021

Can we find a time next week?

@nicholasjhorton
Copy link
Contributor

I'm teaching a workshop next week as part of the DSC-WAV project, so I can't meet next week.

That being said, I wonder if the two of you might start a discussion since I've not been as directly involved.

@dtkaplan
Copy link
Contributor Author

dtkaplan commented Apr 1, 2022

Perhaps just add a canonical_order(f) which will re-arrange arguments according to (x, y, z, u, v, w, n, p, then alphabetical). Just use this in D().

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

3 participants