of x

CSU Homework

Published on 2 weeks ago | Categories: Documents | Downloads: 0 | Comments: 0

Comments

Content

 

Full Name

S#

MECH102 Homework 2 MathCAD

a ⋅ x 2 + b ⋅ x + c =  0

Basic Basi c calcula calculations tions - solut solution ion to quadrati quadratic c equation: equation:

a≔   1

b≔  2

c≔   3

xa ≔

−b +   b 2 − 4 ⋅  a ⋅ c 2 ⋅  a

xb ≔

xa = −   1 + 1.414i

−b −   b 2 − 4 ⋅  a ⋅ c 2 ⋅  a

xb = −1   − 1.41 1.414i 4i

checking results:

≔ a ⋅ x 2 + b ⋅ x + c

 f x  f xa

  0 =

  0 =

 f xb

Plotting a function with automated ranges and number of points (which can be changed)

-10 -8

-6

-4

-2

130 120 110 100 90 80 70 60 50 40 30 20 10 0

 f x

0

2

4

6

8

10

x

Plotting a function using a range variable, and changing plot display options:

x ≔  −5 , − −4. 4.95 95‥ 3 18 16 14 12

 f x

10

x=

8 6 4 2 -5

-4

-3

-2

-1

0

1

2

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 ⎥⎥ ⎣ ⋮ ⎦

x=

⎡⋮ ⎤ ⎢ 2.45 ⎥ ⎥ ⎢ ⎢ 2.5 ⎥ ⎢ 2.55 ⎥ ⎢ 2.6 ⎥ ⎢ 2.65 ⎥ ⎢ 2.7 ⎥ ⎥ ⎢ ⎢ 2.75 ⎥ ⎢ 2.8 ⎥ ⎢ 2.85 ⎥ ⎢ 2.9 ⎥ ⎢⎢ 2.95 ⎥⎥ ⎣3 ⎦

1 of 6

Non-Commercial Use Only

MM/DD/YY

 

Full Name

S#

Using units and significant digit display

m ≔ 1  00 ⋅

v ≔  60 ⋅

 p ≔ m ⋅ v

 

 p =

a ≔  20 ⋅

⋅ 1. 1.217   217 ⋅ 103 ――

2

 F ≔ m ⋅ a

 

 F =   62.2

Symbolic algebra

x

 

clears previous definition of range variable "x"

x = ? 

⎡ 6 ⋅  y +  ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ − y +  2 ⋅ 3 ⋅  y −  2 − 4 ⎤ solve e,x ⎢ ⎥⎥ x−   2 2 solv x 3 ⋅  y −  2 x y ≔ ――――   = ―― ――→ ⎢⎢ ⎥ y+  2 2 ⋅  x − 3  ⋅  x ⋅ y y   y   y − +   2 ⋅ 3 ⋅ −   2 − 6 ⋅ +   4 ⎢ −――――――――― ⎥ 3 ⋅  y −  2 ⎦ ⎣ evaluate solutions:

x 5

0

= 2 + 0.734i

x 5

1

= 2 − 0. 0.7734i

Symbolic calculus

a=   6.096

a a≔   ―

 

2

strip units off numerical value

  a =  6.096

2

a

 f x d x

a=   6.096

allows variable "a" serve as a new symbolic variable, while still keeping its numeric value

2 10 ⋅ sin 2 ⋅  x ≔ x − a + ――――

x

d 20 ⋅ cos 2 ⋅  x 10 ⋅ sin 2 ⋅  x ≔ ―   f x → 2 ⋅  x −  2 ⋅  a +  ―――― − ―――― x x2 dx x ≔  −3 , − −22.9‥ 5 100 80 60

 f x

40 20 -3

-2

-1

0

0

1

2

3

4

5

x 5 -3

-2

-1

0 -5

0

1

2

3

4

5

-10

d x

-15 -20 -25 -30

x 2 of 6

Non-Commercial Use Only

MM/DD/YY

 

Full Name

S#

Vector Vector and matrix calculations

vy ≔   −2

vx ≔   −1   ⎡ vx ⎤ v≔ ⎣ vy ⎦

  ⎡ −1 ⎤ ⎣ −2 ⎦

v=

mag ≔   v

=   2.236

v⋅v=  5

magnitude and dot product

v ≔ vx +   1i ⋅  vy = −   1 − 2i

complex plane representation

angle ≔ arg    v

angle of a vector (argument)

=   −116.565

v ≔ ma mag g∠   angl angle e = 2. 236 ∠ −116.565°

⎡ −1 −1.1 .182 82 1.09 1.0911 − −0. 0.63 6366 ⎤ ⎢ 0.545 45 −0. −0.273 273 −0. −0.091 091 ⎥  A = 0.5 0.36 3644 − −0. 0.18 1822 0.27 0.2733 ⎦ ⎣ 0.

⎡1 2 3⎤  A ≔ ⎢ 2 1 5 ⎥ ⎣ 0 −2 3 ⎦ −1

 A ⋅ A

entering and displaying a vector in polar form

−1

