Is there symbolic ODE solver in R ? (ODE = ordinary differential equation)

自作多情 提交于 2019-12-09 08:03:30

I've had a play around with Ryacas, and you can in fact get symbolic solutions to some simple ODEs without too much work. Unfortunately, YACAS fails to find a solution for your example ODE. However, depending on the ODEs you are exploring, this might still be of use. If not, I'm happy to remove this post.

As an initial simple example, let's consider the following ODE: y'' + y = 0:

  1. Load the library

        library(Ryacas);
    
  2. Since Ryacas is just an interface to YACAS, we can use YACAS' OdeSolve to solve the ODE

    yacas("OdeSolve( y\'\' + y == 0 )")
    #expression(C70 * exp(x * complex_cartesian(0, -1)) + C74 * exp(x *
    #    complex_cartesian(0, 1)))
    

    This gives the correct solution const * exp(- ix) + const * exp(+ ix).

  3. Unfortunately when using your particular example, OdeSolve fails to find a solution:

    yacas("OdeSolve( y\'\' == (5 * (5 * x - 6) * y - 2) / (5 * x - 6)^2 )")
    #expression(y(2) - (5 * ((5 * x - 6) * y(0)) - 2)/(5 * x - 6)^2)
    

    The same happens when we use the YACAS online demo.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!