Displaying 20 results from an estimated 8000 matches similar to: "Substituting inside expression"
2011 Feb 28
3
Incorrectness of mean()
I have found following problem:
I have a vector:
> a <- c(1.04,1.04,1.05,1.04,1.04)
I want a mean of this vector:
> mean(a)
[1] 1.042
which is correct, but:
> mean(1.04,1.04,1.05,1.04,1.04)
[1] 1.04
gives an incorrect value.
how is this possible?
thanks,
zbynek
--
View this message in context: http://r.789695.n4.nabble.com/Incorrectness-of-mean-tp3327701p3327701.html
Sent from the R
2010 Sep 03
1
How to use lm() output for systemfit() 'Seemingly unrelated regression'
I am having problem using output of lm() function for further analysing using
systemfit package.
Basicaly, the problem s following - I generate several formulas using lm()
> fo1 <- lm(r98[,2] ~ f98[,1] + f98[,2] + ... + f98[,43])
> fo2 <- lm(r98[,1] ~ f98[,1] + f98[,2] + ... + f98[,43])
and than I want to estimate a general model using package systemfit.
> fitsur <-
2010 Dec 16
2
How can I draw a line in empirical distribution function?
I've got the graphic with this:
a=c(120,40,75,85,55,75,55,90,90,55,155)
plot(ecdf(a))
How can I draw lines to show the lower quatile and upper quartil?
I only know there is the argument lines(),
but I don't know how to use it
--
View this message in context: http://r.789695.n4.nabble.com/How-can-I-draw-a-line-in-empirical-distribution-function-tp3090675p3090675.html
Sent from the R
2010 Dec 20
2
How to optimize function parameters?
Hi,
I have a dataset and I want to fit a function to it.
The function is variogram model (http://en.wikipedia.org/wiki/Variogram)
The variogram model is defined by three parameters and I want them to be
automatically optimized for real time data.
I tried to use gafit {gafit} for this, but there are some data
configuration, where optimal results given by gafit() are negative, which is
not correct
2012 Mar 15
1
eigenvalues of matrices of partial derivatives with ryacas
Hello,
I am trying to construct two matrices, F and V, composed of partial
derivatives and then find the eigenvalues of F*Inverse(V). I have the
following equations in ryacas notation:
> library(Ryacas)
> FIh <- Expr("betah*Sh*Iv")
> FIv <- Expr("betav*Sv*Ih")
> VIh <- Expr("(muh + gamma)*Ih")
> VIv <- Expr("muv*Iv")
I
2010 May 05
3
Symbolic eigenvalues and eigenvectors
Let's say I had a matrix like this:
library(Ryacas)
x<-Sym("x")
m<-matrix(c(cos (x), sin(x), -sin(x), cos(x)), ncol=2)
How can I use R to obtain the eigenvalues and eigenvectors?
Thanks,
John
[[alternative HTML version deleted]]
2008 Sep 10
1
isolating X on an expression
Dear R-gurus,
I know that it is not a R problem, but as need
to implement some solution for this on R, I would
like to know if someone help me on how to isolate
X on the expression below.
K=(sen A * sen B ) + ( cos A * cos B * cos ( X - Y ) )
Any help are welcome
mitinho astronauta
brazil
[[alternative HTML version deleted]]
2012 Sep 04
3
Ryacas
I am having issues with Ryacas errors. I searched and found this error was
reported in 2006, but nothing since.
> library(Ryacas)
Loading required package: XML
> yacas(expression(Factor(x^2-1)))
[1] "Starting Yacas!"
CommandLine(1) : Expecting ) closing bracket for sub-expression, but got ^
instead
> yacas("D(x)Sin(x)")
CommandLine(1) : Expecting ) closing bracket
2007 Sep 03
2
Derivative of a Function Expression
Hi
I am currently (for pedagogical purposes) writing a simple numerical
analysis library in R. I have come unstuck when writing a simple
Newton-Raphson implementation, that looks like this:
f <- function(x) { 2*cos(x)^2 + 3*sin(x) + 0.5 }
root <- newton(f, tol=0.0001, N=20, a=1)
My issue is calculating the symbolic derivative of f() inside the newton()
function. I cant seem to get R to
2006 Nov 21
2
Symbolic derivation using D in package stats - how do I properly convert the returned call into a character string?
Dear all,
I am using the function 'D' in the 'stats' package to perform symbolic
derivation.
This works very well and it is much faster than e.g. Mathematica (at
least for my purposes).
First, I would like to thank the development team for this excellent
function.
However, I run into trouble in some cases, particularly when I am to do
some operations on long expressions
2006 Oct 16
2
New package Ryacas
Ryacas is an R interface to the free yacas computer algebra
system. Ryacas allows one to send R expressions,
unprocessed yacas strings and certain other R objects to a
separate yacas process from R and get back the result. It
also has facilities for manipulating yacas strings and R
expressions destined for yacas processing.
It can be used for exact arithmetic, symbolic math, ASCII
pretty
2006 Oct 16
2
New package Ryacas
Ryacas is an R interface to the free yacas computer algebra
system. Ryacas allows one to send R expressions,
unprocessed yacas strings and certain other R objects to a
separate yacas process from R and get back the result. It
also has facilities for manipulating yacas strings and R
expressions destined for yacas processing.
It can be used for exact arithmetic, symbolic math, ASCII
pretty
2006 Oct 16
2
New package Ryacas
Ryacas is an R interface to the free yacas computer algebra
system. Ryacas allows one to send R expressions,
unprocessed yacas strings and certain other R objects to a
separate yacas process from R and get back the result. It
also has facilities for manipulating yacas strings and R
expressions destined for yacas processing.
It can be used for exact arithmetic, symbolic math, ASCII
pretty
2006 Nov 23
4
Ryacas and fractions with simultaenously very large numerators and denominators
Dear All
I am doing the following:
> x <- yacas("3/2")
> for (i in 2:400)
+ x <- yacas(paste(x,"*",x))
> x
expression(Inf^1.260864167e+117/Inf^6.304320836e+116)
> Eval(x)
[1] NaN
No luck this way. However, I am successful with
> y <- yacas("(3/2)^400")
> y
expression(7.05507910865533e+190/2.58224987808691e+120)
> Eval(y)
[1]
2017 Sep 19
2
symbolic computing example with Ryacas
Hi all,
I am trying to implement the following matlab code with Ryacas :
syms U x x0 C
d1=diff(U/(1+exp(-(x-x0)/C)),x);
pretty(d1)
d2=diff(U/(1+exp(-(x-x0)/C)),x,2);
pretty(d2)
solx2 = solve(d2 == 0, x, 'Real', true)
pretty(solx2)
slope2=subs(d1,solx2)
I have tried the following :
library(Ryacas)
x <- Sym("x");U <- Sym("U");x0 <-
2007 Mar 12
2
Query about substituting characters in a df
Hi
I have a data frame with 40,000 rows and 4 columns,
one of which is "class".
For each row, the "class" column can be one of 10
possible NUMERIC values.
I wish to substitute these numeric values with
words/characters.
For example, I wish to substitute all occurences of
"5467" in the column "class" with "alpha", "7867" with
2017 Sep 19
1
symbolic computing example with Ryacas
Thanks for the response. Yes, I did study the vignette but did not
understand it fully. Anyway, I have tried once again now. I am happy to say
that I have got what I wanted.
library(Ryacas)
x <- Sym("x");U <- Sym("U");x0 <- Sym("x0");C <- Sym("C")
my_func <- function(x,U,x0,C) {
return (U/(1+exp(-(x-x0)/C)))}
FirstDeriv <-
2017 Sep 19
0
symbolic computing example with Ryacas
Have you studied the "Introduction to Ryacas" vignette that come with the
package?
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Tue, Sep 19, 2017 at 2:37 AM, Vivek Sutradhara <viveksutra at gmail.com>
wrote:
2013 Jun 19
2
Ryacas loads but yacas has an error
Hello yet again, R People:
I was working with Ryacas and yacas last night and all was well.
Now this morning, I keep getting the following:
> a <- Sym("a")
> a
Error in summary.connection(x) : invalid connection
>
When I go to yacas from the command line, it works fine.
Any suggestions, please?
I'm thinking that a port might be open, but here I have:
>
2013 Jun 19
2
evaluation of equations from Ryacas
Hello again.
Now I have the following:
> xx
[1] "Solve(1 - R/100==(2*y)/10000,R)"
> yacas(xx)
expression(list(R == 100 * (1 - 2 * y/10000)))
>
I would like to put in a value for y and obtain R.
I've tried more stuff with eval and Eval, but no luck yet.
Any suggestions would be much appreciated.
Thanks,
Erin
--
Erin Hodgess
Associate Professor
Department of Computer