Java Trig Classes for Big Integers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cheetah

    Java Trig Classes for Big Integers

    Does anyone know of some public/open source implementations of Trig funtions
    - ie sin, cos, tan - for Java that operate with BigIntegers or BigDecimals.
    Even better would be a library which can add vectors. I'm starting with
    amplitudes and degrees, and need to add the vectors to come out with a
    final vector (amplitude).

    This kind of thing would be used in Quantum Mechanics/QED for example
    perhaps to calculate probabilities. I'm using it for something similar.

    I have already googled for a answer and havn't found anything, and I think
    I've come to the right news groups - as I can't see any comp.math or
    math.comp groups.

    Regards,

    Peter
  • Glen Herrmannsfeldt

    #2
    Re: Java Trig Classes for Big Integers


    "Cheetah" <mrspam@nothing butnet.co.nz> wrote in message
    news:qEvhb.119$ ws.10649@news02 .tsnz.net...[color=blue]
    > Does anyone know of some public/open source implementations of Trig[/color]
    funtions[color=blue]
    > - ie sin, cos, tan - for Java that operate with BigIntegers or[/color]
    BigDecimals.[color=blue]
    > Even better would be a library which can add vectors. I'm starting with
    > amplitudes and degrees, and need to add the vectors to come out with a
    > final vector (amplitude).
    >
    > This kind of thing would be used in Quantum Mechanics/QED for example
    > perhaps to calculate probabilities. I'm using it for something similar.
    >
    > I have already googled for a answer and havn't found anything, and I think
    > I've come to the right news groups - as I can't see any comp.math or
    > math.comp groups.[/color]

    Most, though not all, quantum calculations can be done with double.
    BigInteger would be inconvenient, as the sin would always be zero. (There
    are no integer values of radians for which sin() is -1 or 1.)

    Doing trigonometry using decimal arithmetic would be a little slow, though
    possible. BigBinary, if it exists, would be a more likely place to look.

    How many digits do you actually want?

    -- glen


    Comment

    • Cheetah

      #3
      Re: Java Trig Classes for Big Integers

      Glen Herrmannsfeldt wrote:
      [color=blue]
      > How many digits do you actually want?
      >
      > -- glen[/color]

      The simulation I'm doing can create numbers of a few hundred digits long
      easily. They are always integers. For example, there are six states, each
      state has an integer value and a angle. I need to add all six
      states/vectors together to find the final vector.

      Oh - I resorted to using the standard Math functions. It turned out accurate
      enough for my purposes.

      Regards,
      Peter

      Comment

      Working...