Algorithm which adapt (solve) the complex equations ( implicit function f(x,y) )

前端 未结 3 1962
傲寒
傲寒 2021-01-22 03:50

I\'m trying to adapt some equations (implicit f(x,y)) in order to be able list the Y for corresponding X-Value.
The equations could be e.g. as follows:

y^2 =         


        
相关标签:
3条回答
  • 2021-01-22 03:59

    There ia a possible solution for the general quintic equation, when you addapt the solutionmethod from Cardano for the general cubic equation and the solutionmethod from Ferrari for the general quartic equation.

    0 讨论(0)
  • 2021-01-22 04:11

    Hopefully I'm understanding your question correctly. Would nerdamer help? It can help solve algebraically up to a 3rd degree polynomial. The buildFunction method can be called to get a JS function which can be used for graphing. I use it in a somewhat similar manner on the project website in combination with function-plot.js

    var solutions = nerdamer('y^2=x^3+2x-3x*y').solveFor('y');
    //You'll get back two solutions since it's quadratic wrt to y
    console.log(solutions.toString());
    //You can then parse the solutions to native javascript function
    var f = nerdamer(solutions[0]).buildFunction();
    console.log(f.toString());
    
    /* Evaluate */
    var solutions = nerdamer('y^3*x^2=(x^2+y^2-1)').solveFor('y');
    console.log(solutions.toString());
    //You can then parse the solutions again to native javascript function
    var f = nerdamer(solutions[0]);
    var points = {};
    for(var i=1; i<10; i++)
        points[i] = f.evaluate({x: i}).text();
    
    console.log(points)
    <script src="http://nerdamer.com/js/nerdamer.core.js"></script>
    <script src="http://nerdamer.com/js/Algebra.js"></script>
    <script src="http://nerdamer.com/js/Calculus.js"></script>
    <script src="http://nerdamer.com/js/Solve.js"></script>

    You could always just evaluate. This is slower than a pure JS function but it might be what you need. You'll have to probably use a try catch block for division by zero.

    0 讨论(0)
  • 2021-01-22 04:16

    I'd like to point out that this problem cannot be solved exactly in general. The cited solution for the quadratic case (y^2) can be extended to the cubic case and quartic case (there are a general complicated solutions). But there is a math theorem (from Galois theory) that states that there is no general solution for the quintic equation (and so on). In your case, maximum degree is 3, so you can use the cubic equation from wikipedia. For the heart graphic write: x^2*y^3 - y^2 -(x^2-1) = 0 and treat x as constant. For the sqrt case, get rid of it. Square both sides of equation, isolate y and you end up with a quartic equation on y, that you can solve using wikipedia's quartic equation knowledge.

    Anyway, if you don't have a very strong reason to do this, don't do it, as the computer can solve this numerically for you. Standard approach is to calculate this implicitly, as in the plots you made.

    I hope this helps.

    0 讨论(0)
提交回复
热议问题