Note: You are currently viewing documentation for Moodle 3.4. Up-to-date documentation for the latest stable version of Moodle is likely available here: Using TeX Notation 3.

Using TeX Notation 3: Difference between revisions

From MoodleDocs
(Merged into main page)
 
(18 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Brackets==
#REDIRECT [[Using_TeX_Notation]]
 
As students advance through Maths, they come into contact with brackets. Algebraic notation depends heavily on brackets. The usual keyboard values of ( and ) are useful, for example:
 
  <math>d = 2 \ \times \ (4 \ - \ j)</math>
 
This is written as:
 
  $$ d = 2 \ \times \ (4 \ - \ j) $$
 
Usually, these brackets are enough for most formulae but they will not be in some circumstances. Consider this:
 
  <math>4x^3 \ + \ (x \ + \ \frac{42}{1 + x^4})</math>
 
Is OK, but try it this way:
 
  <math>4x^3 \ + \ \left(x \ + \ \frac{42}{1 + x^4}\right)</math>
 
This can be achieved by:
 
  $$ 4x^3 \ + \ \left(x \ + \ \frac{42}{1 + x^4}\right) $$
 
A simple change using the \left( and \right) symbols instead. Note the actual bracket is both named and presented.
 
==Ellipsis==
 
The Ellipsis is a simple code:
 
  <math>x_1, \ x_2, \ \ldots, \ x_n</math>
 
Written like:
 
  $$ x_1, \ x_2, \ \ldots, \ x_n  $$
 
A more practical application could be:
 
Question:
  "Add together all the numbers from 1 <math>\ldots</math> 38.
  What is an elegant and simple solution to this problem?
  Can you create an algebraic function to explain this solution?
  Will your solution work for all numbers?"
 
Answer:
The question uses an even number to demonstrate a mathematical process and generate an algebraic formula.
 
{| class = "nicetable"
|-
| Part 1:
| Part 2.
| Part 3.
|-
|
<math>1. \ 1 \ + \ 38 \ = \ 39</math>
 
<math>2. \ 2 \ + \ 37 \ = \ 39</math>
 
<math>3. \ 3 \ + \ 36 \ = \ 39</math>
 
<math>\ldots</math>
 
<math>19. 19 \ + \ 20 \ = \ 39 </math>
 
<math>\therefore x \ = \ 39 \ \times \ 19 </math>
 
<math>\therefore x \ = \ 741 </math>
 
 
|An algebraic function might read something like:
<math>t = (1 + n) \times n/2 </math>
 
Where t = total and n = the last number.
 
|The solution is that, using the largest and the smallest numbers, the numbers are added and then multiplied by the number of different combinations to produce the same result adding the first and last numbers.
The answer must depend on the number, <math>\frac{n}{2}</math> being a whole number. Therefore, the solution will not work for an odd range of numbers, only an even range.
 
|}
 
==Geometric Shapes==
 
There are two ways to produce geometric shapes, one is with circles and the other is with lines. Each take a bit of practice to get right, but they can provide some simple geometry. It may be easier to produce the shapes in Illustrator or Paint Shop Pro or any one of a number of other drawing packages and use them to illustrate your lessons, but sometimes, some simple diagrams in Moodle will do a better job.
 
==Circles==
 
Circles are easy to make.
 
{| class="nicetable"
|-
| [[Image:cfmimetex20.gif|left]]
| Circles are easily created, and only needs a number to determine how large the circle is.
To create the circle use $$ \circle(150) $$. This makes a circle of 150 pixels in diameter.
 
|}
 
==Creating Arcs==
 
Arcs are also easy to produce, but require some additional parameters. The same code structure used in circles create the basic shape, but the inclusion of a start and end point creates only the arc. However, notice where the 0 point is, not at the true North, but rather the East and run in an anti-clockwise direction.
 
{| class="nicetable"
|-
| [[Image:cfmimetex21a.gif|left]]
| $$ \circle(120;90,180)$$
| [[Image:cfmimetex21b.gif|left]]
| $$ \circle(120;0,90)$$
|-
| [[Image:cfmimetex21c.gif|left]]
| $$ \circle(120;180,270)$$
| [[Image:cfmimetex21d.gif|left]]
| $$ \circle(120;270,360)$$
|}
 
==The \picture Command==
 
Using circles and arcs as shown above is somewhat limiting. The \picture command allows you to use a frame in which to build a picture of many layers. Each part of the picture though needs to be in its own space, and while this frame allows you to be creative, to a degree, there are some very hard and fast rules about using it.
 
All elements of a picture need to be located within the picture frame. Unexpected results occur when parts of an arc, for example, runs over the border of the frame. (This is particularly true of lines, which we will get to next, and the consequences of that overstepping of the border can cause serious problems.)
 
The \picture command is structured like:
  \picture(100){(50,50){\circle(200)}}
  \command(size of frame){(x co-ordinate, y co-ordinate){\shape to draw(size or x co-ordinate,[y co-ordinate)}) 
  Count the opening and closing brackets, be careful of the position,     
{| class="nicetable"
|-
| [[Image:cfmimetex24a.gif|left]]
| $$ \picture(100){(50,50){\circle(200)}}&&
 
The picture frame brings elements together that you may not otherwise see.
 
Because of the frame size of 100px and the centre point of the circle in the mid-point of the frame, the 200px circle will be squashed. Unexpected results occur when sizes are not correct.
| [[Image:cfmimetex24b.gif|left]]
|
Using the picture frame, you can layer circles
and lines over each other, or they can intersect.
 
$$ \picture(100){(50,50){\circle(99)} (50,50){\circle(80)}} $$
|-
| [[Image:cfmimetex24c.gif|left]]
| You may want to see an image of a circle with a dot in the middle.
You may have to try to place the centre dot correctly , but the
ordering of the elements in the image may have an impact.
 
$$ \picture(100){(48,46){\bullet}(50,50){\circle(99)}} $$
| [[Image:cfmimetex24d.gif|left]]
| Using the same ideas as above, you can make semi-circles.
 
$$\picture(150){(50,50){\circle(100;0,180)}(100,50){\circle(100;180,360)}}$$
|}
 
==Lines==
 
----
 
'''Warning:''' Drawing lines in TeX Notation in Moodle is an issue. If the line is not drawn properly then the parser will try to correctly draw the line but will not successfully complete it. This means that every image that needs be drawn will be drawn until it hits the error. When the error is being converted, it fails, so no subsequent image is drawn. Be careful and make sure your line works BEFORE you move to the next problem or next image.
 
----
{| class="nicetable"
|-
| [[Image: cfmimetex26.gif|frame|left| a couple of lines]]
| $$\red \picture(200){(20,0){ \line(180,0)}{(20,180){\line(180,0}$$
The structure of the picture box is that the \picture(200) provides a square image template.
 
The (20,0) provides the starting coordinates for any line that comes after. In this case the start point is at 20pixels in the x axis and 0 pixels in the y axis. The starting point for all coordinates, 0,0, is the bottom left corner and they run in a clockwise manner. '''Do not confuse this with arcs.'''
 
The \line(180,0) determines the length and inclination of the line. In this case, the inclination is 0 and the length is 180px.
 
These are enclosed in braces, all inside one set of braces owned by the \picture() control sequence.
 
The next set of commands are the same, that is, the (20,200) are the coordinates of the next line. The x co-ordinate is the 20, that is the distance to the right from the 0 point. The y co-ordinates is the distance from the bottom of the image. Whereas the first line started and ran on the bottom of the picture frame, the y co-ordinate starts at the 200 pixel mark from the bottom of the image. The line, at 180 pixels long and has no y slope. This creates a spread pair of parallel lines.   
| [[Image: cfmimtex27.gif|thumb|right|150px|\picture explained]]
|}
 
While this explains the structure of a line, there is a couple of elements that you need to go through to do more with them.
 
==Squares and Rectangles==
Drawing squares and rectangles is similar, but only slightly different.
 
There should be a square box tool, and there is, but unless it has something inside it, it does not display. It is actually easier to make a square using the \line command.
 
{| class="nicetable"
|-
| [[Image: line03.gif|left]]
|This box is constructed using:
$$ \picture(250){(10,10){\line(0,230)}(10,10){\line(230,0)}(240,10){\line(0,230)}(10,240){\line(230,0)}}$$
It is a 250 pixel square box with a 230 pixel square inside it.
| [[Image: line04.gif|left]]
|This box is different in that is has the equal length indicators that are used in a square.
$$ \picture(250){(10,10){\line(0,230)}
(5,120){\line(10,0)}
(10,10){\line(230,0)}
(120,5){\line(0,10)}
(240,10){\line(0,230)}
(235,120){\line(10,0)}
(10,240){\line(230,0)}
(120,235){\line(0,10)}}$$
|-
| [[Image: line05.gif|left]]
| The rectangle then becomes the same thing, but with one side shorter. For a portrait canvas it would be:
$$ \picture(250){(10,10){\line(0,230)}(10,10){\line(150,0)}(160,10){\line(0,230)}(10,240){\line(150,0)}}$$
| [[Image: line06.gif|left]]
|The rectangle can also produce a landscape shape:
$$ \picture(250){(10,10){\line(0,160)}(10,10){\line(230,0)}(240,10){\line(0,160)}(10,170){\line(230,0)}}$$
|}
 
==Controlling Angles==
 
Controlling angles is a little different. They involve a different perception, but not one that is unfamiliar. Consider this:
 
We have a point from which we want to draw a line that is on an angle. The notation used at this point can be positive, positive or positive, negative or negative, positive or negative, negative. Think of it like a graph, the 0,0 point is in the centre, and we have four quadrants around it that give us one of the previously mentioned results.
 
{| class="nicetable"
|-
| rowspan="4"|[[Image:co-ordquadrants.png|left]]
| [[Image:line06a.gif|left]] $$\picture(100){(50,50){\line(40,45)}}$$,
a posityve x and positive y
|-
| [[Image:line06b.gif|left]]$$\picture(100){(50,50){\line(-40,45)}}$$
a negative x and positive y
|-
| [[Image:line06c.gif|left]]$$\picture(100){(50,50){\line(-40,-45)}}$$
a negative x and negative y
|-
| [[Image:line06d.gif|left]]$$\picture(100){(50,50){\line(40,-45)}}$$
a positive x and a negative y
|}
 
Essentially, what these points boil down to is that anything above the insertion point is a positive on the y axis, anything below is a negative. Anything to the left of the insertion point is a negative while everything to the right is a positive.
 
{| class="nicetable"
|-
|[[Image:line06e.gif|left]]
| $$\picture(100){(50,50){\line(40,45)}(50,50){\line(-40,45)}(50,50){\line(-40,-45)}(50,50){\line(40,-45)}}$$
 
The co-ordinate alignment process in TeX is not that good that you can use one set of co-ords as a single starting point for all lines. The layering of each object varies because of the position of the previous object, so each object needs to be exactly placed.
 
This co-ord structure has a great deal of impact on intersecting lines, parallel lines and triangles.
|}
 
==Intersecting Lines==
 
You can set up an intersecting pair easily enough, using the \picture control sequence.
 
{| class="nicetable"
|-
| [[Image:cfmimetex31.gif|left]]
| $$ \picture(200){(10,0){\line(150,150)} (0,130){\line(180,-180)}} $$
 
The lines that are drawn can be labeled.
 
$$ \picture(200){(10,0){\line(150,150)}(0,130){\line(180,-180)}
(0,10){A}(0,135){B}(140,0){C}(140,150){D}} $$
 
To produce another image.
| [[Image:cfmimetex32.gif|right]]
|-
| colspan="3" style="text-align: center;"| To which you may want to ask the question:
$$The \ \angle \ of \ AXB \ is \ 72\textdegree. \ What \ is \ the \ value \ of \ \angle BXD? $$
[[Image: cfmimetex32a.gif|center]]
 
NOTE: Labeling this image, above-right, turned out to be fairly simple. Offsetting points by a few pixels at the start or end points of the lines proved a successful strategy. The X point proved a little more problematic, and took a number of adjustments before getting it right. Experience here will help.
|-
| colspan="2"| With labels the drawing can become a little more like your traditional geometric drawing, but the devil is in the details. The parallel markers need to be placed properly, and that is where experience really comes into it. On lines that are vertical or horizontal, you can get away with using the > or < directly from the keyboard, or the <mark>\gg</mark>  or <mark>\ll<\mark>  symbols. In either case, you need to position them properly.
 
The code:
$$\picture(200){(15,45){\line(170,0)} (15,30){c}(170,28){d}(15,160){\line(170,0)}(15,145){e}(180,143){f}(50,20){\line(110,175)}(58,20){a}(140,185){b}(42,32){\kappa}(53,48){\beta}
(150,165){\kappa}
(90,38){\gg}(80,153){\gg}
}$$
| [[Image:line10.gif|right]]
|}
 
==Lines and Arcs==
 
Combining lines and arcs is a serious challenge actually, on a number of levels. For example lets take an arc from the first page on circles.
{| class="nicetable"
|-
| [[Image: line11.gif|left]]
| Fairly innocuous of itself, but when we start to add in elements, it changes dramatically.
 
$$ \circle(120;90,180) $$
|-
| [[Image: line12.gif|left]]
| $$\picture(150){(75,75){\circle(120;90,180)}(75,75){\line(-70,0)}(75,75){\line(0,75)}} $$
All elements in this drawing start in the same place. Each is layered, and properly placed on the canvas, and using the same co-ord to start makes it easy to control them. No matter the size of the arc, intersecting lines can all be drawn using the centre co-ords of the arc.
|}
 
==Triangles ==
 
Of all the drawing objects, it is actually triangles that present the most challenge. For example:
 
{|
|-
| [[Image:line13.gif|left]]
|This is a simple triangle, one that allows us to establish a simple set of rules for the sides. The vertical always has an x=0 co-ord and the horizontal always has a y=0 co-ord.
 
In this case with an x value of 330 on the horizontal, and a y value of 320 on the vertical, the hypotenuse should then have a value of x=340, and the y=330, but not so, they actually have an x=330 and a y=320.
 
They do not add the starting point co-ords.
$$\picture(350){(10,10){\line(0,320)}(10,330){\line(330,0)}(10,10){\line(330,320)}}$$
| [[Image:line14.gif|right]
 
|}
 
This triangle has been developed for a Trigonometry page - but the additional notation should provide insight into how you can use it. 
 
{| class="nicetable"
|-
| The triangle shows like:
[[Image:trig01.gif|left]]
|We use the different elements of the triangle to identify those things we need to know about a right-angled triangle.
 
The hypotenuse is always the side that is opposite the right angle. The longest side is always the Hypotenuse.
 
To identify the other elements of the triangle we look for the sign <math>\theta</math>. <math>\Theta</math> is the starting point for naming the other sides.
 
The side that is opposite <math>\angle \theta</math> is known as the Opposite.
 
The side that lies alongside <math>\angle \theta</math> is known as the Adjacent side.
 
To determine which is which, draw a line that bisects <math>\angle \theta</math> and whatever line it crosses is the Opposite side.
|-
| colspan="2"| The code:
$$ \picture(350,250){(25,25){\line(300,0)}(25,25){\line(0,220)}(25,245){\line(300,-220)}(310,25){\circle(100;135,180)}(20,100){\line(310,-75)} (25,25){\fbox{\line(5,5)}}(25,25){\line(150,150)}(165,140){Hypotenuse}(120,2){Adjacent}(2,80){\rotatebox{90}{Opposite}}(270,40){\theta}}$$
|}
 
==See Also==
 
* [[Using TeX Notation]]
* [[Using TeX Notation 2]]
 
 
[[Category: Mathematics]]

Latest revision as of 05:21, 18 May 2014

Redirect to: