## 433 Reputation

15 years, 132 days

## Thank you...

Thank you for the explanation. So i would get a more accurate time if i use 'time()' instead of 'time[real]'. I'll try just time and see what happens. Thanks again

## Thank u...

This way is much better. I didn't know that the whole code is needed inside the time[real](). The time still changes tho but it dosen't matter as long as it gives an accurate time.

Thank you for the help much appriciated

## Thank u...

This way is much better. I didn't know that the whole code is needed inside the time[real](). The time still changes tho but it dosen't matter as long as it gives an accurate time.

Thank you for the help much appriciated

## Huh?Sorry...

Sorry i am still  very new to maple. Can you plz explain what you mean by 'more steps' and 'worming up'. I don't understand.

## Huh?Sorry...

Sorry i am still  very new to maple. Can you plz explain what you mean by 'more steps' and 'worming up'. I don't understand.

## Gt it working...

I gt the procedure working fully now i had to add another loop and add i:=nops(o): for the loop to stop.

Thank u Scott for ur assistance

## Gt it working...

I gt the procedure working fully now i had to add another loop and add i:=nops(o): for the loop to stop.

Thank u Scott for ur assistance

## wots wrong?...

Thank u for ur reply. I had an attempt at making a nth section procedure but there is a problem in the loop.

restart:
n:=3:
a:=3:
b:=5:
f:=x->x^2 - 2*x - 11:

L:=[seq((i*b+a*(n-i))/n,i=1..n)];
M:=[a,op(L)];
o:=[seq(evalf((M[i])),i=1..n+1)];

for i from 1 to (nops(o)-1) do
f (o[i]) * f(o[i+1]) < 0:
if sign(f(o[i])) * sign(f(o[i+1])) < 0 then
a:=o[i]:
b:=o[i+1]:
fi:
od;

this returns an nothing not even an error what have i done wrong?

P.s. this is not the procedure i want to get the program working properly first before i put it in a procedure.

## wots wrong?...

Thank u for ur reply. I had an attempt at making a nth section procedure but there is a problem in the loop.

restart:
n:=3:
a:=3:
b:=5:
f:=x->x^2 - 2*x - 11:

L:=[seq((i*b+a*(n-i))/n,i=1..n)];
M:=[a,op(L)];
o:=[seq(evalf((M[i])),i=1..n+1)];

for i from 1 to (nops(o)-1) do
f (o[i]) * f(o[i+1]) < 0:
if sign(f(o[i])) * sign(f(o[i+1])) < 0 then
a:=o[i]:
b:=o[i+1]:
fi:
od;

this returns an nothing not even an error what have i done wrong?

P.s. this is not the procedure i want to get the program working properly first before i put it in a procedure.

## Thank you djs...

thank u very much 4 ur help.

I don't understand y i keep on getting the answer

x = H( t - 2 ) ( ( e ^ - 4 ( t - 2 ) + e ^ - ( t - 2) ) / 3 ) - 4 / 3 e ^ - 4 ( t - 2 ) + 10 / 3 e ^ - ( t - 2 )

when i do it by hand. I must have made a mistake wen i done the partial fractions. I'll check that

thnx

## Thank you djs...

thank u very much 4 ur help.

I don't understand y i keep on getting the answer

x = H( t - 2 ) ( ( e ^ - 4 ( t - 2 ) + e ^ - ( t - 2) ) / 3 ) - 4 / 3 e ^ - 4 ( t - 2 ) + 10 / 3 e ^ - ( t - 2 )

when i do it by hand. I must have made a mistake wen i done the partial fractions. I'll check that

thnx

## Is My code correct???...

This code seems to work can sm1 plz tell me if its correct.

restart:
n:=3:
s:=Matrix([[2,1/3,-2/3],[-5/4,-5,5/4],[21/5,-14/5,7]]):
b:=[2/3,-15/2,98/5]:
X:=[0,0,0]:
maxitr:=11:

for k from 1 to maxitr do
print(`Iteration number`);
k;
print(`Previous iteration value`);
X_0:=X;

for i from 1 to n do

summ:=0.0:

for j from 1 to n do

if (i<>j) then
summ:=summ + (s[i,j]*X[j]);

end if;
end do:

X[i]:=(b[i]-summ)/s(i,i);
end do;

print(`new iterative value`);
X;
end do;

## Is My code correct???...

This code seems to work can sm1 plz tell me if its correct.

restart:
n:=3:
s:=Matrix([[2,1/3,-2/3],[-5/4,-5,5/4],[21/5,-14/5,7]]):
b:=[2/3,-15/2,98/5]:
X:=[0,0,0]:
maxitr:=11:

for k from 1 to maxitr do
print(`Iteration number`);
k;
print(`Previous iteration value`);
X_0:=X;

for i from 1 to n do

summ:=0.0:

for j from 1 to n do

if (i<>j) then
summ:=summ + (s[i,j]*X[j]);

end if;
end do:

X[i]:=(b[i]-summ)/s(i,i);
end do;

print(`new iterative value`);
X;
end do;

## sorry ...

that was a miss print. this is the problem

restart:
NEWTON_RAPH:= proc(f,z,M)
local x,A:
x := z:
for A to M do:
x := (x -(f(x)/D(f)(x)) -((((D@@2)(f))*((f(x))^2))/(2*(D(f)(x))^3)))
end do:
evalf(x):
end proc:
f:= x-> x^2-5:
NEWTON_RAPH(f,1,10);
1.

## sorry ...

that was a miss print. this is the problem

restart:
NEWTON_RAPH:= proc(f,z,M)
local x,A:
x := z:
for A to M do:
x := (x -(f(x)/D(f)(x)) -((((D@@2)(f))*((f(x))^2))/(2*(D(f)(x))^3)))
end do:
evalf(x):
end proc:
f:= x-> x^2-5:
NEWTON_RAPH(f,1,10);
1.

 4 5 6 7 8 9 Page 6 of 9
﻿