Sample Solutions:

7
Sample Solutions: Calculate the integral with; a) Trapezoidal rule b) Simpson’s rule c) With computer (Visual Basic), take m=2, n=4. ? d ) cos( 1 5 . 0 a) Trapezoidal rule: Divide into for equal section between 0.5 and 1. 125 . 0 4 5 . 0 1 h 2 f f f f 2 f h I 4 3 2 1 0 TR k θ f 0 0.5 0.620 5 1 0.625 0.641 1 2 0.75 0.633 7 3 0.875 0.599 6 4 1 0.540 3 2 5403 . 0 5996 . 0 6337 . 0 6411 . 0 2 6205 . 0 125 . 0 I TR 3072 . 0 I TR

description

Sample Solutions:. Calculate the integral with; a) Trapezoidal rule b) Simpson’s rule c) With computer (Visual Basic), take m=2, n=4. a) Trapezoidal rule: Divide into for equal section between 0.5 and 1. Sample Solutions:. c) With computer (Visual Basic). Sub simpson_Click () - PowerPoint PPT Presentation

Transcript of Sample Solutions:

Page 1: Sample Solutions:

Sample Solutions:

Calculate the integral with;

a) Trapezoidal rule

b) Simpson’s rule

c) With computer (Visual Basic), take m=2, n=4.

?d)cos(1

5.0

a) Trapezoidal rule: Divide into for equal section between 0.5 and 1. 125.04

5.01h

2f

fff2f

hI 4321

0TR

k θ f

0 0.5 0.6205

1 0.625 0.6411

2 0.75 0.6337

3 0.875 0.5996

4 1 0.5403

25403.0

5996.06337.06411.02

6205.0125.0ITR

3072.0ITR

Page 2: Sample Solutions:

Sample Solutions:

43210S ff4f2f4f3h

I

b) Simpson’s rule:

5403.05996.0*46337.0*26411.0*46205.03125.0

IS

3085.0IS

with Matlab

>>I=int('sqrt(tet)*cos(tet)',0.5,1);vpa(I,5)

I=0.30796

Sub simpson_Click () 80 a = .5: b = 1: m = 2 … 85 f = Sqr(x) * Cos(x) …End Sub

c) With computer (Visual Basic)

Page 3: Sample Solutions:

Sample Solutions:

The pressure values of a fluid flowing in a pipe are given in the table for different locations . Find the pressure value for 5 m.

a) Lagrange interpolation (manually)

a) with computer

Location (m) 3 8 10

Pressure (atm) 7 6.2 6

a) with Lagrange interpolation

6*)810)(310(

)8x)(3x(2.6*

)108)(38()10x)(3x(

7*)103)(83()10x)(8x(

)x(p

6*)810)(310(

)85)(35(2.6*

)108)(38()105)(35(

7*)103)(83()105)(85(

)5(p

)atm(6286.6)x(p b) For computer solution, the file li.txt is arranged as follows and the code Lagr.I is run.

li.txt

3

3,7

8,6.2

10,6

5

Page 4: Sample Solutions:

Sample Solutions:

22

3

y1yx

1x3y)x2sin(

How do you find x and y values, which satisfy the equations?

1yyxf

1x3y)x2sin(f22

2

31

ff

2

1

2

1

22

11

ff

yf

xf

yf

xf

1y2yf

,x2xf

y3yf

,3)x2cos(2xf

22

211

Sub newtonrn_Click ()

40 n = 2 …41 xb(1) = 1: xb(2) = 1: xh(1) = .001: xh(2) = .001…45 '---- Error equations ----------- a(1, 1) = 2 * Cos(2 * xb(1)) - 3: a(1, 2) = 3 * xb(2) ^ 2 a(2, 1) = 2 * xb(1): a(2, 2) = 2 * xb(2) + 1 b(1) = -(Sin(2 * xb(1)) + xb(2) ^ 3 - 3 * xb(1) + 1) b(2) = -(xb(1) ^ 2 + xb(2) ^ 2 + xb(2) - 1)46 '--------------------…End Sub

x=0.6786

y=0.3885

with Matlab:

>>[x,y]=solve('sin(2*x)+y^3=3*x-1','x^2+y=1-y^2') x=0.6786, y=0.3885

Page 5: Sample Solutions:

Sample Solutions:

As a result of the equilibrium conditions, the equations given below are obtained for a truss system. How do you calculate the member forces FJD, FFD, FCD and FFC if FCK=6.157 kN and FCB=-3.888 kN are known?

0F707.0FF894.00F365.2F065.1F3

0738.1F447.0FF707.00466.0F894.0F707.0F

CKFCCD

FCCKJD

CBCDFD

CDFDJD

888.3F,157.6F CBCK

353.4557.6

0466.0

FFFF

1894.000365.200301707.000894.0707.01

FC

CD

FD

JD

A bF

b*AF 1b*)A(invF

Page 6: Sample Solutions:

Sample Solutions:

353.4557.6

0466.0

FFFF

1894.000365.200301707.000894.0707.01

FC

CD

FD

JD

A bF

with Matlabclc;clearA=[-1 -0.707 -0.894 0;0 -0.707 -1 0;3 0 0 2.365;0 0 0.894 1];b=[-0.466;0;-6.557;4.353];F=inv(A)*b

FJD= 1.5429 kNFFD= -14.3701 kNFCD= 10.1596 kNFFC= -4.7297 kN

Page 7: Sample Solutions:

Sample Solutions:

020t6t5t3 24 Find the roots of the polynomial.

with Matlab>> p=[3 0 5 6 -20]>> roots(p)

ans =

-1.5495 0.1829 + 1.8977i 0.1829 - 1.8977i 1.1838

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

-20

-10

0

10

20

30

40

50

60

t

3 t4+5 t2+6 t-20

1.1838-1.5495

>>ezplot('3*t^4+5*t^2+6*t-20',-2,2)