Bookdown contest submission: Notes for advanced calculus

This resource is called calcul3 and you can access it via it's website or you can access the source code in Github.

Disclaimer :smile: This is a work in progress. I'm writing this book as I teach this course this semester. There are some sections that are not finished, there are errors and mistakes. Some of the plots are not working, and probably plenty of other things that I haven't seen yet.

The goal of calcul3 is to have teacher's notes that I can project on the white board for my students. When I teach this course, I want my students to have some of the notions already written to focus my time primarly of the explanation of the notions and on the exercises. The html output of these notes can be used in class to understand all the notions. The pdf output of these notes will be printed and given to the students at the start of the course. The text for the examples will be written but blank space will be added to let the students try these exercises or copy the solution given by the teacher.

Furthermore, I want to add GeoGebra app to the html output so that the teacher can use them in the classroom. But it can be very beneficial if the students can play with these applications to understand more fully the concepts of the course.

I want to leverage the power of plotly to produce surface plots that we can play with in the html version of this book. The majority of the time in this course is passed on notions of functions in 3 dimensions. It's important for the students to be able to see these notions instead of just learning them.

Finally, this book is written in french.

HTML

Exercices

In the html output of this book, there will be some new notion and just after that some exercices that we will do in class.

Geogebra

There will be multiples GeoGebra app that will come with this book. As this is a work in progress, these applications are inside the book. But maybe they will be moved on GeoGebra Tube and only some hyperlinks will link them to the book.

Figures with pstricks

Since I wrote for a long time in \LaTeX and I'm just starting to switch to RMarkdown and Bookdown, I'm still using pstricks to produce some of my figures and plots. For the moment, I'm using the standalone package to produce png output from my \LaTeX code. The code for these figures can be found in the GitHub repo. There is probably (certainly?) a better way to do this but for the moment it's serving me well.

figurepstricks

PLOTLY

Because we work in three dimensions constantly in this course, I want the student to be easily be able to play with three dimensional surfaces. You can see one example below and you can go the chapter on functions of several variables to play with these plots yourselves.

PDF

The most important aspect of the pdf output is to put some blank spaces afetr the exercises and examples to let the student try the problems. For the moment, my solution is to put the command \vspace*{_some length_} and hope for the best. I'm trying to focus most of my efforts on the rmarkdown source and not on the pdf output, just like Yihui Xie talked about. One of the reason that I'm now using bookdown is to forget about all the typesetting I was doing in \LaTeX. I was using SO much of my time in \LaTeX just tweaking tihings instead of just writing new content.

exercisespdf

GITHUB

I really love the idea of students being able to write a pull request if they find some error in my book. I wrote two mathematics books that have been published and it's a nightmare when someone finds misprints and errors. Now I will receive a pull request, I merge it, I compile the book and push it to GitHub and the new version is live. It's incredible!

Technical details

When I started this book, I tried to use as few new things as possible to concentrate on the content of the book. But here are the little things that I added to the template:

  • Use of the block2 engine to write examples.
  • Added a little (very little) bit of css to block2 engine
  • Use of the standalone package in \LaTeX for using the pstricks package
  • Use of the knitr:::is_html_output() command to plot the plotly graph in html and use the png produced by orca in pdf output.

Thanks for this great contest and good luck to all!

Marc-André Désautels

3 Likes

The course notes look great! I'm very glad that you have found bookdown helpful in teaching and writing. Two minor technical comments:

  1. For the pstricks figures, you can probably write a custom knitr engine that is similar to the tikz engine: https://github.com/yihui/knitr/blob/4cf7a6f1ef/R/engine.R#L275-L323 I don't really have much public documentation on knitr engines (the only detailed documentation is in the book "Dynamic Documents with R and knitr", Chapter 11), but the example 058 in the repo https://github.com/yihui/knitr-examples/ may give you an idea how to use the tikz engine. If you can figure it out, I'll be happy to accept a pull request to knitr on Github.

  2. For plotly graphics, knitr should be intelligent enough to generate static screenshots if the output format is not HTML: https://bookdown.org/yihui/bookdown/html-widgets.html but I haven't tested it myself. @cpsievert certainly knows more about it.

Thanks for sharing the notes as well as the technical details!

Thanks @yihui for your comments.

For the one about the pstricks engine in knitr, I don't know enough yet about all the aspects of programmation to try and build a new engine, even if this engine would be similar to the tikz one. Maybe some day. I started using R one year ago and each day there seems to be something else I can learn about it. The community around R is incredibly prolific and I can't seem to find the time to learn to program in R or even learn all that I want to learn!

For the comment about plotly graphics, it seems all the graphics that uses WebGL won't work with knitr because the package webshot doesn't support WebGL. You can read about it in https://github.com/ropensci/plotly/issues/889. That is why I decided to export my graphics with orca when I was using WebGL.

Thanks again for all that you brought to the R world. You are one of the person that convinced me to use R after reading your blog and looking at all your packages.

Good day.

1 Like

Oh, I see. I didn't realize WebGL was involved. There might still be a way to automate this, but I don't have time to investigate the possibility by myself.