Notice! This document is currently in
Archived
status.
The content of this document may be incorrect or outdated.
The content of this document may be incorrect or outdated.
Print this article Edit this article
Symbolic Mathematic examples in Mathematica
x = 3; y = 5;
x + y
8
Differentiation
Clear[] variables in case they have values left over from earlier.
Clear[a, b, x];
expr = 2 a x + b;
D[expr, x]
2 a
Integration
Integrate[expr, x]
2
b x + a x
Matrix and Vector Operations
Clear[a, b, c, d, x, y];
(* matrix *)
m = {{a, b}, {c, d}}
{{a, b}, {c, d}}
(* vector *)
v = {x, y}
{x, y}
(* constant times matrix *)
k m
{{a k, b k}, {c k, d k}}
(* square each element of m *)
m^2
2 2 2 2
{{a , b }, {c , d }}
(* matrix multiplication *)
m . m
2
{{a + b c, a b + b d},
2
{a c + c d, b c + d }}
(* matrix times vector, v acts as column vector *)
m . v
{a x + b y, c x + d y}
(* vector times matrix, v acts as row vector *)
v . m
{a x + c y, b x + d y}
(* transpose matrix *)
Transpose[m]
{{a, c}, {b, d}}
Solving Equations
Clear[x, y]
Solve[{x + y == 10, 2x - y == 5}, {x, y}]
{{x -> 5, y -> 5}}
Solve[{a x^2 + b x + c == 0}, x]
2
-b - Sqrt[b - 4 a c]
{{x -> ---------------------},
2 a
2
-b + Sqrt[b - 4 a c]
{x -> ---------------------}}
2 a
a = 1; b = 5; c = 4;
Solve[{a x^2 + b x + c == 0}, x]
{{x -> -4}, {x -> -1}}
b = 10; c = 9;
Solve[{a x^2 + b x + c == 0}, x]
{{x -> -9}, {x -> -1}}
c = 8;
Solve[{a x^2 + b x + c == 0}, x]
{{x -> -5 - Sqrt[17]},
{x -> -5 + Sqrt[17]}}
N[%]
{{x -> -9.12311},
{x -> -0.876894}}
Last Modified:
Dec 19, 2016 11:12 am US/Eastern
Created:
May 10, 2007 12:51 pm GMT-4
by
admin
JumpURL: