Question: how do i solved numerically?

Hello everyone. does anyone please correct my worksheet? I
 

restart

E := 1/e^5

S := 1/e^5

f := proc (x) options operator, arrow; x^2-2 end proc

proc (x) options operator, arrow; x^2-2 end proc

(1)

a := 1

1

(2)

b := 2

2

(3)

"while b-a>=S or (abs(f(a))>=E and abs(abs(f(b))>=E)                                                                                       "

Error, unable to match delimiters

"while b-a>=S or (abs(f(a))>=E and abs(abs(f(b))>=E)"

 

"do"

Error, unable to parse

"do"

 

"if (f(x[a])-f(x[b])=0)"

Error, invalid 'if' statement

"if (f(x[a])-f(x[b])=0)"

 

print(Method*fail)

Method*fail

(4)

break

Error, break or next not in loop

 

"fi;"

Error, unable to parse

"fi;"

 

c := b-f(b)*(b-a)/(f(b)-f(a))

4/3

(5)

"if f(c)<E then"

Error, unterminated 'if' statement

"if f(c)<E then"

 

break

Error, break or next not in loop

 

"elif f(a) f(c)<0 then"

Error, unable to parse

"elif f(a) f(c)<0 then"

 

b := c

4/3

(6)

"else"

Error, unable to parse

"else"

 

a := c

4/3

(7)

"end if;"

Error, unable to parse

"end if;"

 

"end do;"

Error, unable to parse

"end do;"

 

[a, b]

[4/3, 4/3]

(8)

abs(f(a))

2/9

(9)

abs(f(b))

2/9

(10)

``


 

Download Method.mw

am trying to solve but could not get the required answer

Please Wait...