Giter Site home page Giter Site logo

Double check atan2 usage about shampoo HOT 5 OPEN

bmorris3 avatar bmorris3 commented on August 25, 2024
Double check atan2 usage

from shampoo.

Comments (5)

LaurentRDC avatar LaurentRDC commented on August 25, 2024

Is arctan significantly faster than arctan2?

from shampoo.

bmorris3 avatar bmorris3 commented on August 25, 2024

I don't know, @jkentwallace had opinions though.

from shampoo.

jkentwallace avatar jkentwallace commented on August 25, 2024

LaurentRDC and bmorris3, I was concerned not so much about efficiency. Reading through Emilio's original writeup, (in which he used Matlab) he had a comment about using atan(z) vs atan2(y,x). Problem is that atan only goes from -p/2 to +pi/2, whereas atan2 goes from -pi to pi. (That's because in the ratio of x/y = z, not knowing the sign of x and/or y precludes getting the angle in the correct quadrant.)

Quick question: does python support a function called Arg[a + i b]? Arg[] will return the phase angle of a complex number.

from shampoo.

bmorris3 avatar bmorris3 commented on August 25, 2024

@jkentwallace I believe what you're looking for is implemented in numpy.angle, which returns

the counterclockwise angle from the positive real axis on the complex plane

from shampoo.

jkentwallace avatar jkentwallace commented on August 25, 2024

Yes! That's it. Basically, this is the same as atan2. However, for those who might be lazy - ahem - you don't need to do atan2[imaginary,real], but just np.angle([]) instead.

Just a thought...

from shampoo.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.