## 4 Badges

10 years, 170 days

## Newtons method to Secant method in maple...

Im have alittle trouble with my secant method code. and was wondering if could get some help on the matter.

Secant:=proc(f,x0,tol)
fp=diff(f,x);
fp2=diff(f,x)-1;
guess0=x0;
guess1:=evalf(guess0-subs(x=guess0,fp)/subs(x=guess0,limit((fp-fp2)/guess0-guess1),x=guess1)); count:=1;
while abs(guess0-guess1)>tol do
guess0:=guess1;
guess1:=evalf(guess0-subs(x=guess0,fp)/subs(x=guess0,limit((fp-fp2)/guess0-guess1),x=guess1)); count:=count+1;
end;
guess1;count;
end:

im sort of new with numercal analysis.

## Taylor series: plot and check...

i wanted a taylor series  of the expression sin(xy) my code;

mtaylor(sin(x*y),[x=1,y=2],6); and it worked like a charm

sin(2)+2*cos(2)*(x-1)+cos(2)*(y-2)-2*sin(2)*(x-1)^2+(-2*sin(2)+cos(2))*(y-2)*(x-1)-(1/2)*sin(2)*(y-2)^2-(4/3)*cos(2)*(x-1)^3+(-2*sin(2)-2*cos(2))*(y-2)*(x-1)^2+(-sin(2)-cos(2))*(y-2)^2*(x-1)-(1/6)*cos(2)*(y-2)^3+(2/3)*sin(2)*(x-1)^4+(-2*cos(2)+(4/3)*sin(2))*(y-2)*(x-1)^3+(-2*cos(2)+(1/2)*sin(2))*(y-2)^2*(x-1)^2+(-(1/2)*cos(2)+(1/3)*sin(2))*(y-2)^3*(x-1)+(1/24)*sin(2)*(y-2)^4+(4/15)*cos(2)*(x-1)^5+((4/3)*sin(2)+(2/3)*cos(2))*(y-2)*(x-1)^4+(-(1/3)*cos(2)+2*sin(2))*(y-2)^2*(x-1)^3+(-(1/6)*cos(2)+sin(2))*(y-2)^3*(x-1)^2+((1/12)*cos(2)+(1/6)*sin(2))*(y-2)^4*(x-1)+(1/120)*cos(2)*(y-2)^5

now i need to plot the darn thing. so i tried to use tayplot function but i get nothing. is there a special package i need to use tayplot etc..?

## display grades operation....

Maple

im trying to input a number between 0-100 and have the operation return the grade a,b,c,d,f. etc though long i though this might work.

Grades:=proc(x)
local a,b,c,d,f;
a:=(100..89.5);
b:=(89.4..79.5);
c:=(79.4..69.5);
d:=(69.4..59.5);
f:=(59.4..0);
if x=(100..89.5) then
display(a);
else
if x=(89.4..79.5)then
display(b);
else
if x=(79.4..69.5) then
display(c);
else
if x=(69.4..59.5) then
display(d);
else
if x=(59.4..0) then
display(f)
end;
end;
end;
end;
end;
end;

## if then statement problem...

Maple 17

count the number of primes less than using an if-then statement.  Implement your code where j goes from 2 to 15.

im at a loss i need a little nudge in the right direction.

## IF then statement with nested loop....

Rewrite the code that counts the number of primes less than using an if-then statement.  Implement    your code where j goes from 2 to 15.

j:=1;
1
for i from 2 to 10
while ithprime(j)<2^i do
j:=j+1
end:
print(2^i,primes=j-1):
2048, primes = 9

I need to edit this code to satisfy a IF then Statement. can any one help me out?

\

regards "Geordi"

 1 2 Page 1 of 2
﻿