Giter Site home page Giter Site logo

Euler's identity about nerdamer HOT 9 CLOSED

jiggzson avatar jiggzson commented on May 18, 2024
Euler's identity

from nerdamer.

Comments (9)

 avatar commented on May 18, 2024

More generally,I propose complex numbers shouldn't be in the core. Many of the functions written for real numbers don't apply the same way for complex numbers.

from nerdamer.

jiggzson avatar jiggzson commented on May 18, 2024

Why can't we write a test case for this identity? If we were to move complex numbers from the core then where would be a more appropriate place? An add-on?

from nerdamer.

 avatar commented on May 18, 2024

Fundamentally, when nerdamer's parser takes in an expression. It assumes the expression is in the set of real numbers. However, it doesn't account for complex numbers.

For example:
abs(i+1) doesn't do anything
cos(i+1) doesn't do anything

I guess we have to rewrite a lot of functions to take complex numbers

Also
(-1)^x => -1

Something is wrong with exponents.

from nerdamer.

jiggzson avatar jiggzson commented on May 18, 2024

I see what you mean. Wouldn't it just be better to extend the functions in the core to deal with those cases? I can't think of a way to deal with complex numbers any other way. (-1)^x is a bug and should be addressed.

from nerdamer.

 avatar commented on May 18, 2024

Ok, I agree to extend the core since Solve.js might use a lot of complex numbers.

from nerdamer.

 avatar commented on May 18, 2024

var e = nerdamer('e^x',{x:6}).evaluate();
console.log(e.valueOf());
"e^6"

It doesn't evaluate exponents at all.

from nerdamer.

jiggzson avatar jiggzson commented on May 18, 2024

You never specified what e is. Unless you're looking for the mathematical constant e. In that case it's accessed using capital letters (E). Same as for pi (PI). Also regarding detecting this identity and others. I think they should be checked for as an option since the overhead for detecting them might be a bit much.

from nerdamer.

 avatar commented on May 18, 2024

I made the mistake of not making capitalizing E.

I think the key for solving these bugs could be euler's identity.
Any equation (a+bi)^(f(x)) could be turned to exponential format to cartesian format.
(-1)^x => E^(i*PI*x) => cos(PI*x) + i*sin(PI*x)

Just turn everything into cartesian format at the end.

from nerdamer.

jiggzson avatar jiggzson commented on May 18, 2024

Brosnan, the issue should be closed. Let me know if the latest implementation solves your issue.

from nerdamer.

Related Issues (20)

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.