Math: Difference between revisions

From Mr. V Wiki Math
Jump to navigation Jump to search
No edit summary
 
(38 intermediate revisions by the same user not shown)
Line 8: Line 8:
Superscript: <syntaxhighlight lang="html5" inline><math>x^{5+y}</math></syntaxhighlight> gives <math>x^{5+y}</math><br>
Superscript: <syntaxhighlight lang="html5" inline><math>x^{5+y}</math></syntaxhighlight> gives <math>x^{5+y}</math><br>
Subscript: <syntaxhighlight lang="html5" inline><math>x_{5+t}</math></syntaxhighlight> gives <math>x_{5+t}</math><br>
Subscript: <syntaxhighlight lang="html5" inline><math>x_{5+t}</math></syntaxhighlight> gives <math>x_{5+t}</math><br>
Together: <syntaxhighlight lang="html5" inline><math>x_{5+t}^{5+y}</math></syntaxhighlight> gives <math>x_{5+t}^{5+y}</math>  
Together: <syntaxhighlight lang="html5" inline><math>x_{5+t}^{5+y}</math></syntaxhighlight> gives <math>x_{5+t}^{5+y}</math>


=== Fractions & Radicals ===
=== Fractions, radicals and brackets ===


Fractions: <syntaxhighlight lang="html5" inline><math>\frac{1}{x}</math></syntaxhighlight> gives <math>\frac{1}{x}</math><br>
Fractions: <syntaxhighlight lang="html5" inline><math>\frac{1}{x}</math></syntaxhighlight> gives <math>\frac{1}{x}</math><br>
Square root: <syntaxhighlight lang="html5" inline><math>\sqrt{x+1}</math></syntaxhighlight> gives <math>\sqrt{x+1}</math><br>
Bad brackets, parentheses, etc.: <syntaxhighlight lang="html5" inline><math>(\frac{1}{x})^3</math></syntaxhighlight> gives <math>(\frac{1}{x})^3</math> <br>
General radical: <syntaxhighlight lang="html5" inline><math>$\sqrt[3]{64}=4</math></syntaxhighlight> gives <math>\sqrt[3]{64}=4</math><br>
Correct brackets, parentheses, etc.: <syntaxhighlight lang="html5" inline><math>\left(\frac{1}{x}\right)^3</math></syntaxhighlight> gives <math>\left(\frac{1}{x}\right)^3</math> <br>
Square root: <syntaxhighlight lang="html5" inline><math>\sqrt{x+1}</math></syntaxhighlight> gives <math>\sqrt{x+1}</math><br><br>
General radical: <syntaxhighlight lang="html5" inline><math>\sqrt[3]{64}=4</math></syntaxhighlight> gives <math>\sqrt[3]{64}=4</math><br>


=== Trig. & Log Functions ===   
=== Trig. & Log Functions ===   
Sin, Cos, Tan, etc.: <syntaxhighlight lang="html5" inline><math>\sin{(\theta)}</math></syntaxhighlight> gives <math>\sin{(\theta)}</math><br>
Sin, cos, tan, etc.: <syntaxhighlight lang="html5" inline><math>\sin{(\theta)}</math></syntaxhighlight> gives <math>\sin{(\theta)}</math><br>
Arcsin, arccos, arctan, etc.: <syntaxhighlight lang="html5" inline><math>\arcsin{(\theta)}</math></syntaxhighlight> gives <math>\arcsin{(\theta)}</math><br>  
Log: <syntaxhighlight lang="html5" inline><math>\log_{5}{5^2}=2</math></syntaxhighlight> gives <math>\log_{5}{5^2}=2</math><br>
Log: <syntaxhighlight lang="html5" inline><math>\log_{5}{5^2}=2</math></syntaxhighlight> gives <math>\log_{5}{5^2}=2</math><br>
Ln: <syntaxhighlight lang="html5" inline><math>\ln{e^3}=3</math></syntaxhighlight> gives <math>\ln{e^3}=3</math><br>


=== Calculus ===


----
Sum: <syntaxhighlight lang="html5" inline><math>\sum_{i=1}^{n}i=\frac{n(n+1)}{2}</math></syntaxhighlight> gives <math>\sum_{i=1}^{n}i=\frac{n(n+1)}{2}</math><br><br>
Limit: <syntaxhighlight lang="html5" inline><math>\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</math></syntaxhighlight> gives <math>\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</math><br><br>
Derivative: <syntaxhighlight lang="html5" inline><math>\frac{d}{dx}\left[\frac{1}{x}\right]=-\frac{1}{x^2}</math></syntaxhighlight> gives <math>\frac{d}{dx}\left[\frac{1}{x}\right]=-\frac{1}{x^2}</math><br><br> 
Integral: <syntaxhighlight lang="html5" inline><math>\int_{1}^{x+1}\frac{1}{r}dr</math></syntaxhighlight> gives <math>\int_{1}^{x+1}\frac{1}{r}dr</math><br><br>
Limit bar: <syntaxhighlight lang="html5" inline><math>\bigg|_{0}^{1}</math></syntaxhighlight> gives <math>\bigg|_{0}^{1}</math><br><br>


=== Advanced ===
Sometimes it might be necessary to break up and align a long equation such as:


<br><br><br><br>
<math>
<math>
\begin{align}
\begin{align}
Line 39: Line 50:
</math>
</math>


