DEV Community

Ryan Frazier
Ryan Frazier

Posted on • Originally published at pianomanfrazier.com on

Create Beautiful Math Homework

Throughout my Computer Science degree I have been doing a lot my homework in Latex. It has a steep learning curve but the results are amazing.

For my technical writing class I convinced my group to use Latex instead of Word or Google Docs. In hindsight this created a lot of extra work for me but I learned a lot about customizing a Latex document.

See here for the Latex template I generated.

The things I really liked about this setup was the ability to modularize the document and assign different team members a section. We then collaborated on the document using https://www.overleaf.com. Overleaf has git integration so I could edit the document on my laptop and push the changes back up to overleaf. The downside to this was that my other team members were not programmers and did not know how to use git and had to use the web interface for editing. Generating and managing the bibliography was also very easy using Bibliotex.

For my personal homework I wrote a bash script that reads a config file for the class I am in that has data like the teacher, semester, class name and so forth and generates a new Latex project with a makefile. I have been using this system for 2 semesters and it has been working great. See homework-generator.

For my probability class this semester I also wanted to produce graphs and charts. I have been using the python libraries matplotlib and seaborn to create awesome graphs. My homework often looks better than my textbook (imho).

Here are some highlights of the graphs I did for my homework. The visualizations helped me see what was going on with the math.

Poisson distribution
Poisson Distribution where $$ \lambda = 10 $$ [download poisson.py]

Lognormal Distribution
Lognormal Distribution $$ f(x) = \frac{1}{\sigma x \sqrt{2 \pi}} e^{- (\ln x - \mu)^2 / 2 \sigma^2 }$$ [download lognorm.py]

Using moviepy we can create a nice video of this graph where (\sigma) varies over time.[download lognorm_video.py]

Normal Distribution
Normal Distribution of the Velocity of a Particle $$ f(x) = 2 \frac{mv}{\sigma \sqrt{2 \pi}} e^{- ( \frac{1}{2} mv^2 - \mu)^2 / 2 \sigma ^2} $$ [download velocity.py]

Bivariate
Plot of a Bivariate Distribution $$f_{XY}(x,y) = x e^{-x(y+1)}$$ [download bivariate.py]

And just for fun let's plot a torus and make a video out of it. [download torus.py]

Top comments (2)

Collapse
 
ursbucher profile image
Urs Bucher • Edited

I have never thought about it this way. I mean that math homework can look beautiful or ugly. I know a couple of other apps like ChartGo for stats graphs or PhotoMath for calculus tasks. Last week I used the tool (developed for Stanford Center on Poverty and Inequality) where you may select a date range and a statistic type for a custom stats report.

How to select a statistic type from variants and a date range to do my statistics homework

Collapse
 
alencarbarros profile image
Anderson de Alencar

Thanks for share! That's really useful.