ProjectMOSAIC / mosaicCalc

Calculus in R
12 stars 4 forks source link

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

Open dtkaplan opened 3 years ago

dtkaplan commented 3 years ago

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 commented 3 years ago

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

dtkaplan commented 3 years ago

Yes, absolutely. I'd love to talk about this and some of the things going on in the mosaicCalc world. Any time.

On Fri, May 28, 2021 at 10:36 AM Nicholas Horton @.***> wrote:

@dtkaplan https://github.com/dtkaplan would it be useful to find a time to talk about this and any other related mosaic package suite issues?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ProjectMOSAIC/mosaicCalc/issues/9#issuecomment-850503006, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAECBLNMA7PMGOLUBL7IA43TP6Z6JANCNFSM437RURKA .

rpruim commented 3 years ago

Can we find a time next week?

nicholasjhorton commented 3 years ago

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 commented 2 years ago

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().