Scientific Computation Using Mathematica

Scientific Computation Using Mathematica

Getting Started with Mathematica by Hakan Kutucu What is Mathematica Mathematica is a computer program created by Wolfram Research Inc.(1988) Mathematica is a powerful desktop

computer program capable of doing algebraic calculations, numerical approximations, and computer graphics. It is suitable for both numeric and symbolic work, and it has remarkable word- Some Graphical Examples What is Mathematica Mathematica has two parts: the Kernel and

the Front End. The Kernel is the main part of the system, which accepts Mathematica commands, processes them and sends back results. This is called evaluating the command. The Front End is the part of the system that handles such things as screen display, printing and the creation of Mathematica How does Mathematica work?

Mathematica documents are called Notebooks. A Notebook is a bit like a word-processor document; you can type and edit commands, send them to the Kernel for evaluation, display the results and save your work.

How does Mathematica work? You send commands to be evaluated by holding down the shift key and pressing the enter key Another easy way to evaluate by pressing the enter key at the right hand side of keyboard. Functionalities of


Numerical Computation Equation Solving Symbolic calculation Calculus Graphics Self-defined functions List Pattern Matching Animation

Mathematica Syntax Mathematica commands start with a CAPITAL letter, e.g. Sin[x]. If the command is really severalwords in English joined together then each one starts with a capital but WithNoSpacesInBetween. Case Sensitive: the word Fun is different from the word fun which is different from the word fuN.

Mathematica Syntax Mathematica uses a lot of brackets and all the different sorts of them, ( [ { } ] ). Arguments of functions are given in square brackets [ ]. Curly brackets, called braces, {} are used to make a list, usually to allow several objects to be treated as one. Expression are cascaded by () pairs.

SPECIAL CONSTANTS Mathematica protects these names; they cannot be used as names for other quantities. Arithmetic Operations Operation Symbol

+ Operation Name Add Sample -

Substruct 8-3 / Divide 4/6

* or Space Multiply 2*4 or 2 4 ^ Power

3^4 3+5 Arithmetic Operations Order of operation is important . BEDMAS N (Numerical)

(a) N[expr] displays 6 digits by default (b) N[expr, n] displays 6 digits when n<16 (c) N[expr, n] does not display more digits than n originally has. Some Mathematical Functions Sqrt[x] Exp[x]

square root ( ) exponential (ex) Log[x] Log[b, x] natural logarithm lnx logarithm to base b (logbx)

Sin[x], Cos[x], Tan[x] trigonometric functions (with arguments in radians) n! Mod[n, m] factorial of n

n modulo m FactorInteger[n] prime factors of n Graphics Mathematica incorporates a wide range of two-and three-dimensional graphics functions. The simplest is Plot, which

generates two-dimensional Cartesian graphs Plot[f, {x, xmin, xmax}] generates a plot of f as a function of x from xmin to xmax. Plot[{f1, f2, }, {x, xmin, xmax}] plots several functions fi. Graphics (Example)

Graphics(Options) Graphics(Options) For Other Options the command is Options[Plot] 3 Dimensional Plotting Plot3D[ f, {x,xmin,xmax}, {y,ymin,ymax}]

will draw the graph of z = f(x,y) over the rectangle [xmin,xmax][ymin,ymax] in the xy-plane. 3 Dimensional Plotting(Options) Three Dimensional Plotting(Options) Defining Functions A function may return a symbol, a real

number, a complex matrix, another function.... Any mathematical object is an acceptable value for a function. A function may be written using mathematical notation, it may be created using programming constructs (like for, if/then, etc.), or it could even be written in another language entirely (Fortran, C, etc.). Function & Variable Names

Mathematica variable names can be long, but they must not begin with a number, Because Mathematica interprets, say, 2dimension as 2 * dimension. Names can end with a number, though: x1 is a useful way of writing in Mathematica a subscripted variable like x1. Note also that combinations of letters without spaces are interpreted as new variables: ax does not mean a*x.

Defining Functions A function can be defined by using the following form: f[x_] := an expression involving x (no underbar) Example: f[x_]:=x^2+3x f[4] f[a+1] ?f (This shows the definition you made for

Equation solving Use Solve to solve an equation with an exact solution, including a symbolic solution.

Use NSolve or FindRoot to obtain a numerical approximation to the solution. To use solutions need to use expr/ .x y. Matrix Defining

Entering a matrix: a={{1,2,3},{4,5,6}, {7,8,9}} Displays nicely only if told to:

Menus exist but are harder to use than typing Matrix Operations Matrix Operations (Multiplication) Matrix multiplication (also called dot or inner product) is

carried out in Mathematica with the function Dot, typically entered with a dot short-hand syntax. Matrix Operations (Transpose) Matrix Operations

(Inverse) Matrix Operations Exercises x y z 2q 6 x 2 y q 2 Solve x y 3 z 2q 12 x y 4 z 5q 16

1.By using Solve Commabd 2.By using The equation Ax=b

Recently Viewed Presentations

  • Modal Verbs - Mr. Furman&#x27;S Educational Portal

    Modal Verbs - Mr. Furman'S Educational Portal

    Times New Roman Arial Calibri Cuaderno 1_Cuaderno MODAL VERBS Different moods and different ways to express them PowerPoint Presentation Structure of Modal Verbs CAN is used to indicate the possession of an ABILITY. I Rewrite the sentences. Use "CAN" for...
  • Handler Training Workshop - Pet Partners

    Handler Training Workshop - Pet Partners

    Pet Partners was the first organization to require training for handlers as part of registration. In recent years, Pet Partners has continued to create materials for current handlers, so that they can continue their education.
  • Chapter 2: Analysis - Gateway Engage

    Chapter 2: Analysis - Gateway Engage

    Chapter 2: Analysis Setting New York The fourth and final setting of the novel, New York City, is in every way the opposite of the valley of ashes—it is loud, garish, abundant, and glittering. To Nick, New York is simultaneously...
  • Oracle APEX 19.2: New Features Presenters Name Presenters

    Oracle APEX 19.2: New Features Presenters Name Presenters

    Oracle JET and jQuery Library Upgrades Included JavaScript libraries are updated with each release of APEX APEX 19.1 includes Oracle JET 6.1.0, jQuery 3.3.1 and jQuery UI 1.12.1
  • Product Lifecycle Management - Wilkes University

    Product Lifecycle Management - Wilkes University

    Product Lifecycle Management (PLM) != Product Life Cycle Management (PLCM) "PLM describes the engineering aspect of a product, from managing description and properties of a product through its development and useful life." "PLCM refers to the commercial management of a...
  • Dante&#x27;s Inferno

    Dante's Inferno

    Each part consists of a prologue and approximately 33 cantos (Inferno has 34.) Since the narrative poem is in an exalted form with a hero as its subject, it is an epic poem. Dante's Inferno Dante the Poet's hero is...
  • Addressing the Needs of Military Families Reception and

    Addressing the Needs of Military Families Reception and

    400 responses for each of the two markets (Fayetteville and Norfolk) Age: Respondents were required to be at least 18 years old. Military Affiliation: Give an Hour required that a minimum of 25% respondents be affiliated with the military, either...
  • Evaluating Furniture - University of Southern Mississippi

    Evaluating Furniture - University of Southern Mississippi

    Softwood: (keep their leaves in the Fall) cedar, cypress, fir, pine and redwood. Solid Wood Very expensive Does not use any plywood, particle board or veneers Can warp and expand Veneer Cutting Methods Wood Veneer Thin slice of wood adhered...