To do this use <code>&=</code> where the equation <code>=</code> should align and put <code>\begin{align} and \end{align}</code> at the start and end of <syntaxhighlight lang="html5" inline><math></math></syntaxhighlight>. Finally use <code>\\[2ex]</code> to create the proper space between the lines (if they're too close) and to push the rest of the equation to the next line. The code below renders what is seen above:
<syntaxhighlight lang="html5">
<math>
\begin{align}
\int_{0}^{1}\left(3+x\sqrt{x}\right)dx &= \int_{0}^{1}\left(3+x^{1}{x}^{\frac{1}{2}}\right)dx = \int_{0}^{1}\left(3+x^{1+\frac{1}{2}}\right)dx  = \int_{0}^{1}\left(3+x^{\frac{3}{2}}\right)dx \\[2ex]
&= 3x+\frac{x^{\frac{3}{2}+1}}{\frac{3}{2}+1}\bigg|_{0}^{1} = 3x+\frac{x^{\tfrac{5}{2}}}{\frac{5}{2}}\bigg|_{0}^{1} = 3x+\frac{2x^{\frac{5}{2}}}{5}\bigg|_{0}^{1} \\[2ex]
&= \left[3(1)+\frac{2(1)^{5/2}}{5}\right]-\left[3(0)+\frac{2(0)^{5/2}}{5}\right] \\[2ex]


<code>123<math></math></code>
&= 3+\frac{2}{5} = \frac{15}{5}+\frac{2}{5} = \frac{17}{5} 
 
\end{align}
</math>
</syntaxhighlight>

Latest revision as of 19:40, 25 August 2022

Basics

To render any math equation, the math equation must be between <math></math> i.e., <math>f(x)=x^2</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle f(x)=x^2} .

Common math commands

Superscript & Subscript

Superscript: <math>x^{5+y}</math> gives
Subscript: <math>x_{5+t}</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle x_{5+t}}
Together: <math>x_{5+t}^{5+y}</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle x_{5+t}^{5+y}}

Fractions, radicals and brackets

Fractions: <math>\frac{1}{x}</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \frac{1}{x}}
Bad brackets, parentheses, etc.: <math>(\frac{1}{x})^3</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle (\frac{1}{x})^3}
Correct brackets, parentheses, etc.: <math>\left(\frac{1}{x}\right)^3</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \left(\frac{1}{x}\right)^3}
Square root: <math>\sqrt{x+1}</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \sqrt{x+1}}

General radical: <math>\sqrt[3]{64}=4</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \sqrt[3]{64}=4}

Trig. & Log Functions

Sin, cos, tan, etc.: <math>\sin{(\theta)}</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \sin{(\theta)}}
Arcsin, arccos, arctan, etc.: <math>\arcsin{(\theta)}</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \arcsin{(\theta)}}
Log: <math>\log_{5}{5^2}=2</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \log_{5}{5^2}=2}
Ln: <math>\ln{e^3}=3</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \ln{e^3}=3}

Calculus

Sum: <math>\sum_{i=1}^{n}i=\frac{n(n+1)}{2}</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \sum_{i=1}^{n}i=\frac{n(n+1)}{2}}

Limit: <math>\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \lim_{h\to 0}\frac{f(x+h)-f(x)}{h}}

Derivative: <math>\frac{d}{dx}\left[\frac{1}{x}\right]=-\frac{1}{x^2}</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \frac{d}{dx}\left[\frac{1}{x}\right]=-\frac{1}{x^2}}

Integral: <math>\int_{1}^{x+1}\frac{1}{r}dr</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \int_{1}^{x+1}\frac{1}{r}dr}

Limit bar: <math>\bigg|_{0}^{1}</math> gives Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \bigg|_{0}^{1}}

Advanced

Sometimes it might be necessary to break up and align a long equation such as:

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \begin{align} \int_{0}^{1}\left(3+x\sqrt{x}\right)dx &= \int_{0}^{1}\left(3+x^{1}{x}^{\frac{1}{2}}\right)dx = \int_{0}^{1}\left(3+x^{1+\frac{1}{2}}\right)dx = \int_{0}^{1}\left(3+x^{\frac{3}{2}}\right)dx \\[2ex] &= 3x+\frac{x^{\frac{3}{2}+1}}{\frac{3}{2}+1}\bigg|_{0}^{1} = 3x+\frac{x^{\tfrac{5}{2}}}{\frac{5}{2}}\bigg|_{0}^{1} = 3x+\frac{2x^{\frac{5}{2}}}{5}\bigg|_{0}^{1} \\[2ex] &= \left[3(1)+\frac{2(1)^{5/2}}{5}\right]-\left[3(0)+\frac{2(0)^{5/2}}{5}\right] \\[2ex] &= 3+\frac{2}{5} = \frac{15}{5}+\frac{2}{5} = \frac{17}{5} \end{align} }

To do this use &= where the equation = should align and put \begin{align} and \end{align} at the start and end of <math></math>. Finally use \\[2ex] to create the proper space between the lines (if they're too close) and to push the rest of the equation to the next line. The code below renders what is seen above:

<math>
\begin{align}

\int_{0}^{1}\left(3+x\sqrt{x}\right)dx &= \int_{0}^{1}\left(3+x^{1}{x}^{\frac{1}{2}}\right)dx = \int_{0}^{1}\left(3+x^{1+\frac{1}{2}}\right)dx  = \int_{0}^{1}\left(3+x^{\frac{3}{2}}\right)dx \\[2ex]

&= 3x+\frac{x^{\frac{3}{2}+1}}{\frac{3}{2}+1}\bigg|_{0}^{1} = 3x+\frac{x^{\tfrac{5}{2}}}{\frac{5}{2}}\bigg|_{0}^{1} = 3x+\frac{2x^{\frac{5}{2}}}{5}\bigg|_{0}^{1} \\[2ex]

&= \left[3(1)+\frac{2(1)^{5/2}}{5}\right]-\left[3(0)+\frac{2(0)^{5/2}}{5}\right] \\[2ex]

&= 3+\frac{2}{5} = \frac{15}{5}+\frac{2}{5} = \frac{17}{5}  

\end{align}
</math>