TransWikia.com

Using LaTeX to solve math problems in LaTeX more efficiently than with only paper

TeX - LaTeX Asked on April 15, 2021

I have been always solving math problems in LaTeX without pen and paper, since a few years ago. Some have (many) lines of words, some (many) lines of equations, and some of both.

When I saw that I was sometimes running into time problems, and feel not so straightforward for reasoning from the LaTeX code, and worry about the time waste in switching between LaTeX code, recompiling, and viewing pdf files, I began to wonder if doing things completely in LaTeX slows me down. But I remember that when I was doing things completely in paper, I hoped that I could “copy” and “paste” like I did in computer.

I’m looking for ways to improve my productivity for reasoning and working out math problems:

  • in pen and paper,
  • in LaTeX,
  • in some combination of both…

When solving math problems in LaTeX without pen and paper, what are your tips which can improve our productivity?

6 Answers

I am pretty sure the answer to the question in the title—Is solving math problems in LaTeX without paper slower than in paper?—is yes. I work with a computer keyboard in front of me and a pen and pad to my left (yes, I'm left-handed), and when I'm typing up solutions to problems I usually leave the keyboard to scratch on the pad for a while, then go back to the keyboard to LaTeX it up. I can think of some reasons why this might be more true:

  • I can think faster than I can type.
  • Although in English I type much faster than I write, when writing math I write much faster than I can type LaTeX.
  • I can draw pictures by hand much much faster than drawing them in LaTeX.

I admit that this is a totally subjective answer, but I don't know of any colleagues who work first in LaTeX without scribbling on paper or a black/whiteboard first.

As far as tips to be more productive when writing LaTeX, I would suggest to follow good coding practices. AFAIK there are not that many settled conventions on code organization, but some general practices I follow are:

  • Start each sentence on a new line.

  • Indent code within environment blocks.

  • Use braces to enclose groups even if they are only one token. I break this rule in super/subscripts, but adhere to it closely in frac-tions.

  • Use the cool package to make many math expression more like macros.

So for instance (not my best example but one that's at hand),

Let $E$ be the solid.
Its volume is $frac{1}{8} frac{4}{3}pi = frac{pi}{6}$.
In spherical coordinates it is a wedge $0 leq rholeq 1$, $0 leq theta leq pi/2$, $0 leq phileq pi/2$.
So the moments are 
begin{align*}
    M_{yz} = iiint_E x,dV &= int_0^{pi/2}int_0^{pi/2} int_0^1 (rho Sin{phi}Cos{theta})rho^2Sin{phi},drho,dphi,dtheta 
          &= int_0^{pi/2} Cos{theta} ,dthetacdotint_0^{pi/2} Sin{phi}^2 ,dphicdotint_0^{1} rho^3,drho 
          &= 1 cdot frac{pi}{4} cdot frac{1}{4} = frac{pi}{16} 
    M_{yz} = iiint_E y,dV 
        &= int_0^{pi/2}int_0^{pi/2} int_0^1 (rho Sin{phi}Sin{theta})rho^2Sin{phi},drho,dphi,dtheta  
        &= int_0^{pi/2} Sin{theta} ,dthetacdotint_0^{pi/2} Sin{phi}^2,dphi cdot int_0^1 rho^3 ,drho 
        &= 1 cdot frac{pi}{4} cdot frac{1}{4} = frac{pi}{16} 
    M_{xy} = iiint_E z,dV 
        &= int_0^{pi/2}int_0^{pi/2} int_0^1 (rho Cos{phi})rho^2Sin{phi},drho,dphi,dtheta 
        &= int_0^{pi/2} dthetacdot int_0^{pi/2} Sin{phi}Cos{phi},dphi cdot int_0^1 rho^3 ,drho 
        &= frac{pi}{2} cdot frac{1}{2} cdot frac{1}{4} = frac{pi}{16}
end{align*}
So the coordinates of the centroid are
$left(frac{3}{8},frac{3}{8},frac{3}{8}right)$

Even for this one I did work it out on paper first.

Answered by Matthew Leingang on April 15, 2021

For computaions, I use mainly Wolfram Mathematica and LaTeX. For writing LaTeX source file I developed many macros in my favorite editor WinEdt. For example, typing [ immediately transforms the input into

begin{gather*}
 *
end{gather*}

and _ is automatically transformed into _{} with the cursor placed between the braces. Nothing to say that al yields alpha, etc. This greatly increases the production speed.

Answered by Igor Kotelnikov on April 15, 2021

Regarding time waste in switching between LaTeX code, recompiling, and viewing pdf files, there are LaTeX editors with an itegrated viewer, background compilation, and even with live preview for formulas, e.g. TeXstudio.

You'll probably have to try a few tools to find the one that suits you best. Here's a list of IDEs and their features.

Answered by user24582 on April 15, 2021

I use Scientific word for Latex, since it saves me so much time. The magic secret about it, is that it not only generates Latex from easy to use GUI, (similar to Lyx, but I find it easier, I tried Lyx also).

But it also have an integrated complete computer algebra system (mupad) build into it. I have been using it for many years, and now I do many thing directly on the screen and have little need to use paper.

It is much better than paper, since I can clearly see all the equations, copy/paste parts and pieces much easier than on paper, and not have to worry I made a mistake as I do by hand when I copy part of an equation to next page or next line. I can also compute basic things all in the worksheet, and it is all latex at the end.

Which would be easier, to jump to a calculator, enter the numbers from the paper, making a mistake ofcourse, copy the answer from the calculator back to the paper dropping few digits in the process, or just point and click and have everything come out automatically on the screen in math mode where you want it, knowing it is correct?

Here are some examples:

Find determinant of matrix on the fly and have the result in the document

Mathematica graphics

Want the solution to 3rd order polynomial

Mathematica graphics

compile to pdf

Mathematica graphics

If I have to do this by hand, on paper, it will take me 4 hrs just to type the latex itself. It took me 1 minutes with Scientific word.

ps. I use SW just for writing the documents, but use TexLive and Tex4ht to compile to pdf and to HTML.

Answered by Nasser on April 15, 2021

If you can compose your latex-math quickly enough it gives you additional flexibility and productivity when you attempt to solve problems directly in latex. Given such speed, it can then be faster to work in latex than on paper, since long sequences can be cut and pasted, allowing next steps to be made with editing tweaks. I've worked though some tricky math this way that I probably wouldn't have tried on paper since it would have taken too long to keep writing out the long equations (all differing by just a bit).

With that in mind, here are some methods that I find improve my latex development productivity, facilitating work directly in latex when appropriate:

  • Using pdflatex -synctex=1, and a pdf viewer that supports this like Sumatra PDF. That allows you to double click on text or equations in the pdf file, and immediately be editing the associated .tex files at the position of interest. If you work on Windows, Sumatra is also nicer than Adobe Reader because it doesn't apply a windows lock to the file, and will automatically reload the pdf if it is changed by running 'make' in the background.

  • If there are math sequences that you find yourself typing again and again, make a macro for it. Some examples:

    newcommand{inv}[1]{frac{1}{#1}}
    
    newcommand{abs}[1]{lvert{#1}rvert}
    
    newcommand{norm}[1]{lVert{#1}rVert}
    
    newcommand{lr}[1]{left(#1right)}
    
    newcommand{Bx}[0]{mathbf{x}}
    
  • Keep a cheatsheet of common latex patterns that you use. I use mine to quickly grab sequences that I often use. Using vim, I can run commands like the following (usually in my command history, retrieved quickly)

    :r!grep equation} latexCheatSheet.tex
    
    :r!grep bmatrix} latexCheatSheet.tex
    
    :r!grep aligned} latexCheatSheet.tex
    
  • Use scripting to auto-number labels.

  • If there are patterns that you find yourself typing, but don't feel that you want a permanent newcommand for, use some temporary search and replace patterns, allowing you to type things more quickly, then run a script to convert stuff to actual latex. I find that perl -pi, fed with whatever ad-hoc regex list is appropriate at the time, works really well.

  • Use a version control system, like git, to manage your sources. This is especially important if you use scripting tricks to alter your sources, so that you can return to previous versions if things screw up.

  • Use begin{dmath} ... end{dmath} from the breqn package to leave formatting of long multi-part equations to latex, instead of screwing around with aligned, & and markers. This helps lets you spend your time producing content and not wasting time trying to get formatting right.

  • Learn and use regular expressions and an editor (and/or tools like perl) that supports them. Your head will hurt at first, but your editing productivity can be orders of magnitude better.

These methods work well enough that I can now usually write my class notes, which are heavy on mathematics, in latex in real time.

Answered by Peeter Joot on April 15, 2021

I prefer to work straight in latex for algebra and equation manipulation, but on paper for problems with more geometry and drawing.

In my opinion one of the biggest benefits of LaTeX is the ability to use really advanced text editing tools. I use Sublime Text 2 with LaTeXTools, which gives me most basic vim commands (just tapping yyp will duplicate the line, so I write out every step which helps catch errors)

Using LaTeXTools adds a whole layer on top of the multi cursors, autocomplete, vi, and other awesome tools in Sublime, with completions that really speed things up. for example, to type:

begin{align*}
    frac{4}{5} = x
    frac{9}{5} = x
end{align*}

My keystrokes would be

bal <tab> <tab> fra <tab> 4 <tab> 5 <tab> = x <esc> yyp/4r9

It looks complex, but that's 25 keystrokes to make 65 characters across 4 lines, with proper indentation, and the efficiencies only get larger with larger equations.

It also helps with writing, long words like Supercalifragilisticexpialidocious would just be superc <tab> and it would fill in the rest for me as long as I have already typed it somewhere in the document.

It also gives me cmd b to compile and show the document in Skim.

Answered by Ryan on April 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP