Hacker Newsnew | past | comments | ask | show | jobs | submit | barakstout's commentslogin

I think we can't have a web today without JavaScript. We keep trying to go back to what things were, instead of moving forward and excepting the web for what it is.


I had a very good teacher in high school. Years later, it seems like a second nature that was always there.


2 things.

1.You are correct about the potential for a SQL injection. User input should be checked before entered into a SQL statement. However, for learning purposes it was skipped.

2. There are free apps that wee allow you to take a web page and turn it into a kiosk app. Specifically in iOS6 you can block the home button and limit browsing to what ever website you want. The whole point is for low budget company who doe not want to invest the time or the money into an iOS or Android app.


In all truth, if the government wants your emails, they will get them. Emails can be subpoenaed by court. You can run your own secure mail server and all, but the communication can always be intercepted by a middle man. If you have the need for a truly secure email, encrypt the message, it doesn't really matter what service you use.


I am sure that can be arranged in the future, if one doesn't exist already.


I think anything above 2.6 is fair game. Then again, it depends on the system. I have been forced before to develop in python 2.4 and less for specific platforms.


All good valid points. The article gives a high overview but lacks on the detail. All these points are valid and some mentioned in the article. The author mentioned a few times that the for-loops should be replaced with while-loops based on convergence tolerance. As for the bisection interval, I am not sure the basic c=(a+b)/2 is not enough. Can you provide an example where it fails?


As for the bisection interval, I am not sure the basic c=(a+b)/2 is not enough. Can you provide an example where it fails?

Sure. I've experienced this myself, for example, when doing the research cited here: http://pubs.acs.org/doi/abs/10.1021/es202359j Unfortunately, my Lab doesn't have our report version of the work up on the web yet (I believe it should be freely available at some point, but they're re-doing the library).

In addition, I knew about this particular effect before I started that work, so I must have run into it earlier.

In most cases, naive bisection works fine. That's especially true if you use pretty loose tolerances-- for example, you if only want to identify the zero to a relative tolerance of 1e-6 or something coarse like that. But this work demanded very tight tolerances (because the output gets used in a time-marching numerical simulation that may iterate on time steps, and hence has to be very repeatable no matter what the initial condition). In this work, the relative tolerance was about 2e-15, and the absolute tolerance about 1e-18 (on a machine with double-precision epsilon about 2e-16).

By the way, if you're testing for convergence according to a bracket on the value, then you want to know (b-a) anyhow. So there's no reason not to go ahead and use it to bisect the interval as well.

Another interesting implementation detail-- at very tight relative tolerances, you also need to calculate the terminating bracket width based on the larger of |b| and |a|-- due to floating point effects, if you find the terminating bracket width by applying the relative tolerance to the smaller value, you can occasionally run into a problem where adding that width to one of a or b fails to change the estimated value.


I suspect when your near an overflow or underflow situation. If a+b > MAX_INT or MAX_FLOAT then it could end up lower than a


Wouldn't you consider that a very extreme situation? Also, I am not aware of a MAX_INT in python. As far as I know it is the limits of your memory. If you are trying to work with such big numbers you should really use something a little more than Python and Bisection.


Good point. I think you could use the standard python eval() instead of defining f. something like:

    f = 'x**3+x-1'
    x = 4
    eval(f)
It should work fine.


If it was more focused on math I would agree. However, the focus is on the solution rather the technique. It is a nice refresher to those who have seen the information before.


That is a very good option. Thanks!


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: