Professional Documents
Culture Documents
S#
MECH102
Homework 2
MathCAD
a x2 + b x + c0
a1
b2
c3
b +
b2 4 a c
xa
2a
b
b2 4 a c
xb
2a
xb = 1 1.414i
xa = 1 + 1.414i
checking results:
f ((x)) a x 2 + b x + c
f xa = 0
f xb = 0
Plotting a function with automated ranges and number of points (which can be changed)
130
120
110
100
90
80
70
60
50
40
30
20
10
0
-10
-8
-6
-4
-2
f ((x))
0
10
Plotting a function using a range variable, and changing plot display options:
x 5 , 4.95 3
18
16
14
12
f ((x))
10
x=
8
6
4
2
-5
-4
-3
-2
-1
1 of 6
U i
d i
ifi
di i di
5
4.95
4.9
4.85
4.8
4.75
4.7
4.65
4.6
4.55
4.5
4.45
x=
2.45
2.5
2.55
2.6
2.65
2.7
2.75
2.8
2.85
2.9
2.95
3
MM/DD/YY
Full Name
S#
m 100
pmv
v 60
a 20
2
p = 1.217 10 3
Fma
F = 62.2
Symbolic algebra
((x))
x=?
6 y +
((((y + 2)) ((3 y 2)))) 4
((x 2)) solve , x
x
3y2
x ((y))
2x3xy
y+2
3y2
2
evaluate solutions:
x ((5)) = 2 + 0.734i
x ((5)) = 2 0.734i
Symbolic calculus
a
a
a = 6.096
2
a = 6.096
2
((a))
a = 6.096
2
10 sin ((2 x))
f ((x)) ((x a)) +
x
d
20 cos ((2 x)) 10 sin ((2 x))
f ((x)) 2 x 2 a +
d ((x))
x
x2
dx
x 3 , 2.9 5
100
80
60
f ((x))
40
20
0
-3
-2
-1
x
5
0
-3
-2
-1
-5
-10
d ((x))
-15
-20
-25
-30
x
2 of 6
MM/DD/YY
Full Name
S#
vx 1
vy 2
v
v x
vy
1
v=
2
vv=5
v vx + 1i vy = 1 2i
1 2 3
A2 1 5
0 2 3
AA
1 0 0
= 0 1 0
0 0 1
Programming
||
f ((x)) if x < 1
||
x
||
else if 1 x 3 | |
||
(x 1) 2 + 1 | |
)
(
||
else if x > 3
||
3
|
||
piecewise function
x 2 , 1.9 5
f ((x))
-1
-2
-3
-4
-2
-1
x
3 of 6
MM/DD/YY
Full Name
S#
General programming problem example: find the sum of first N numbers divisible by 3
N 10000
|
results i 0
|
n0
|
total 0
|
while n < N
||
||
ii+1
||
remainder mod ((i , 3)) | |
if remainder 0 |
||
||
|
total total + i |
||
nn+1
|
|
||
[[ i total ]]
results = 3 10 4 1.5 10 8
largest results
largest = 3 10 4
sum results
sum = 1.5 10 8
0,0
0,1
i 3,63 N
sum = 1.5 10 8
sum i
i
3 i = 1.5 10 8
N ((N + 1))
3
= 1.5 10 8
2
or
i=1
Finding roots
x 1
f ((x))
marker added at 0
on vertical axis
0
-1
-2
-3
-4
-1
-0.5
0.5
1.5
x
4 of 6
MM/DD/YY
Full Name
S#
Guess Values
x1
y1
Solver
Constraints
x2 y2
sin ((x))
y
+xy
x
solution
x solution = 0.252
y solution = 1.322
((x , y))
solve , y
x 2 1i
fa ((x)) x 2 y 2
x 2 1i
solve , y
sin ((x))
sin ((x))
fb ((x)) y
+ x y
x
x ((x 1))
fa ((x)) = 1.322
fb ((x)) = 1.322
fa ((x))
1.6
1
1.4
fb ((x))
1.2
1
0
0.1
0.2
0.3
0.4
0.5
i 1 20
x x
i
i1
x 1
0
y 1
0
+2
x +x
i1
i
y
i
2
x=
5 of 6
1
3
5
7
9
11
13
y=
1
2
4
6
8
10
12
MM/DD/YY
Full Name
S#
Solver
Constraints
Guess Values
x1
y1
x > 2
x < 2 y2 + 3
3 < y < 5
z_max_loc
((z , x , y)) = 2
1.571
x z_max_loc = 2
0
y z_max_loc = 1.571
1
z ((x , y)) = 11
6 of 6
MM/DD/YY