On this question: How do I use substitution in integrals? there are examples of what I want. I just want to show integrals on my questions like that. How can I do it?
-
2$\begingroup$ Are you asking for a tutorial on writing equations so they display correctly? See here, and here. $\endgroup$– Arturo MagidinCommented Jun 24, 2012 at 1:46
-
$\begingroup$ Click on "edit" on that (or any other) page and you'll see how it was done. $\endgroup$– Gerry MyersonCommented Jun 24, 2012 at 4:54
-
1$\begingroup$ @GerryMyerson: He may not be able to edit (low rep). But right-clicking on an equation (at least on Firefox) will open a dialogue window that should allow him to see the MathJax code displayyed. $\endgroup$– Arturo MagidinCommented Jun 24, 2012 at 5:23
-
3$\begingroup$ @Arturo: Low-rep users can suggest edits, therefore can edit. In fact, anonymous users can suggest edits, so surely a user with 108 points of reputation can... $\endgroup$– Asaf Karagila ModCommented Jun 24, 2012 at 5:46
-
10$\begingroup$ @Asaf: All these "new-fangled" things. When I was a low-rep user, the edit button did not even appear. And we had to post during snowstorms, up-hill, both ways! $\endgroup$– Arturo MagidinCommented Jun 24, 2012 at 5:47
-
$\begingroup$ There's a workaround explained in this answer - every user can view the source. Another possibility would be to view the source of the page you're viewing (Ctrl+U in Firefox), but it's more difficult to find it there and you can see only mathjax syntax there, not markdown. $\endgroup$– Martin SleziakCommented Jun 24, 2012 at 7:34
1 Answer
For basics about MathJax, which is used at this site to typeset math, see editing help or this question.
Specifically for integrals:
You can get integral like this:
$$\int x^2 \, dx = \frac{x^3}3 +C$$
$$\int x^2 \, dx = \frac{x^3}3 +C$$
Notice \,
in front of dx - this adds a small space between them, so it looks better.
You can write multiple integrals like this:
$$\iint r(\cos\varphi+\sin\varphi)\,d\varphi\,dr$$
$$\iint r(\cos\varphi+\sin\varphi)\, d\varphi\, dr$$
Writing \iint
gives you better spacing than just \int\int
. For triple integrals:
$$\iiint 1 \,dx \,dy \,dz$$
$$\iiint 1 \,dx \,dy \,dz.$$
If you want definite integrals, you can add bounds like this:
$$\int_0^1 x^2 \,dx= \frac13$$
$$\int_0^1 \int_0^{2\pi} r \,d\varphi\,dr$$
$$\iint_{x^2+y^2\le 1} x+y \,dx\,dy$$
$$\int_0^1 x^2 \,dx= \frac13\\
\int_0^1 \int_0^{2\pi} r \,d\varphi\,dr\\
\iint_{x^2+y^2\le 1} x+y \,dx\,dy$$
Notice that if the subscript or superscript has more than one symbol, you have to enclose it in {}
, e.g. $\int_{-\pi}^\pi$
or $\int_0^{2\pi}$
.
(Or course, you can use curly brackets even if there is only one symbol, e.g. $\int_{0}^{1}$
works fine; but they are not necessary.) Here is what these examples look like: $\int_{-\pi}^\pi$; $\int_0^{2\pi}$ and $\int_{0}^{1}$.
Another useful thing - if you are using substitution or per partes you might want to indicate what you are doing, e.g. like this:
$$\int \cos x \sin x \,dx = \left| \begin{array}{c} u=\sin x \\ du=\cos x\,dx \end{array} \right| =\int u \,du$$
$$\int \cos x \sin x \,dx = \left| \begin{array}{c} u=\sin x \\ du=\cos x\,dx \end{array} \right| =\int u \,du$$
$$\int x\cos x\, dx = \left| \begin{array}{cc} u=x & v'=\cos x \\ u'=1 & v=\sin x \end{array} \right| = x\sin x - \int \sin x \,dx$$
$$\int x\cos x\, dx = \left| \begin{array}{cc} u=x & v'=\cos x \\ u'=1 & v=\sin x \end{array} \right| = x\sin x - \int \sin x \,dx$$
Integrals are rendered slightly differently in centered formulas (marked by pairs of dollars) and inline mode, compare this:
$$\int_a^b f(x) \,dx,$$ $\int_a^b f(x) \,dx$ and $\int\limits_a^b f(x)\,dx$.
$$\int_a^b f(x) \,dx,$$ $\int_a^b f(x) \,dx$ and $\int\limits_a^b f(x)\,dx$.
-
3$\begingroup$ For double integrals,
\iint
rather than\int\int
produces two integral signs with the proper amount of space between them. $\endgroup$– DidCommented Jun 24, 2012 at 10:57 -
$\begingroup$ I did not know that. But if I want $\int_0^1 \int_0^1$, I use
\int
twice, right? I made the post CW, feel free to edit it. $\endgroup$ Commented Jun 24, 2012 at 10:59 -
$\begingroup$ Yes,
\int
twice, or\iint_{}
with the domain of integration in the subscript, which can be an awkward alternative or not, depending on the domain. $\endgroup$– DidCommented Jun 24, 2012 at 11:02 -
$\begingroup$ @did I've added some example into the post. I hope it's approximately like what you meant. $\endgroup$ Commented Jun 24, 2012 at 11:22
-
1$\begingroup$ For completeness, let me note that the triple integral symbol $\displaystyle \iiint$ is also defined:
\iiint
. We also have the contour integral symbol $\displaystyle \oint$\oint
. $\endgroup$ Commented Jun 25, 2012 at 8:03 -
$\begingroup$ @WillieWong I've added \iiint. I did not write about contour integrals, since I use them only rarely. Feel free to edit my post or add a separate answer with some examples of contour integrals, if you thing it would be useful. $\endgroup$ Commented Jun 25, 2012 at 12:33
-
1$\begingroup$ This post mentions how the integral sign can be made larger. $\endgroup$ Commented Mar 21, 2014 at 14:14