Presentation

Mathematicaworkshop, October 2, 2014
Davis Auditorium
by Gautam Dasgupta, Civil Engg. & Engg. Mechanics
Abstract
An hour of introductory description of the computing environment Mathematica is
intended to assist preparing self-study of this scientific computing software that is campuswide available.
The solid algorithmic foundation of the Mathematica language makes is easy to learn
using on-line help alongside demonstration notes and books, which are available in the
internet, after the basic structural concepts are grasped. Thus the focus will be on illustrating how the numerical, symbolic and graphical calculations are uniformly programmed
throughout Mathematica in tandem. Programming discipline and good programming
habit will be initiated with examples.
In addition to demonstrating simple calculations, brief description of concept development in speaker’s research will also be included.
Self-learning by using the software in homework, lab-work and in research is the best
way to harness the power of Mathematica.
After the formal presentation the speaker will be available for individual discussions.
Mathematica workshop
October 2, 2014
Presenter: Gautam Dasgupta
[email protected]
Topics
0 to 5 minutes: Resources
5 to 10 minutes: Computer Mathematics
10 to 15 minutes : Replacement rules
15 to 20 minutes : Basic structures
20 to 30 minutes : Linear Algebra
30 to 35 minutes : Modifying system rules
35 to 45 minutes : Research Application
45 to 55 minutes : Q & A
Mathemaics vs. Computer Mathematics
Replacement rules
Basic structures
Linear Algebra
Modifying system rules
Research Application
Mathemaics vs. Computer Mathematics
Traditional Mathematics
y = y (x); y(a)
Computer Mathematics
yValue = yFunction[x]
In[1]:=
FullForm@a * bD
Out[1]//FullForm=
In[2]:=
Out[2]=
In[3]:=
Out[3]=
Times@a, bD
a 8b, c, d<
8a b, a c, a d<
a + 8b, c, d<
8a + b, a + c, a + d<
User defined functions can have any
system function property.
In[4]:=
SetAttributes@f, ListableD
In[5]:=
f@a , 8b, c, d<D
Out[5]=
8f@a, bD, f@a, cD, f@a, dD<
Integral examples:
In[6]:=
Out[6]=
In[7]:=
Out[7]=
In[8]:=
Out[8]=
Integrate@ArcTan@xD, xD
x ArcTan@xD -
1
2
LogA1 + x2 E
Integrate@Exp@- xD ArcTan@xD, xD
- ‰-x ArcTan@xD +
1
2
 ‰Â ExpIntegralEi@-  - xD -
Integrate@Sqrt@ArcTan@xDD, xD
‡
ArcTan@xD „ x
1
2
 ‰- ExpIntegralEi@ - xD
Replacement rules
In[9]:=
solution1 = Solve@x ^ 2 ã a, xD
Out[9]=
99x Ø -
In[10]:=
solution2 = Solve@8x ^ 2 ã a, x * y ã b<, 8x, y<D
Out[10]=
::x Ø -
a =, 9x Ø
a,yØ-
a ==
b
a
In[11]:=
Out[11]=
In[12]:=
Out[12]=
In[13]:=
Out[13]=
z = x * y^2
x y2
z ê. solution1
9-
a y2 ,
z ê. solution2
:-
b2
,
a
In[14]:=
Out[14]=
a y2 =
b2
>
a
Sin@qD ê. Sin Ø Cos
Cos@qD
>, :x Ø
a,yØ
b
a
>>
Linear Algebra
inner product
In[15]:=
Out[15]=
In[16]:=
a = 88p1, q1, r1<, 8p2, q2, r2<<
88p1, q1, r1<, 8p2, q2, r2<<
MatrixForm@aD
Out[16]//MatrixForm=
K
In[17]:=
Out[17]=
In[18]:=
p1 q1 r1
O
p2 q2 r2
b = 88x<, 8y<, 8z<<
98x<, 8y<, 9x y2 ==
MatrixForm@bD
Out[18]//MatrixForm=
x
y
x y2
In[19]:=
Out[19]=
In[20]:=
a.b
99p1 x + q1 y + r1 x y2 =, 9p2 x + q2 y + r2 x y2 ==
MatrixForm@a . bD
Out[20]//MatrixForm=
p1 x + q1 y + r1 x y2
p2 x + q2 y + r2 x y2
Outer product
In[21]:=
a = 8p, q, r<
Out[21]=
8p, q, r<
In[22]:=
b = 8x, y<
Out[22]=
In[23]:=
Out[23]=
8x, y<
Outer@f, a, bD
88f@p, xD, f@p, yD<, 8f@q, xD, f@q, yD<, 8f@r, xD, f@r, yD<<
2
Untitled-7
In[24]:=
MatrixForm@%D
Out[24]//MatrixForm=
f@p, xD f@p, yD
f@q, xD f@q, yD
f@r, xD f@r, yD
Jacobian
In[25]:=
Out[25]=
In[26]:=
Out[26]=
In[27]:=
a = 8p@x, yD, q@x, yD<
8p@x, yD, q@x, yD<
Outer@D, a, bD
99pH1,0L @x, yD, pH0,1L @x, yD=, 9qH1,0L @x, yD, qH0,1L @x, yD==
TableForm@%D
Out[27]//TableForm=
pH1,0L @x, yD
pH0,1L @x, yD
qH1,0L @x, yD
qH0,1L @x, yD
Pseudoinverse
In[28]:=
? PseudoInverse
PseudoInverse@mD finds the pseudoinverse of a rectangular matrix. à
In[29]:=
Out[29]=
In[30]:=
Out[30]=
In[31]:=
Out[31]=
m = 881, 2, 3<, 84, 5, 6<, 87, 8, 9<<
881, 2, 3<, 84, 5, 6<, 87, 8, 9<<
Det@mD
0
PseudoInverse@mD
::-
23
36
,-
1
6
,
11
36
>, :-
1
18
, 0,
1
18
>, :
19
36
,
1
6
,-
7
36
>>
Modifying system rules
In[33]:=
Out[33]=
In[34]:=
Out[34]=
Inverse@mD
Inverse@881, 2, 3<, 84, 5, 6<, 87, 8, 9<<D
Unprotect@InverseD
8Inverse<
In[35]:=
Inverse@m_ ê; Det@mD ã 0D := PseudoInverse@mD
In[36]:=
Inverse@mD
Out[36]=
::-
23
36
,-
1
6
,
11
36
>, :-
1
18
, 0,
1
18
>, :
19
36
,
1
6
,-
7
36
>>
Research Application
2
Untitled-9