MathCAD Homework: Solving Quadratic Equations, Plotting Functions, and Symbolic Algebra - , Assignments of Mechanical Engineering

This mathcad homework document includes various mathematical calculations and problem-solving tasks. Topics covered include solving quadratic equations, plotting functions using a range variable, using units and significant digit display, vector and matrix calculations, symbolic algebra, and programming. The document also includes examples of finding roots, solving sets of nonlinear equations, and iterative calculations.

Typology: Assignments

Pre 2010

Uploaded on 03/18/2009

koofers-user-fu6-1
koofers-user-fu6-1 ๐Ÿ‡บ๐Ÿ‡ธ

10 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
MathCAD Homework
by First_name Last_name
MM/DD/YY
Basic calculations (solution to quadratic equation: ax 2 + bx + c = 0)
a1:= b2:= c 3:=
x1
bโˆ’b24aโ‹…cโ‹…โˆ’+
2aโ‹…
:= x2
bโˆ’b24aโ‹…cโ‹…โˆ’โˆ’
2aโ‹…
:=
x11โˆ’1.414i+= x21โˆ’1.414iโˆ’=
checking results:
fx() ax
2
โ‹…bxโ‹…+ c+:=
fx
1
()
0=fx
2
()
0=
Plotting a function using a range variable
x5โˆ’4.95โˆ’, 3..:= x
-5
-4.95
-4.9
-4.85
-4.8
-4.75
-4.7
-4.65
-4.6
-4.55
-4.5
-4.45
-4.4
-4.35
-4.3
...
=
4โˆ’2โˆ’0 2
0
5
10
15
20
fx()
x
Using units and significant digit display
m 100 lbโ‹…:= v 60 mphโ‹…:= a 20 ft
sec2
โ‹…:=
pmvโ‹…:= p 1.217 103
ร—mkgโ‹…
s
=
Fmaโ‹…:= F 62.2 lbfโ‹…=
pf3
pf4
pf5

Partial preview of the text

Download MathCAD Homework: Solving Quadratic Equations, Plotting Functions, and Symbolic Algebra - and more Assignments Mechanical Engineering in PDF only on Docsity!

MathCAD Homework

by First_name Last_name

MM/DD/YY

Basic calculations (solution to quadratic equation: ax

2

  • bx + c = 0)

a := 1 b := 2 c := 3

x 1

โˆ’b b

2

  • โˆ’4 aโ‹… โ‹…c

2 aโ‹…

:= x 2

โˆ’b b

2

โˆ’ โˆ’4 aโ‹… โ‹…c

2 aโ‹…

x 1

= โˆ’ 1 +1.414i x 2

=โˆ’ 1 โˆ’1.414i

checking results:

f x( ) a x

2

:= โ‹… + b xโ‹… +c

f x ( 1 )

= 0 f x ( 2 )

Plotting a function using a range variable

x := โˆ’ 5 , โˆ’4.95.. 3 x

-4.

-4.

-4.

-4.

-4.

-4.

-4.

-4.

-4.

-4.

-4.

-4.

-4.

-4.

...

โˆ’ 4 โˆ’ 2 0 2

0

5

10

15

20

f x( )

x

Using units and significant digit display

m := 100 lbโ‹… v := 60 mphโ‹… a 20

ft

sec

2

p := m vโ‹… p 1.217 10

3

ร—

m kgโ‹…

s

F := m aโ‹… F =62.2 lbfโ‹…

Symbolic Algebra

x

2x โˆ’3 xโ‹… โ‹…y

( x โˆ’ 2 )

2

(y + 2 )

x y( )

6 yโ‹… + โˆ’(y + 2 ) โ‹…(3 y โ‹… โˆ’ 2 )โˆ’ 4

3 yโ‹… โˆ’ 2

โˆ’( y + 2 ) โ‹…( 3 yโ‹… โˆ’ 2 )โˆ’ 6 yโ‹… + 4

3 yโ‹… โˆ’ 2

x 5( )

0

= 2 +0.734i x 5( )

1

= 2 โˆ’0.734i

Symbolic Calculus

a := 6.1 redefine "a" to be unitless (see above), so MathCAD is

not confused below.

f x( ) ( x โˆ’a)

2 10 sin 2 x(^ โ‹… )

x

d x( ) 2 xโ‹… โˆ’ 2 aโ‹… 20

cos 2 x( โ‹… )

x

sin 2 x( โ‹… )

x

2

x :=โˆ’ 5 , โˆ’4.95.. 5

โˆ’ 5 0 5

0

50

100

150

f x( )

x

โˆ’ 5 0 5

โˆ’ 40

โˆ’ 20

0

20

d x( )

x

general programming problem example: find the sum of first N numbers divisible by 3

N := 10000

results i โ† 0

n โ† 0

total โ† 0

i โ†i + 1

remainder โ†mod i 3( , )

total total i if remainder = 0

0 otherwise

n โ† n + 1 ifremainder = 0

whilen <N

( i total)

results 3 10

4

ร— 1.5 10

8

ร—

= largest results

0 0,

:= largest 3 10

4

= ร—

sum results

0 1,

:= sum 1.5 10

8

= ร—

alternative solution (for this problem)

i := 3 6, ..3 Nโ‹… sum

i

i

:= sum 1.5 10

8

= ร—

other (even better) alternative solutions (for this problem):

1

N

i

i

8

= ร— or^3

Nโ‹… (N + 1 )

8

= ร—

Finding roots

f x( ) 2 x

2

:= โ‹… โˆ’ 4 sin xโ‹… ( )โˆ’ 2

x := 1 root f x( ( ) x, ) =1.

x := โˆ’ 1 root f x( ( ) x, ) =โˆ’0.

x :=โˆ’ 1 , โˆ’0.9.. 2

โˆ’ 1 0 1 2

โˆ’ 4

โˆ’ 2

0

2

4

f x( ) 0

x

marker added at 0

on vertical axis

Solving a set of nonlinear equations

x := 1 y := 1 initial guess

Given

x 2 y

2

= โˆ’

y

sin x( )

x

= +x yโ‹…

solution :=Find x y( , )

x solution

0

:= x = 0.252 y solution

1

:= y =1.

Checking results (solving symbolically and plotting)

y

sin x( )

x

= +x yโ‹…

x 2 y

2

= โˆ’

fb x( )

sin x( )

x โ‹…(x โˆ’ 1 )

fa x( )

โˆ’ x โˆ’ 2 โ‹…i

x โˆ’ 2 โ‹…i

fa x( )

0

= 1.322 fb x( ) =1.

x :=0.01 0.05, ..0.

0 0.1 0.2 0.3 0.

1

2

fa x( ) 0

fb x( )

x

Iterative calculations with subscripts

i := 1 .. 10 x

0

:= 1 y

0

x

i

x

i 1โˆ’

y

i

x

i 1โˆ’

x

i

x

0 0 1 2 3 4 5 6 7

1

3

5

7

9

11

13

...

= y

0 0 1 2 3 4 5 6 7

1

2

4

6

8

10

12

...