Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Math Help - Write procdeures in Maple

  1. #1
    Junior Member
    Joined
    Oct 2010
    Posts
    43

    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).
    Last edited by hellfire127; November 11th 2010 at 08:21 PM.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Master Of Puppets
    pickslides's Avatar
    Joined
    Sep 2008
    From
    Melbourne
    Posts
    5,236
    Thanks
    28
    I think most experienced posters here would've used it in some capacity.

    This search will give you what you need.

    Google
    Follow Math Help Forum on Facebook and Google+

  3. #3
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,407
    Thanks
    1294
    It always helps to first write down your formulas and create a procedure from there. Then try to rewrite that procedure using Maple code.

    So to start with, what is the Newton's Method formula?
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Junior Member
    Joined
    Oct 2010
    Posts
    43
    Quote Originally Posted by pickslides View Post
    I think most experienced posters here would've used it in some capacity.

    This search will give you what you need.

    Google
    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)
    Follow Math Help Forum on Facebook and Google+

  5. #5
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,407
    Thanks
    1294
    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.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Junior Member
    Joined
    Oct 2010
    Posts
    43
    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.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,407
    Thanks
    1294
    Quote Originally Posted by hellfire127 View Post
    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.
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Junior Member
    Joined
    Oct 2010
    Posts
    43
    Quote Originally Posted by Prove It View Post
    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.
    Follow Math Help Forum on Facebook and Google+

  9. #9
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,407
    Thanks
    1294
    Meaning, how will you know when you have reached your desired level of accuracy? e.g. 5 decimal places...
    Follow Math Help Forum on Facebook and Google+

  10. #10
    Junior Member
    Joined
    Oct 2010
    Posts
    43
    Quote Originally Posted by Prove It View Post
    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?
    Follow Math Help Forum on Facebook and Google+

  11. #11
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,407
    Thanks
    1294
    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.
    Follow Math Help Forum on Facebook and Google+

  12. #12
    Junior Member
    Joined
    Oct 2010
    Posts
    43
    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).
    Follow Math Help Forum on Facebook and Google+

  13. #13
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,407
    Thanks
    1294
    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...
    Follow Math Help Forum on Facebook and Google+

  14. #14
    Junior Member
    Joined
    Oct 2010
    Posts
    43
    Quote Originally Posted by Prove It View Post
    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.....
    Follow Math Help Forum on Facebook and Google+

  15. #15
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,407
    Thanks
    1294
    How else would you tell it to execute a succession of area calculations?
    Follow Math Help Forum on Facebook and Google+

Page 1 of 2 12 LastLast

Similar Math Help Forum Discussions

  1. Replies: 0
    Last Post: November 30th 2011, 02:25 PM
  2. Maple
    Posted in the Math Software Forum
    Replies: 0
    Last Post: November 19th 2010, 05:32 AM
  3. ODE in Maple
    Posted in the Math Software Forum
    Replies: 5
    Last Post: June 24th 2009, 07:29 AM
  4. Maple 11 help!
    Posted in the Calculus Forum
    Replies: 2
    Last Post: November 30th 2007, 06:09 AM
  5. Replies: 7
    Last Post: January 3rd 2007, 03:55 AM

Search Tags


/mathhelpforum @mathhelpforum