4

我正在尝试Ryacas使用R. 这是发生了什么:

> install.packages("Ryacas")
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://www.stats.bris.ac.uk/R/bin/windows/contrib/2.14/Ryacas_0.2-11.zip'
Content type 'application/zip' length 263424 bytes (257 Kb)
opened URL
downloaded 257 Kb

package ‘Ryacas’ successfully unpacked and MD5 sums checked

The downloaded packages are in
    C:\Documents and Settings\yogcal\Local Settings\Temp\RtmpKeuu7m\downloaded_packages

然后我尝试加载Ryacas

> library(Ryacas)
Loading required package: XML
C:\Program Files\R\R-2.14.1\library\Ryacas\yacdir\yacas.exe 
   or C:\Program Files\R\R-2.14.1\library\Ryacas\yacdir\scripts.dat 
 not found.
Run yacasInstall() without arguments to install yacas.

那么我运行yacasInstall()

> yacasInstall()
trying URL 'http://ryacas.googlecode.com/files/yacas-1.0.63.zip'
Content type 'application/x-zip' length 746009 bytes (728 Kb)
opened URL
downloaded 728 Kb

然后当我尝试一个例子时:

> library(Ryacas)
> yacas("TeXForm(3 * x^2/(2 * (x + 1)) - (x^3) * 2/(2 * (x + 1))^2)", 
+  retclass = "unquote")
[1] "Starting Yacas!"
Error in socketConnection(host = "127.0.0.1", port = 9734, server = FALSE,  : 
  cannot open the connection
In addition: Warning message:
In socketConnection(host = "127.0.0.1", port = 9734, server = FALSE,  :
  127.0.0.1:9734 cannot be opened
> 

这里出了什么问题?

非常感谢...

4

2 回答 2

0

解决问题的一种方法是确保端口是打开的:

1) 点击窗口Start

2) 点击All Programs

3) 点击 Accessories

4) 点击Command Prompt打开一个DOS窗口

5)通过键入将目录更改为yacas.exe所在的目录(可能是C:\Program Files\yacas\winrel)cd C:\Program Files\yacas\winrel

6) 通过键入使用服务器启动 yacasyacas --server 9734

7) Yacas 应该给你以下反馈Accepting requests from port 9734

如果到目前为止一切正常,那么 yacas 正在运行并准备好说话。现在,您可以运行您的 R 代码。如果它不起作用,那么你的 yacas 有问题。

于 2012-02-06T22:27:27.317 回答
0

两种可能性: 1) Yacas 从未开始。(R 不会为您加载 Yacas。) 2) 连接被阻止。假设您从操作系统启动 Yacas,那么您需要使用安全管理工具打开该端口。这不是 R 问题,而是操作系统/防火墙问题。

我可能错了需要从开始菜单启动 Yacas。这是代码:

runYacas()
### You should not need to type any of what follows. Just use the command above.
runYacas <- function(method = "system", yacas.args = "", yacas.init = "") {
   cmd <- yacasInvokeString(method = method, yacas.args = yacas.args, yacas.init = yacas.init)
   if (.Platform$OS.type == "windows") 
      system(cmd, wait = FALSE, invisible = FALSE)
   else system(cmd, wait = FALSE)
}

由于它似乎调用了系统,我会在你的 R 提示符下尝试。

于 2012-01-09T20:20:24.283 回答