similar to: How to solve difficult equations?

Displaying 20 results from an estimated 2000 matches similar to: "How to solve difficult equations?"

2008 Dec 02
3
How to solve following equation?
I need to solve a equation like this : a = b/(1+x) + c/(1+x)^2 + d/(1+x)^3 where a,b,c,d are known constant. Is there any R-way to do that? Thanks in advance -- View this message in context: http://www.nabble.com/How-to-solve-following-equation--tp20785063p20785063.html Sent from the R help mailing list archive at Nabble.com.
2008 Dec 31
1
uniroot() problem
I have a strange problem with uniroot() function. Here is the result : > uniroot(th, c(-20, 20)) $root [1] 4.216521e-05 $f.root [1] 16.66423 $iter [1] 27 $estim.prec [1] 6.103516e-05 Pls forgive for not reproducing whole code, here my question is how "f.root" can be 16.66423? As it is finding root of a function, it must be near Zero. Am I missing something? -- View this message
2018 Jul 30
2
trace in uniroot() ?
In looking at rootfinding for the histoRicalg project (see gitlab.com/nashjc/histoRicalg), I thought I would check how uniroot() solves some problems. The following short example ff <- function(x){ exp(0.5*x) - 2 } ff(2) ff(1) uniroot(ff, 0, 10) uniroot(ff, c(0, 10), trace=1) uniroot(ff, c(0, 10), trace=TRUE) shows that the trace parameter, as described in the Rd file, does not seem to be
2008 Jul 31
3
Code to calculate internal rate of return
Hi all. I am an R newbie and trying to grasp how the simple optimization routines in R work. Specifically, I would like some guidance on how to set up a code to calculate the internal rate of return on an investment project (http://en.wikipedia.org/wiki/Internal_rate_of_return). My main problem (I think) is that I want a generic code where N (number of periods) can be easily changed and set
2004 Nov 01
2
non-linear solve?
hi: could someone please point me to a function that allows me to solve general non-linear functions? > irr.in <- function(r, c1, c2, c3 ) { return(c1+c2/(1+r) + c3/(1+r)^2); } > solve.nonlinear( irr.in, -100, 60, 70 ); 0.189 If someone has written an irr function, this would be helpful, too---though not difficult to write, either. thanks for any pointers. Regards, /iaw
2023 Feb 18
1
uniroot violates bounds?
I wrote first cut at unirootR for Martin M and he revised and put in Rmpfr. The following extends Ben's example, but adds the unirootR with trace output. c1 <- 4469.822 c2 <- 572.3413 f <- function(x) { c1/x - c2/(1-x) }; uniroot(f, c(1e-6, 1)) uniroot(f, c(1e-6, 1)) library(Rmpfr) unirootR(f, c(1e-6, 1), extendInt="no", trace=1) This gives more detail on the iterations,
2012 Apr 07
1
Uniroot error
Dear All I am trying to find a uniroot of a function within another function (see example) but I am getting an error message (f()values at end points not of opposite sign). I was wondering if you would be able to advise how redefine my function so that I can find the solution. In short my first function calculates the intergrale which is function of "t" , I need to find the uniroot of
2023 Feb 20
1
uniroot violates bounds?
Le 18/02/2023 ? 21:44, J C Nash a ?crit?: > I wrote first cut at unirootR for Martin M and he revised and put in > Rmpfr. > > The following extends Ben's example, but adds the unirootR with trace > output. > > c1 <- 4469.822 > c2 <- 572.3413 > f <- function(x) { c1/x - c2/(1-x) }; uniroot(f, c(1e-6, 1)) > uniroot(f, c(1e-6, 1)) > library(Rmpfr) >
2010 Aug 12
2
Derivative
How would I numerically find the x value where the derivative of the function below is zero? x <- seq(1,2, by = .01) y <- 5*cos(2*x)-2*x*sin(2*x) plot(x,abs(y), type = "l", ylab = "|y|")
2000 Sep 20
1
integration in R?
I have the following problem. inf p= Int [dnorm(x-d) * pnorm(x) ^ (m-1)] dx -inf Given p and m, I want to find d. For example, p m d .9 2 1.81 Is there a way to solve this problem in R? Ideally I would have a function with arguments p and m, and output d. Thanks very much for any help. Bill -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing
2018 Aug 13
1
trace in uniroot() ?
Despite my years with R, I didn't know about trace(). Thanks. However, my decades in the minimization and root finding game make me like having a trace that gives some info on the operation, the argument and the current function value. I've usually found glitches are a result of things like >= rather than > in tests etc., and knowing what was done is the quickest way to get there.
2010 Jun 13
2
help with R
Hi all, I want to solve the following equation for x with rho <- 0.5 pnorm(-x)*pnorm((rho*dnorm(x)/pnorm(x)-x)/sqrt(1-rho^2))==0.05 Is there a function in R to do this? Thank you very much! Hannah [[alternative HTML version deleted]]
2007 Sep 19
2
how to find "p" in binomial(n,p)
I think the function you need is 'help.search'; try: help.search("binomial") and look for something obvious in the 'stats' package. A good deal quicker and easier than posting to an internet forum! Cheers, Mike. cathelf wrote: > > Dear all, > > I am trying a find the value "p" in binomial. > > X ~ Bin(n,p) > > I want to find the
2008 Jul 19
2
How to solve systems of nonlinear equations in R?
Hey, I was wondering if there existed a R function similar to 'fsolve' or 'fzero' Matlab functions? Thanks! Francois Aucoin [[alternative HTML version deleted]]
2006 Oct 27
1
making uniroot a bit more robust?
Hi, I wonder if it would make sense to make uniroot detect zeros at the endpoints, eg if f(lower)==0, return lower as the root, else if f(upper)==0, return upper as the root, else stop if f(upper)*f(lower) > 0 (currently it stops if >=), else proceed to the algorithm proper. Currently I am using a wrapper function to implement this, and I found it useful. But I didn't want to send a
2010 Sep 02
3
Simultaneous equations
Dear all, I am relatively new to R and have had some difficulty in understanding the user manual for a package that I have downloaded to evaluate non-linear simultaneous equations. The package is called systemfit. Does anyone have any experience of this package? What I am trying to do is solve a non linear simultaneous equations... Could anyone give me an example (please) of the code that
2005 Jul 03
2
over/under flow
I am porting some FORTRAN to R in which an Inf triggers an if(). The trigger is infinite on exp(lgamma(OVER)). What is the canonical R style of determining OVER when exp(OVER)== Inf? The code structure that I am porting is best left intact--so I need to query R somehow to the value of OVER that causes exp(lgamma(OVER)) to equal Inf. On my system, exp(lgamma(171)) is about first to equal Inf.
2010 Sep 24
1
Solving equations involving gamma functions
Hi, I want to find a value of n1. I used the following code but I am getting the error - Error in as.vector(x, mode) : cannot coerce type 'closure' to vector of type 'any' n=10 a_g<-(1/(n*(n-1)))*((pi/3)*(n+1)+(2*sqrt(3)*(n-2))-4*n+6) a_s<-function(n1) { t1=(n1-1)/2; (t1*(gamma(t1)/gamma(n1/2))^2)/2-1-a_g } xm<-solve(a_s) Can anyone help me out. Thanks in
2012 Jul 23
2
Solving equations in R
Hi there, I would like to solve the following equation in R to estimate 'a'. I have the amp, d, x and y. amp*y^2 = 2*a*(1-a)*(-a*d+(1-a)*x)^2 test data: amp = 0.2370 y= 0.0233 d= 0.002 x= 0.091 Can anyone suggest how I can set this up? Thanks, Diviya [[alternative HTML version deleted]]
2007 Dec 06
1
Integral implicit function
Hi, Could somebody help me with the following. I want to calculate the integral over an implicit function. I thought to integrate over a function depending on uniroot. In previous topics I found a thread about finding the root of an integral. And that works. But the other way around, does not work. Does R support this? I included the following example. The function in the example is very easy