⎡1 0 0⎤ =⎢0 1 0⎥ ⎣0 0 1⎦

Programming

 f x

  ‖ if  x <  1 || ≔ ‖ || x ‖ || ‖ else if  1 ≤  x ≤  3 | | ‖ ‖ || 2 ‖ − x −  1 + 1 | | ‖ ‖ || ‖ else if  x >  3 || ‖ −3 | | | ‖

piecewise function

x ≔  −2 , − −11.9 ‥ 5

2 1 0

 f x

-1 -2 -3 -4 -2

-1

0

1

2

3

4

5

x 3 of 6

Non-Commercial Use Only

MM/DD/YY

 

Full Name

S#

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

 N ≔   10000

| | | |   || || ‖ i ←  i +  1 ||   mod i ,  3 | | ‖ remainder ← || ‖ if remainder =  0 | || ‖ ‖ total ← t otal + i | || | ‖ ‖ | n ←  n +  1 | || ‖ ‖ i tota totall |

  ‖i← results ≔ ‖   0   0 ‖n← ‖ total ←   0 ‖ while n < N  ‖ ‖ ‖‖ ‖ ‖ ‖ ‖ ‖

results =  

3 ⋅ 10 4 1. 1.55 ⋅ 108

large lar gest st ≔ resu results lts

largest =  3 ⋅ 10 4

su sum m ≔ re resu sult ltss

sum = 1.5   ⋅ 10 8

0,0

0,1

alternative solution (for this problem)

i ≔  3 , 6 ‥ 3 ⋅  N 

  sum = 1. 1.5   5 ⋅ 108

  sum ≔  ∑ i i

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

3 ⋅ ∑ i = 1. 1.5   5 ⋅ 108

 N ⋅  N    +  1 3 ⋅  ―――  = 1.5⋅ 10 8 2

or 

i=  1

Finding roots

 f x

≔ 2 ⋅  x 2 −  4 ⋅sin   x −   2

x≔   1

 f x

,x =   1.725

x≔   −1

 f x

,x =   −0.423 x ≔  −1 , − −00.9 ‥ 2

4 3 2 1

 f x

0

marker added at 0 on vertical axis

0 -1 -2 -3 -4 -1

-0.5

0

0.5

1

1.5

2

x 4 of 6

Non-Commercial Use Only

MM/DD/YY

 

Full Name

S#

Solving a set of nonlinear equations   s   e   u    l   a    V   s   s   e   u    G

x≔   1 y≔   1

  s    t   n    i   a   r    t   s   n

x =  2 −  y 2

  o    C

y = ――  x

  r   e   v    l   o    S

sin x

+x⋅y ⎤ ⎡   x , y =  0.252 ⎣ 1.322 ⎦

solution ≔

x ≔ solution  

0

= 0.252

y ≔ solution  

1

= 1.322

Checking results (solving symbolically and plotting)

x,y  fa x

2

solve so lve , y

≔ x =  2 −  y ――→



x−   2 ⋅ 1i



x−   2 ⋅ 1i ⎦ solve solve , y sin   x

⎣−  fb x

⎞ ⎛ sin   x     + x ⋅ y ――→ −――― ≔ y = ―― x x ⋅  x −  1 ⎠ ⎝  fa x

1

= 1.322

 fb x

=   1.322

x ≔ 0.01 0.   01, 00.0 .055 ‥ 0.5 0.5 2 1.8

 fa x

1

1.6 1.4

 fb x

1.2 1 0

0.1

0.2

x

0.3

0.4

0.5

Iterative calculations with subscripts

i ≔  1 ‥ 20 x

i

≔x

i−   1

x y i

x

0

≔1

y

0

≔1

+2

i−  1

+x

≔ ―― 2

i

x

 

=

⎡ 1⎤ ⎢ 3⎥ ⎢ ⎥ ⎢ 5⎥ ⎢ 7⎥ ⎢⎢ 9 ⎥⎥ 11 ⎢ 13 ⎥ ⎣ ⋮⎦

y

=

⎡ 1⎤ ⎢ 2⎥ ⎢ ⎥ ⎢ 4⎥ ⎢ 6⎥ ⎢⎢ 8 ⎥⎥ 10 ⎢ 12 ⎥ ⎣ ⋮⎦

5 of 6

Non-Commercial Use Only

MM/DD/YY

 

Full Name

S#

Finding an optimal solution given constraints

 z  x , y   s   e   u    l   a    V   s   s   e   u    G   s    t   n    i   a   r    t   s   n   o    C

  r   e   v    l   o    S

2

≔ x −  1 − x ⋅  sin   y

x≔   1 y≔   1 x>   −2 x < 2  ⋅  y 2

+3

−3 <  y <  5  z_max_loc ≔

 

 z , x , y

⎡ ⎤ =  −2 ⎣ 1.571 ⎦

x ≔ z_max_loc  

= −2

y ≔ z_max_loc  

= 1.571

0

1

 z  x , y

=   11

6 of 6

Non-Commercial Use Only

MM/DD/YY

Sponsor Documents

Hide

Forgot your password?

Or register your new account on INBA.INFO

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close