bob-carpenter / ad-handbook

Automatic Differentiation Handbook
Other
144 stars 18 forks source link

Add basic arithmetic functions #5

Closed adamhaber closed 4 years ago

adamhaber commented 4 years ago

Very basic stuff. Decided to submit an "early" PR (with relatively few added functions) just to make sure I'm doing this alright...

adamhaber commented 4 years ago

Thanks for the comments, should look better now. 2 followup styling questions:

bob-carpenter commented 4 years ago

I haven't thought through a lot of this.

I like the \cdot pretty much everywhere, but I realize that's quirky. I think it just sets the terms off more neatly when you don't know the material.

I think += would probably be easier to understand everywhere.

On Feb 15, 2020, at 6:05 AM, Adam Haber notifications@github.com wrote:

Thanks for the comments, should look better now. 2 followup styling questions:

• Any convention regarding when \cdot is necessary and when it is not? • Do you prefer += for adjoint also when adding a negative term (like in cos)? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

adamhaber commented 4 years ago

Maybe it would make sense to put \cdot everywhere, except scalar-symbol multiplications (2a is kosher but ca is not)?

Also, do you have any preferred ordering of the functions? I tried to follow simple heuristics ("simple functions" first, all the arc-Xs after all the Xs, hyperbolic after trigonometric, etc) but perhaps there's a better way (alphabetically, consistent with some reference etc).

bob-carpenter commented 4 years ago

On Feb 16, 2020, at 1:28 AM, Adam Haber notifications@github.com wrote:

Maybe it would make sense to put \cdot everywhere, except scalar-symbol multiplications (2a is kosher but ca is not)?

That sounds like a good operating principle. I can start a style guide!

Also, do you have any preferred ordering of the functions? I tried to follow simple heuristics ("simple functions" first, all the arc-Xs after all the Xs, hyperbolic after trigonometric, etc) but perhaps there's a better way (alphabetically, consistent with some reference etc).

I like them grouped by type. I tried to do that when I set up the organization of the Stan function reference.

Let me know when this is ready to review for merge.

adamhaber commented 4 years ago

Re style - I've made sure \cdot is as discussed. I've also tried to put \overline{c} and \dot{a} as the leftmost terms in all expressions. Just for the sake of consistency, not very important imo.

I think this can be reviewed, I'll try to add some basic matrix results next.