Grasshopper

algorithmic modeling for Rhino

I would like to create a Python component which will calculate the value of x by Newton's method:

http://en.wikipedia.org/wiki/Newton%27s_method

Basically here is what I want to do.

An example:

I input a value of 10, as x1 into function. Then:

F(x1) = x - ((x^2-612)/2*x) or if we for the x=10, we have:

F(x1) = 10 - ((10^2-612)/2*10) = 35.6

Then I want to compute the same function but for x = F(x1) which is in the upper case 36.6. Or in numbers:

F(x2) = 35.6 - ((35.6^2-612)/2*35.6) = 26.39550561

then:

F(x3) = 26.39550561 - ((26.39550561^2-612)/2*26.39550561) = 26.79063549

and so on for F(x4), F(x5)... up until (Fx100).

I already posted the same message in the "General Discussion" forums, and they told me Hoopsnake can do this. But I did not like it. It seems Python component could do this automatically. Or could it?

Thank you.

Views: 482

Replies to This Discussion

Hi Djordje,

this could be a very simple way to set this up in GhPython:

I attach the file here using the new GhPython component (version 0.5).

I hope this helps,

- Giulio
_________________
giulio@mcneel.com

Attachments:

Thank you Giulio.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service