Download presentation
Presentation is loading. Please wait.
1
Mathematica: An Interpreter for Mathematical Operations at Symbolical and Numerical Level This chapter is mainly devoted to some applications of Mathematica. Although Mathematica is taken as the basic platform for these hours the main purpose of the course is to emphasize on symbolical and numerical calculations by using computers. That is, the syntax and the algorithms not the languages themselves are considered as the basic components. This chapter contains some basic structures for the usage of mathematica. This chapter is mainly devoted to some applications of Mathematica. Although Mathematica is taken as the basic platform for these hours the main purpose of the course is to emphasize on symbolical and numerical calculations by using computers. That is, the syntax and the algorithms not the languages themselves are considered as the basic components. This chapter contains some basic structures for the usage of mathematica.
2
Introduction The computer scientific term interpreter is used for the programs which can work mostly in interactive mode. That is, the program creates an environment for the user such that each instruction given by the user through the interaction is immediately processed without waiting for the next entries. The interactive mode can be avoided by using straightforward processing of a bundle of commands included in a file prepared by the user. This processing fashion is called batch mode. Introduction The computer scientific term interpreter is used for the programs which can work mostly in interactive mode. That is, the program creates an environment for the user such that each instruction given by the user through the interaction is immediately processed without waiting for the next entries. The interactive mode can be avoided by using straightforward processing of a bundle of commands included in a file prepared by the user. This processing fashion is called batch mode.
3
There are various interpreters for symbolic and numeric operations. The first important development toward this target was the creation of the LISP programming language which was designed for mostly artificial intelligence. LISP was an interpreter and its born stimulated the development of some well-known symbolic and numeric interpreters like REDUCE, Macsyma, and Maple. There are various interpreters for symbolic and numeric operations. The first important development toward this target was the creation of the LISP programming language which was designed for mostly artificial intelligence. LISP was an interpreter and its born stimulated the development of some well-known symbolic and numeric interpreters like REDUCE, Macsyma, and Maple.
4
This main purpose is these programs was chosen as giving the capability of dealing with mathematical operations at high level as much as possible. This main purpose is these programs was chosen as giving the capability of dealing with mathematical operations at high level as much as possible. The program which was developed by the researchers in Princeton University at the years of 1980s was designed in these directions. However, this language which was named Mathematica later is not a LISP based program. It is costructed by using C programming language. The program which was developed by the researchers in Princeton University at the years of 1980s was designed in these directions. However, this language which was named Mathematica later is not a LISP based program. It is costructed by using C programming language.
5
The purpose of the utilization of the C based structure is to avoid the slowness of LISP interpreter. The purpose of the utilization of the C based structure is to avoid the slowness of LISP interpreter. A lot of symbolic and numeric interpreter including Mathematica are licensed and needs payment which can not be considered inexpensive for moderate organizations although their academic versions may be reasonable for the budgets of some Turkish organizations like universities. A lot of symbolic and numeric interpreter including Mathematica are licensed and needs payment which can not be considered inexpensive for moderate organizations although their academic versions may be reasonable for the budgets of some Turkish organizations like universities.
6
We can itemize some important capabilities of Mathematica as follows: 1. Mathematica can be used a pocket calculator. Calculations can be done either symbolic or numeric level. The default is symbolic for mathematica. This utilization can be realized through an interactive way. To activate an interactive session under Linux the user should give the command math at the prompt of Linux shell. This produces the following display: We can itemize some important capabilities of Mathematica as follows: 1. Mathematica can be used a pocket calculator. Calculations can be done either symbolic or numeric level. The default is symbolic for mathematica. This utilization can be realized through an interactive way. To activate an interactive session under Linux the user should give the command math at the prompt of Linux shell. This produces the following display:
7
Mathematica 4.0 for Linux Copyright 1988-1999 Wolfram Research, Inc. -- Terminal graphics initialized -- In[1]: = where In[1]:= is the prompt of Mathematica where the user command is waited for. Each entry given by the user numbered started from 1. Therefore, the user must type its first command at this prompt. The command will be entered when the user presses Enter or Return key. Mathematica 4.0 for Linux Copyright 1988-1999 Wolfram Research, Inc. -- Terminal graphics initialized -- In[1]: = where In[1]:= is the prompt of Mathematica where the user command is waited for. Each entry given by the user numbered started from 1. Therefore, the user must type its first command at this prompt. The command will be entered when the user presses Enter or Return key.
8
Generally, each input label or prompt, In[n]:=, corresponds to an output label, Out[n]=, with the same n value. 2. It is possible to plot the relations between two or three entities by using a quite advanced graphics utility coming with Mathematica. The relations between the entities can be given by either functions or data tables. The displaying can be realized in either text (by some symbols like dots, letters) or graphics display medium (by pixels). Generally, each input label or prompt, In[n]:=, corresponds to an output label, Out[n]=, with the same n value. 2. It is possible to plot the relations between two or three entities by using a quite advanced graphics utility coming with Mathematica. The relations between the entities can be given by either functions or data tables. The displaying can be realized in either text (by some symbols like dots, letters) or graphics display medium (by pixels).
9
The graphic display medium under Unix or Linux operating system is generally X window. The pixel by pixel displaying under DOS is not possible but you can use graphical display facilities by passing into the Windows medium. 3. Mathematica can be used as a high level programming language. You can construct programs composed of Mathematica commands and combine them into quite advanced structures. The graphic display medium under Unix or Linux operating system is generally X window. The pixel by pixel displaying under DOS is not possible but you can use graphical display facilities by passing into the Windows medium. 3. Mathematica can be used as a high level programming language. You can construct programs composed of Mathematica commands and combine them into quite advanced structures.
10
The high level statement here implies the great support of the structure of the program to the user. 4. It is possible to make data structural analysis and modelling via Mathematica. 5. It is possible to get scientific and technical knowledge by using Mathematica. 6. The software desing of Mathematica permits us to call some external facilities which are provided by some other programming languages or tools and use them on Mathematica background. The high level statement here implies the great support of the structure of the program to the user. 4. It is possible to make data structural analysis and modelling via Mathematica. 5. It is possible to get scientific and technical knowledge by using Mathematica. 6. The software desing of Mathematica permits us to call some external facilities which are provided by some other programming languages or tools and use them on Mathematica background.
11
7. It is possible to interactively design and create certain documents like web pages. Animations and various voice applications can be constructed by using Mathematica. 8. It is possible to use and control system facilities within a Mathematica session. That is, you can use some system commands during a Mathematica session without existing. 9. Mathematica can be used as an embedded systems. 7. It is possible to interactively design and create certain documents like web pages. Animations and various voice applications can be constructed by using Mathematica. 8. It is possible to use and control system facilities within a Mathematica session. That is, you can use some system commands during a Mathematica session without existing. 9. Mathematica can be used as an embedded systems.
12
Interactive Usage of Mathematice A mathematica session is started by giving the math command under Linux text console. If you use a term window under X Windows you can do the same thing and proceed as if you work through the next terminal. However, it is possible to use a different interaction between the user and Mathematica. It is called notebook. Interactive Usage of Mathematice A mathematica session is started by giving the math command under Linux text console. If you use a term window under X Windows you can do the same thing and proceed as if you work through the next terminal. However, it is possible to use a different interaction between the user and Mathematica. It is called notebook. The NT version of Mathematica uses the notebook interface mostly. The NT version of Mathematica uses the notebook interface mostly.
13
You can even use the text based interaction under X Window system. Then you can do everything you are able to do in the textural interface and furthermore the graphical display becomes available. You can even use the text based interaction under X Window system. Then you can do everything you are able to do in the textural interface and furthermore the graphical display becomes available. The commands of Mathematica can be given separately, that is, one command at each single attempt or collectively, that is, more than one commands at each single attempts. The commands of Mathematica can be given separately, that is, one command at each single attempt or collectively, that is, more than one commands at each single attempts.
14
In the case of more than one commands, the commands must be separated by using a semicolon character between the commands. However, there is a pitfall here. According the Mathematica syntax the commands need to be terminated by semicolon and if a command is followed by a semicolan then Mathematica gives up display the result of the action defined by that command otherwise it is displayed. In the case of more than one commands, the commands must be separated by using a semicolon character between the commands. However, there is a pitfall here. According the Mathematica syntax the commands need to be terminated by semicolon and if a command is followed by a semicolan then Mathematica gives up display the result of the action defined by that command otherwise it is displayed.
15
It is possible to recall a previously given command and execute it one more time through the Mathematica sessions. For this purpose, you can use % symbol to enter the command given as the (n-1). entry through the prompt In[n]:=. If % symbol is inserted into a command then the result of the previous command (not itself) is used at the place where % is given. It is possible to recall a previously given command and execute it one more time through the Mathematica sessions. For this purpose, you can use % symbol to enter the command given as the (n-1). entry through the prompt In[n]:=. If % symbol is inserted into a command then the result of the previous command (not itself) is used at the place where % is given.
16
There are a few possibilities to exit Mathematica. The most generally used one is the Quit command. You can also use the keystrokes Ctrl C for breaking the procedure and Ctrl Z for hanging the process and rebooting the system. The selection from these possibilities depends on the user’s preference and the situation. There are a few possibilities to exit Mathematica. The most generally used one is the Quit command. You can also use the keystrokes Ctrl C for breaking the procedure and Ctrl Z for hanging the process and rebooting the system. The selection from these possibilities depends on the user’s preference and the situation.
17
Batch Operations Under Mathematica You can write a bundle of Mathematica commands into a file and construct a program and then you can call this program within an interactive Mathematica session. For this purpose, you can enter the command << filename or the command get [ filename ] where filename denotes the name of the file under consideration. The first one of these commands is similar to the redirectioning feature of the UNIX systems. Batch Operations Under Mathematica You can write a bundle of Mathematica commands into a file and construct a program and then you can call this program within an interactive Mathematica session. For this purpose, you can enter the command << filename or the command get [ filename ] where filename denotes the name of the file under consideration. The first one of these commands is similar to the redirectioning feature of the UNIX systems.
18
We can take the commands which will be executed by Mathematica during a session from a file. We can write the commands into a file such that each line corresponds to a separate entry. It is better to terminate the file by the command Quit. We can exemplify the batchwise utilization of Mathematica by considering the following program file: 1/2 2*3+5 Quit We can take the commands which will be executed by Mathematica during a session from a file. We can write the commands into a file such that each line corresponds to a separate entry. It is better to terminate the file by the command Quit. We can exemplify the batchwise utilization of Mathematica by considering the following program file: 1/2 2*3+5 Quit
19
Where the name of the Mathematica program file can be anything within the regulations of the operating system under consideration. However, it is better to use.m extension to distinguish Mathematica files from the other files although some other programs like Modula may use this suffix. If we name this file sample1.m then we can use the command math < sample1.m which is redirection of the input stream from Standard Input STDIN to the file sample1.m. Where the name of the Mathematica program file can be anything within the regulations of the operating system under consideration. However, it is better to use.m extension to distinguish Mathematica files from the other files although some other programs like Modula may use this suffix. If we name this file sample1.m then we can use the command math < sample1.m which is redirection of the input stream from Standard Input STDIN to the file sample1.m.
20
When this command is given the following display appears on the screen: Mathematica 4.0 for Linux Copyright 1988-1999 Wolfram Research, Inc. -- Terminalgraphics initialized -- In[1]:= Out[1]= 1/2 In[2]:= Out[2]= 11 In[3]:= When this command is given the following display appears on the screen: Mathematica 4.0 for Linux Copyright 1988-1999 Wolfram Research, Inc. -- Terminalgraphics initialized -- In[1]:= Out[1]= 1/2 In[2]:= Out[2]= 11 In[3]:=
21
Where the command inputs which are taken from the file sample1.m are not shown. The display contains the output lines and also input labels. It is also possible to redirect the output stream from standard output STDOUT to a file whose name is, say, sample1.ses by revising the above command to math sample1.ses. The name of the output file here is quite arbitrary under the limitation of the operating system. However, it is better to specific structures like. ses to recall some features. Where the command inputs which are taken from the file sample1.m are not shown. The display contains the output lines and also input labels. It is also possible to redirect the output stream from standard output STDOUT to a file whose name is, say, sample1.ses by revising the above command to math sample1.ses. The name of the output file here is quite arbitrary under the limitation of the operating system. However, it is better to specific structures like. ses to recall some features.
22
Mathematical Operations Via Mathematica Arithmetic Operations The aritmethical operations under Mathematica are done by using the operators which are denoted by the symbols +, -, /. You can insert one of these symbols between two symbolic or numeric value to get the corresponding actions. It is generally preferred to leave spaces before and after each symbol. There is no need to use a specific symbol for the multiplication although the star * symbol can also be used for this purposes. Mathematical Operations Via Mathematica Arithmetic Operations The aritmethical operations under Mathematica are done by using the operators which are denoted by the symbols +, -, /. You can insert one of these symbols between two symbolic or numeric value to get the corresponding actions. It is generally preferred to leave spaces before and after each symbol. There is no need to use a specific symbol for the multiplication although the star * symbol can also be used for this purposes.
23
To leave a space between two consecutive entity is interpreted as multiplication by Mathematica. The power operator is the caret character ˆ. The left side of this operator is the base while its right entity is the exponent. The level of the evaluation depends on the arguments of this operator. To leave a space between two consecutive entity is interpreted as multiplication by Mathematica. The power operator is the caret character ˆ. The left side of this operator is the base while its right entity is the exponent. The level of the evaluation depends on the arguments of this operator. The results obtained from the arithmetic operations on integers are displayed in such a way that all digits of the result is shown in the display. The results obtained from the arithmetic operations on integers are displayed in such a way that all digits of the result is shown in the display.
24
There is no finite limitations due to memory allocations of the other structural programming languages like C, Fortran. There is no finite limitations due to memory allocations of the other structural programming languages like C, Fortran. You can evaluate the numerical value of any symbolic quantity which has numerical value. For this purpose the command N [ entity ] where entity denotes the entity whose value will be evaluated by Mathematica. You can evaluate the numerical value of any symbolic quantity which has numerical value. For this purpose the command N [ entity ] where entity denotes the entity whose value will be evaluated by Mathematica.
25
Mathematica can deal with the complex numbers also. For this purpose it is necessary to use the imaginary numbers unit -1 which denoted by I in Mathematica. Archive Constants The values of some widely used mathematical constants are known by Mathematica. In other words there are some reserved constants under Mathematica to use for well known values of universal Mathematical constants. Mathematica can deal with the complex numbers also. For this purpose it is necessary to use the imaginary numbers unit -1 which denoted by I in Mathematica. Archive Constants The values of some widely used mathematical constants are known by Mathematica. In other words there are some reserved constants under Mathematica to use for well known values of universal Mathematical constants.
26
Amongst these we can mention I which is the unit imaginary numbers, that is, -1, Infinity ( ), Pi (3.1415926..), Degree (The conversion factor from degree to radian), GoldenRatio ((1+ 5)/2), E (e=2.71828..), EulerGamma ( = 0.577216..), Catalan (C=0.915966..). Amongst these we can mention I which is the unit imaginary numbers, that is, -1, Infinity ( ), Pi (3.1415926..), Degree (The conversion factor from degree to radian), GoldenRatio ((1+ 5)/2), E (e=2.71828..), EulerGamma ( = 0.577216..), Catalan (C=0.915966..).
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.