Thursday, June 3, 2010

Re: mathsinh is not function

Wow, you guys are great.
I am also thinking about proj code, there is a java port:
http://svn.osgeo.org/metacrs/proj4j

The inverse projection here, it uses a different set of functions,

proj4j/trunk/src/main/java/org/osgeo/proj4j/proj/
MercatorProjection.java
http://geosysin.iict.ch/irstv-trac/browser/branches/libs/proj4j/src/main/java/org/osgeo/proj4j/proj/MercatorProjection.java?rev=8722

public ProjCoordinate projectInverse(double x, double y,
ProjCoordinate out) {
if (spherical) {
out.y = ProjectionMath.HALFPI - 2. *
Math.atan(Math.exp(-y / scaleFactor));
out.x = x / scaleFactor;
} else {
out.y = ProjectionMath.phi2(Math.exp(-y /
scaleFactor), e);
out.x = x / scaleFactor;
}
return out;
}

I will be testing those some day instead of the josm stuff, but right
now it seems to work just fine. Thanks for your great comments, I am
learning from reading them.

mike


On Jun 3, 5:30 pm, Eric <erjab...@gmail.com> wrote:
> I want to apologize to everyone for my lousy
> line-breaks. :-(  How do I send mail through
> gmail and have it wrap lines well?
>
> Brendan, they really did that?
>
> From user\super\com\google\gwt\emul\java\lang\Math.java
>
> % public static double expm1(double d) {
> %   if (d == 0.0 || Double.isNaN(d)) {
> %      return d; // "a zero with same sign as argument", arg is zero,
> so...
> %   } else if (!Double.isInfinite(d)) {
> %     if (d < 0.0d) {
> %       return -1.0d;
> %     } else {
> %       return Double.POSITIVE_INFINITY;
> %     }
> %   }
> %   return exp(d) + 1.0d;
> % }
>
> That isn't just poor practice; that's absolutely wrong!
>
> 1. The isInfinite check is reversed.
>
> 2. expm1(x) should be a better approximation to
> exp(x) -1 then is available with Math.exp. The 'm'
> stands for minus, and so the plus sign in
> exp(d) + 1.0d should be a minus sign.
> Fortunately, ths statement will be invoked only
> when d is infinite (because of the reversed check).
>
> Why do programmers insist on not checking reference
> works when writing mathematical software? Where
> were the tests?  The file has other numerical flaws.
> The hypot(double x, double y) method is one of them;
> if |x| >> |y| or the reverse, then this loses significant
> digits badly.
>
> I had wondered why the original poster was trying
> to compute the hyperbolic sine; mapping is a very
> good reason.  Brendan's right; using the naive
> method should be fine for your purposes. If you
> need to zoom so much that loss of accuracy
> would matter, you're at the level where Google
> Moon would show green cheese.
>
> Still, one should never lose significant digits _by
> accident_. That should always be a deliberate
> decision that the loss of accuracy is justifiable.
>
> Do look at the standard reference works, however:
>
> Map Projections: A Working Manual,
> by John P. Snyderhttp://pubs.er.usgs.gov/usgspubs/pp/pp1395
>
> The most important reference for mapping mathematics.
> The PDF is free too!
>
> Numerical Recipes, the Art of Scientific
> Computing,
> by Press, Teukolsky, Vetterling, and Flanneryhttp://www.nr.com/
>
> AMS 55,
> ed. Abromowitz and Stegunhttp://www.convertit.com/go/convertit/reference/ams55.asp
>
> The continued fractions in equation 4.2.40(2) and (3) on page 70
> should work well for expm1(x) with x small.
>
> Also look at its successor, the NIST Handbook of Mathematical
> Functions and the Digital Library of Mathematical Functions.
> Look at equation 4.9.3.http://dlmf.nist.gov/
>
> Numerical Methods that (Usually) Work
> by Forman Actonhttp://www.amazon.com/Numerical-Methods-that-Work-Spectrum/dp/0883854503
>
> Please look at how IMSL and other math libraries work
> before you try writing your own code.  Damn!
>
> Respectfully,
> Eric Jablow
>
> P.S. Sorry about the ranting; I used to be
> a mathematician.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate