PreTeXtBook / pretext

PreTeXt: an authoring and publishing system for scholarly documents
https://pretextbook.org
Other
266 stars 208 forks source link

Add algorithm tag #66

Closed kcrisman closed 9 years ago

kcrisman commented 9 years ago

Like fact, theorem, statement, etc. This is common enough in things like discrete math textbooks. (I didn't find it in the sample article, anyway.)

rbeezer commented 9 years ago

And what goes into it? Only a pseudo-code chunk? Or is more like an example where you might have some discussion in paragraphs and a program listing (already implemented) and some run-time analysis and ....?

On 03/14/2015 07:17 PM, kcrisman wrote:

Like fact, theorem, statement, etc. This is common enough in things like discrete math textbooks. (I didn't find it in the sample article, anyway.)

— Reply to this email directly or view it on GitHub https://github.com/rbeezer/mathbook/issues/66.

kcrisman commented 9 years ago

Well, it's like a theorem except it isn't a theorem, it's an algorithm. Could be pseudocode but maybe not. E.g. (though this was not the case I was thinking of)

  1. Initialize p=2
  2. Loop the following for each p < sqrt(n)
    1. Cross out all (remaining) multiples of p
    2. Set p = the next lowest uncrossed number
kcrisman commented 9 years ago

(I should point out that an algorithm may have a proof that it has a certain big-Oh or whatever, or that it does in fact provide the desired outcome, but it doest have to, it could just be a set of steps. The example connected to it would be a separate example tag, just like when one would give an example of a proposition or theorem or fact or definition. Basically, I just couldn't think of what else in the list of theorem-like tags this could be and didn't want to hack in some bold-face and numbering.)

kcrisman commented 9 years ago

(And I suppose there could be a program listing as part of it, though I myself would prefer to have that be a separate item which implements Algorithm 2.3.1.4.2.3.5b (or whatever).)

rbeezer commented 9 years ago

I see. So in your example algorithm there could be a claim that the list only has primes left at the conclusion. That claim might then have a proof immediately following.

Should be very easy to add it to the list of theorem, corollary, lemma, fact, etc. I'm going to let it percolate for a bit, but should be able to add it this week.

Thanks for the suggestion and for not hacking up something. ;-)

Rob

On 03/14/2015 08:28 PM, kcrisman wrote:

(I should point out that an algorithm may have a proof that it has a certain big-Oh or whatever, or that it does in fact provide the desired outcome, but it doest have to, it could just be a set of steps. The example connected to it would be a separate example tag, just like when one would give an example of a proposition or theorem or fact or definition. Basically, I just couldn't think of what else in the list of theorem-like tags this could be and didn't want to hack in some bold-face and numbering.)

— Reply to this email directly or view it on GitHub https://github.com/rbeezer/mathbook/issues/66#issuecomment-80820603.

davidfarmer commented 9 years ago

There are LaTeX packages for marking up algorithms, and they are not just theorems with "Theorem" replaced by "Algorithm". Some support markup of fairly elaborate pseudocode.

Not sure how much of that you want to support.

On Sat, 14 Mar 2015, Rob Beezer wrote:

I see. So in your example algorithm there could be a claim that the list only has primes left at the conclusion. That claim might then have a proof immediately following.

Should be very easy to add it to the list of theorem, corollary, lemma, fact, etc. I'm going to let it percolate for a bit, but should be able to add it this week.

Thanks for the suggestion and for not hacking up something. ;-)

Rob

On 03/14/2015 08:28 PM, kcrisman wrote:

(I should point out that an algorithm may have a proof that it has a certain big-Oh or whatever, or that it does in fact provide the desired outcome, but it doest have to, it could just be a set of steps. The example connected to it would be a separate example tag, just like when one would give an example of a proposition or theorem or fact or definition. Basically, I just couldn't think of what else in the list of theorem-like tags this could be and didn't want to hack in some bold-face and numbering.)

— Reply to this email directly or view it on GitHub https://github.com/rbeezer/mathbook/issues/66#issuecomment-80820603.

— Reply to this email directly or view it on GitHub.[AAM6LCjw0I_KECQ0y0Emf-BHGixAR-K-ks5n1PyjgaJpZM4Du27s.gif]

rbeezer commented 9 years ago

Right. I spent a long time once trying to figure this out. The LaTeX descriptions render very nicely, but then how do you make them into HTML? Unless I'm missing some third-party extension, I don't see that MathJax provides the usual help. The syntax for the stats language "R" uses a backwards-arrow for assignment (iirc) so that can be a poor-man's standin with the Google "prettify" tool already built-in.

I think an "algorithm" still can be useful now, and then down the road better quality stuff can go inside it. I've made an issue so that somebody might see it as a useful project to add, along with a few similar but distinct comments.

https://github.com/rbeezer/mathbook/issues/68

On 03/15/2015 06:48 AM, davidfarmer wrote:

There are LaTeX packages for marking up algorithms, and they are not just theorems with "Theorem" replaced by "Algorithm". Some support markup of fairly elaborate pseudocode.

Not sure how much of that you want to support.

On Sat, 14 Mar 2015, Rob Beezer wrote:

I see. So in your example algorithm there could be a claim that the list only has primes left at the conclusion. That claim might then have a proof immediately following.

Should be very easy to add it to the list of theorem, corollary, lemma, fact, etc. I'm going to let it percolate for a bit, but should be able to add it this week.

Thanks for the suggestion and for not hacking up something. ;-)

Rob

On 03/14/2015 08:28 PM, kcrisman wrote:

(I should point out that an algorithm may have a proof that it has a certain big-Oh or whatever, or that it does in fact provide the desired outcome, but it doest have to, it could just be a set of steps. The example connected to it would be a separate example tag, just like when one would give an example of a proposition or theorem or fact or definition. Basically, I just couldn't think of what else in the list of theorem-like tags this could be and didn't want to hack in some bold-face and numbering.)

— Reply to this email directly or view it on GitHub https://github.com/rbeezer/mathbook/issues/66#issuecomment-80820603.

— Reply to this email directly or view it on GitHub.[AAM6LCjw0I_KECQ0y0Emf-BHGixAR-K-ks5n1PyjgaJpZM4Du27s.gif]

— Reply to this email directly or view it on GitHub https://github.com/rbeezer/mathbook/issues/66#issuecomment-81014275.

rbeezer commented 9 years ago

Done. 629f0100 efe8f465

Thanks, KDC. Announcement at

https://groups.google.com/forum/#!topic/mathbook-xml-support/2D6Gne1XS-E

kcrisman commented 9 years ago

Wow. Thank you open source!

kcrisman commented 9 years ago

I think you mean https://github.com/rbeezer/mathbook/commit/eb8b0d2051d0dde2e73ab533e07b51f071fe4096 and https://github.com/rbeezer/mathbook/commit/456e17c1d6c275a164da9de63bf0e8d0a6376193