R中是否有符号ODE求解器? (ODE =常微分方程) [英] Is there symbolic ODE solver in R ? (ODE = ordinary differential equation)

查看:548
本文介绍了R中是否有符号ODE求解器? (ODE =常微分方程)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:R中是否存在符号ODE求解器? (ODE = 常微分方程

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

恐怕没有...但是让我向专家确认...

I am afraid there is NO... but let me confirm from experts ...

例如,解决:

> (5x-6)^2 y' = 5(5x-6) y - 2

这里: y-未知函数,y'-其导数

Here: y - unknown function, y' - its derivative

(易于解决:y = 1 /(5(5x-6))+ C *( 5x-6),但我想从R中得到答案。

(It is easy to solve by hands: y = 1/(5(5x-6)) + C* (5x-6) , but I want to get that answer from R).

我所知道的:

1)有数字(非符号)求解器:

我知道有数字ODE求解器,例如library(deSolve),
参见此处的答案:
R语言能否找到一阶微分方程的通用解?

I know there are numerical ODE solvers like library(deSolve), see answer here: Can R language find a generic solution of the first order differential equation?

2)有符号包:(但它们似乎不包含ODE求解器)

2) There are symbolic packages : (but they do not seem to contain ODE solvers)

R中有符号包,例如
,请参见Ryacas和rSymPy,以及b中的一些基本符号计算ase R,请参阅:
https://stats.stackexchange.com/questions / 4775 / symbolic-computation-in-r / 4778

There are symbolic packages in R like see Ryacas and rSymPy and also some basic symbolic calculation in base R, see: https://stats.stackexchange.com/questions/4775/symbolic-computation-in-r/4778

3)R的各种微分方程求解器的简要概述
https://cran.r-project.org/web/ views / DifferentialEquations.html

但是我找不到sumbolic ODE求解器((((

However I was unable to find sumbolic ODE solvers (((

推荐答案

我曾经玩过 Ryacas ,实际上,您可以得到一些简单ODE的符号解决方案,而无需太多的工作。不幸的是,YACAS无法为您的示例ODE找到解决方案。但是,根据您正在探索的ODE,这可能仍然有用。如果没有,那么我很乐意删除该帖子。

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.

作为一个简单的初始示例,让我们考虑以下ODE: y ''+ y = 0

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


  1. 加载库

  1. Load the library

    library(Ryacas);


  • 因为 Ryacas 只是一个与YACAS的接口,我们可以使用YACAS' OdeSolve 来解决ODE

  • 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)))
    

    这给出了正确的解决方案 const * exp(-ix)+ const * exp(+ ix)

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

    不幸的是,在使用您的特定示例时, OdeSolve 找不到解决方案:

    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)
    

    当我们使用 YACAS在线演示时,也会发生同样的情况。 。

    The same happens when we use the YACAS online demo.

    这篇关于R中是否有符号ODE求解器? (ODE =常微分方程)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