tanszek:oktatas:techcomm:mathematical_expressions_in_tex_language

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tanszek:oktatas:techcomm:mathematical_expressions_in_tex_language [2024/09/02 14:00] – [2. Writing Basic Mathematical Expressions] kissatanszek:oktatas:techcomm:mathematical_expressions_in_tex_language [2024/09/10 08:55] (current) – [5. Exercise] kissa
Line 1: Line 1:
 ===== Introduction to LaTeX for Mathematical Expressions ===== ===== Introduction to LaTeX for Mathematical Expressions =====
  
-The goal of the lesson is to become familiar with the TeX language, specifically for the purpose of writing mathematical expressions.+The goal of the lesson is to become familiar with LaTeX, specifically for the purpose of writing mathematical expressions.
  
 ==== 1. Introduction to LaTeX ==== ==== 1. Introduction to LaTeX ====
Line 7: Line 7:
 **What is LaTeX?** **What is LaTeX?**
  
-  - LaTeX is a high-quality typesetting system, primarily used for technical and scientific documents. It is particularly powerful for formatting complex mathematical equations and formulas, making it a preferred choice in academia and research.+LaTeX is a high-quality typesetting system, primarily used for technical and scientific documents. It is particularly powerful for formatting complex mathematical equations and formulas, making it a preferred choice in academia and research.
  
 **What are the advantages of LaTeX?** **What are the advantages of LaTeX?**
  
-  **Precision and Control**: LaTeX allows precise formatting of documents and mathematical expressions+  * **Handling Complex Documents**: It is ideal for mathematical formulas, citations, and cross-referencing in technical writing. 
-  **Consistency**: LaTeX automatically manages references, labels, and numbering, ensuring consistency throughout your document+  * **Consistent Layout**: Automatically ensures a uniform, professional design by separating content from formatting. 
-  - **Professional Quality**: Documents created in LaTeX look professional and are publication-ready.+  * **Scalability**: Suitable for large projectsallowing version control and modular structure
 +  * **Longevity**: LaTeX's plain text format ensures long-term compatibility and durability. 
 +  * **Academic Preference**: Often required in academic and scientific publishing.
  
 **Getting Started:** **Getting Started:**
Line 23: Line 25:
 **Basic Document Structure:** **Basic Document Structure:**
  
-<code>+<code LaTeX>
 \documentclass{article}  % Specifies the document class (article, report, book, etc.) \documentclass{article}  % Specifies the document class (article, report, book, etc.)
 \begin{document}          % Begins the content of the document \begin{document}          % Begins the content of the document
Line 35: Line 37:
 ==== 2. Writing Basic Mathematical Expressions ==== ==== 2. Writing Basic Mathematical Expressions ====
  
-**Inline vs. Display Math:**+=== Inline vs. Display Math ===
  
