Mathematica: An Interpreter for Mathematical Operations at Symbolical and Numerical Level This chapter is mainly devoted to some applications of Mathematica.

Slides:



Advertisements
Similar presentations
Introduction to C Programming
Advertisements

1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Introduction to C Programming
1 BIL101, Introduction to Computers and Information Systems Chapter 7 Microsoft Word This chapter is based on the Turkish documents written by Fahrettin.
Computer Science 1620 Variables and Memory. Review Examples: write a program that calculates and displays the average of the numbers 45, 69, and 106.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Linux+ Guide to Linux Certification, Second Edition
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
BIL101, Introduction to Computers and Information Systems Chapter 9 S preadsheets, StarOffice Spreadsheet, MSExcel The StarOffice part of this chapter.
Linux+ Guide to Linux Certification, Second Edition
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
CS 1400 Chapter 1 Introduction and Background
Introduction to C Programming
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Basic Elements of C++ Chapter 2.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Digital Image Processing Lecture3: Introduction to MATLAB.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter Introduction to Computers and Programming 1.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Topics Introduction Hardware and Software How Computers Store Data
Fortran 1- Basics Chapters 1-2 in your Fortran book.
Introduction to M ATLAB EE 100 – EE Dept. - JUST.
Ch 21 Command Syntax Using the DIR Command with Parameters and Wildcards.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Objectives Understand what MATLAB is and why it is widely used in engineering and science Start the MATLAB program and solve simple problems in the command.
An Introduction to Unix Shell Scripting
®® Microsoft Windows 7 for Power Users Tutorial 13 Using the Command-Line Environment.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Input, Output, and Processing
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Linux+ Guide to Linux Certification, Third Edition
Shell Programming. Introducing UNIX Shells  Shell is also a programming language and provides various features like variables, branching, looping and.
Linux+ Guide to Linux Certification Chapter Eight Working with the BASH Shell.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
Introduction to Programming with RAPTOR
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Chapter 0 Getting Started. Objectives Understand the basic structure of a C++ program including: – Comments – Preprocessor instructions – Main function.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
Getting Started with MATLAB (part2) 1. Basic Data manipulation 2. Basic Data Understanding 1. The Binary System 2. The ASCII Table 3. Creating Good Variables.
Chapter Three The UNIX Editors.
 2000 Deitel & Associates, Inc. All rights reserved. Outline 8.1Introduction 8.2A Simple Program: Printing a Line of Text in a Web Page 8.3Another JavaScript.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
Linux+ Guide to Linux Certification, Second Edition
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
Chapter 1: Introduction to Computers and Programming.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
Linux Administration Working with the BASH Shell.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
Chapter Topics The Basics of a C++ Program Data Types
Topics Introduction Hardware and Software How Computers Store Data
Basic Elements of C++.
INTRODUCTION TO BASIC MATLAB
Basic Elements of C++ Chapter 2.
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
Presentation transcript:

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.

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.

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.

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.

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.

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:

Mathematica 4.0 for Linux Copyright 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 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.

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).

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

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.

When this command is given the following display appears on the screen: Mathematica 4.0 for Linux Copyright 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 Wolfram Research, Inc. -- Terminalgraphics initialized -- In[1]:= Out[1]= 1/2 In[2]:= Out[2]= 11 In[3]:=

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.

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.

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.

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.

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.

Amongst these we can mention I which is the unit imaginary numbers, that is,  -1, Infinity (  ), Pi ( ), Degree (The conversion factor from degree to radian), GoldenRatio ((1+  5)/2), E (e= ), EulerGamma (  = ), Catalan (C= ). Amongst these we can mention I which is the unit imaginary numbers, that is,  -1, Infinity (  ), Pi ( ), Degree (The conversion factor from degree to radian), GoldenRatio ((1+  5)/2), E (e= ), EulerGamma (  = ), Catalan (C= ).