1. Write procdeures in Maple[Solved]

Maple is really confusing and I need some help with writing some procedures. I don't know if anyone has ever used it, but if you did and know how to write some procedures then please help me with writing the Newton's Method as a procedure on Maple. I am attempting to use loop and and the first line will be Newton:=proc(f,x1,N).

Second is the procedure for computing area/net area. I will use the riemumm sum and same method byt not using loop this time. riemunn=proc(f,b,a).

2. I think most experienced posters here would've used it in some capacity.

This search will give you what you need.

3. It always helps to first write down your formulas and create a procedure from there. Then try to rewrite that procedure using Maple code.

4. Originally Posted by pickslides
I think most experienced posters here would've used it in some capacity.

This search will give you what you need.

I've actually tried google but your search got a better result than mine. Still need help with part of the procedure.

my book gives formula for x2 in terms of x1 and so forth.

y-f(x1) = f'(x1)(x-x1)
Since x-intercept is x2, i set y=0 and get 0-f(x1)=f'(x1)(x2-x1)

5. The easiest version of Newton's Method I know is

$\displaystyle x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}$.

You need to define your function $\displaystyle f(x)$ and your starting value $\displaystyle x_0$.

You will also need to tell the computer when you have reached your level of tolerance. So a while loop is probably better than a for loop, because then you don't need to choose a number of iterations, instead you will tell the computer a condition which will tell it when it can stop.

6. i just used the first link given to me by pickslides's google link. it worked but what is the "while f(x-0.5*0.1^n)*f(x+0.5*0.1^n)>0" part in

Newt:=proc (f,x0,n) local x; x:=x0; while f(x-0.5*0.1^n)*f(x+0.5*0.1^n)>0 do x:=x-f(x)/D(f)(x) od end:

i didn't see how the .5 and .1 numbers showed up in the equation/formula.

7. Originally Posted by hellfire127
i just used the first link given to me by pickslides's google link. it worked but what is the "while f(x-0.5*0.1^n)*f(x+0.5*0.1^n)>0" part in

Newt:=proc (f,x0,n) local x; x:=x0; while f(x-0.5*0.1^n)*f(x+0.5*0.1^n)>0 do x:=x-f(x)/D(f)(x) od end:

i didn't see how the .5 and .1 numbers showed up in the equation/formula.
Don't copy this procedure, try to create your own.

First off, how will you know if you have reached a desired level of tolerance? Once you have that, you can set up the while loop.

8. Originally Posted by Prove It
Don't copy this procedure, try to create your own.

First off, how will you know if you have reached a desired level of tolerance? Once you have that, you can set up the while loop.
what do you mean by level of tolerance? i don't think we were ever taught to do that in maple.

9. Meaning, how will you know when you have reached your desired level of accuracy? e.g. 5 decimal places...

10. Originally Posted by Prove It
Meaning, how will you know when you have reached your desired level of accuracy? e.g. 5 decimal places...
when successive approximations xn and xn+1 agree to x decimal places correct?

11. Yes, but don't use $\displaystyle x$ to represent both the iterations and the number of iterations. Use some other letter for that.

So to start with, if you round the values of $\displaystyle x_{n + 1}$ and $\displaystyle x_n$ to say 5 decimal places, you can stop the loop when they're equal.

Maple has a rounding command, it's round(x). Unfortunately it only rounds to the nearest whole number. You can get around this though. Say you wanted 5 decimal places - if you multiplied each number by $\displaystyle 10^5$, it will put all the necessary digits before the decimal point, and do the rounding you want.

Therefore, your while statement would be something like

while(round(10^5*x[n+1]) <> round(10^5*x[n]))
commands...

Does that make sense? Of course, in your procedure, you'd define another variable to represent the number of decimal places you want to be accurate.

12. oh ok i see.

would the procedure for the riemann sum be done in a similar way? it's a bit different as i'll have to use a as left endpoint and b as endpoint in proc(f,b,a).

13. Hmmm, no I would say you would need a for loop for the Riemann sum, since you are going to choose a (large) number of subdivisions...

14. Originally Posted by Prove It
Hmmm, no I would say you would need a for loop for the Riemann sum, since you are going to choose a (large) number of subdivisions...
hmmm my teacher told me not to use loop.....

15. How else would you tell it to execute a succession of area calculations?

Page 1 of 2 12 Last