-  - **Inline Math**: For mathematical expressions that appear within a line of text, use ''\(...\)''+  - **Inline Math**: For mathematical expressions that appear within a line of text, use ''$...$''
-    - Example: \(E = mc^2\) is written as ''\(E = mc^2\)'' in LaTeX. +    - E.g. $E = mc^2is written as ''$E = mc^2$'' in LaTeX. 
-  - **Display Math**: For standalone equations, use ''\(...\)'' or the `equation` environment+  - **Display Math**: For standalone equations, use ''$$...$$''
-    - Example: To display \[ E = mc^2 \] on its own line, use ''\E = mc^2 \]''.+    - E.g. To display $$E = mc^2$$ on its own line, use ''$$E = mc^2$$''
 + 
 +== Example == 
 + 
 +<code LaTeX> 
 +\documentclass{article} 
 +\begin{document} 
 + 
 +The equation $E = mc^2$ is famous in physics. It is so important that we can highlight $$E = mc^2$$ by putting it to a separate line. 
 + 
 +\end{document} 
 +</code> 
 + 
 +This code will became: 
 + 
 +{{:tanszek:oktatas:techcomm:pasted:20240902-141219.png}} 
 + 
 +=== Basic Mathematical Symbols === 
 + 
 +  - **Exponents (superscripts)**: Use ''^'' for superscripts. 
 +    - E.g. $x^2$ is written as ''$x^2$''
 +  - **Subscripts**: Use `_` for subscripts. 
 +    - E.g. $a_1$ is written as ''$a_1$''
 +  - **Fractions**: Use `\frac{numerator}{denominator}`. 
 +    - E.g. $\frac{a}{b}$ is written as ''$\frac{a}{b}$''
 + 
 +== Examples == 
 + 
 +<code LaTeX> 
 +\documentclass{article} 
 +\begin{document} 
 + 
 +% Exponent and subscript 
 +The formula for the area of a circle is $A = \pi r^2$. 
 + 
 +% Fraction 
 +The equation $\frac{a}{b} = c$ represents a fraction. 
 + 
 +% Combined 
 +The equation for kinetic energy is $K = \frac{1}{2}mv^2$. 
 + 
 +\end{document} 
 +</code> 
 + 
 +This code will become: 
 + 
 +{{:tanszek:oktatas:techcomm:pasted:20240902-141644.png}} 
 + 
 +==== 3. Special Mathematical Symbols in LaTeX ==== 
 + 
 +LaTeX provides a variety of symbols to accurately represent mathematical expressions. 
 + 
 +  - The **plus-minus symbol** is used to denote values that can be either positive or negative and is written as ''\pm'', which displays as $\pm$. 
 +  - To express **square roots**, the square root symbol is used, which is written as ''\sqrt{...}''. For example, ''\sqrt{2}'' produces $\sqrt{2}$  
 +  - For **higher-order roots**, such as a cubic root, the syntax is ''\sqrt[3]{...}'', yielding $\sqrt[3]{9}$ 
 +  - Another common symbol is the **infinity symbol**, represented as ''\infty'', and it is displayed as $\infty$  
 +  - For **greater than or equal to** and **less than or equal to** symbols, use ''\geq'' and ''\leq'', which render as $\geq$ and $\leq$, respectively. 
 + 
 +=== Summation === 
 + 
 +The general form of summation in LaTeX is written using the ''\sum'' command. For example, the sum from $i=1$ to $n$ is given by: 
 + 
 +$$\sum_{i=1}^{n} i^2$$ 
 + 
 +This expression sums the squares of integers from 1 to $n$. 
 + 
 +=== Derivative === 
 + 
 +The derivative of a function $f(x)$ with respect to $x$ is represented in LaTeX using the ''\frac'' command for fractions. The notation for the derivative of $f(x)$ with respect to $x$ is: 
 + 
 +$$\frac{d}{dx} f(x)$$ 
 + 
 +This gives the rate of change of $f(x)$ with respect to $x$. 
 + 
 +=== Partial Derivative === 
 + 
 +For partial derivatives, the ''\partial'' command is used. The partial derivative of a function $f(x, y)$ with respect to $x$ is: 
 + 
 +$$\frac{\partial}{\partial x} f(x, y)$$ 
 + 
 +This expression gives the partial derivative of $f$ with respect to $x$, holding other variables constant. 
 + 
 +=== Partial Integration === 
 + 
 +Partial integration, also known as integration by parts, can be expressed in LaTeX. For the specific example of integrating $x \sin(x)$ from $a$ to $b$, the integral is written as: 
 + 
 +\[ 
 +\int_{a}^{b} x \sin(x) \, dx 
 +\] 
 + 
 +This represents the definite integral of $x \sin(x)$ with respect to $x$ from $a$ to $b$. 
 + 
 +==== 4. Aligning Equations ==== 
 + 
 +=== Align Environment === 
 +  - The `align` environment is used to align multiple equations. Each line of the equation is aligned using the `&` symbol, typically before the equal sign or any other operator. 
 +  - Use `\\` to separate lines. 
 + 
 +== Example == 
 + 
 +<code LaTeX> 
 +\documentclass{article} 
 +\usepackage{amsmath} 
 +\begin{document} 
 + 
 +\begin{align} 
 +  3x + 2y + 0z &= 6 \\ 
 +  4x - y &= 25 
 +\end{align} 
 + 
 +\end{document} 
 +</code> 
 + 
 +This code will become: 
 + 
 +{{:tanszek:oktatas:techcomm:pasted:20240902-142323.png}} 
 + 
 +**Explanation:** 
 +  - **\usepackage{amsmath}**: The `amsmath` package is required for advanced mathematical typesetting features, including the `align` environment. 
 +  - **&**: This symbol is used to align equations at the specified point, usually before an operator like `=`. 
 + 
 +**Tips:** 
 +  - You can label equations using the ''\label{}'' command and refer to them later with ''\ref{}''
 +  - Example: 
 + 
 +<code LaTeX> 
 +\begin{equation} \label{eq:quadratic} 
 +x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} 
 +\end{equation} 
 +</code> 
 + 
 +To refer to this equation later, use ''Equation \ref{eq:quadratic}''
 + 
 + 
 +==== 5. Exercise ==== 
 + 
 +Reproduce the following mathematical proof in LaTeX. Use inline and display math, as well as basic and special symbols! Save the result in PDF format! 
 + 
 +{{:tanszek:oktatas:techcomm:pasted:20240902-144955.png}} 
 + 
 + 
 +Raw text: 
 + 
 +<code> 
 +Proof: √2 is Irrational 
 + 
 +Assume, for contradiction, that 2 is rational. Then it can be expressed as a fraction a/b, where a and b are coprime integers. 
 + 
 +Then: 
 +HERE COMES AN EQUATION. 
 + 
 +Squaring both sides: 
 +HERE COMES AN EQUATION. 
 + 
 +Multiplying both sides by b2: 
 +HERE COMES AN EQUATION. 
 + 
 +This implies that a2 is even, so a must also be even. Let a = 2k for some integer k. 
 + 
 +Substituting into the equation: 
 +HERE COMES AN EQUATION. 
 + 
 +Dividing by 2: 
 +HERE COMES AN EQUATION. 
 + 
 +This implies that b2 is even, so b must also be even. 
 + 
 +But if both a and b are even, they are not coprime, which contradicts our original assumption. Therefore, 2 must be irrational. 
 +</code>
  
tanszek/oktatas/techcomm/mathematical_expressions_in_tex_language.1725285619.txt.gz · Last modified: 2024/09/02 14:00 by kissa