search for: soln

Displaying 20 results from an estimated 32 matches for "soln".

Did you mean: sol
2005 Nov 05
3
solve the quadratic equation ax^2+bx+c=0
If I have matrics as follows: > a <- c(1,1,0,0) > b <- c(4,4,0,0) > c <- c(3,5,5,6) How can I use R code to solve the equation ax^2+bx+c=0. thanks! yuying shi [[alternative HTML version deleted]]
2011 Nov 11
0
mc.cores and computer settings on osx and linux
....) { si <- split(1:nrow(data), INDICES) ## input = set of row indexes ; output = one row in a matrix or data frame, that can be stacked up FUN.ON.ROWS <- function(.index, ...) { rv <- FUN(data[.index,], ...); if (is.null(rv)) rv else if (is.vector(rv)) matrix(rv, nrow=1) else rv } soln <- lcapplyversion( si, FUN.ON.ROWS, ... ) check.output(soln) rv <- do.call("rbind", add.by.names(soln)) if (is.null(rv)) { print(head(soln)); abort("Sorry, but in .mc.by, the rv is null!\n") } if (ncol(rv)==1) { nm <- rownames(rv) rv <- as.vector(rv)...
2012 Mar 26
1
assigning vector or matrix sparsely (for use with mclapply)
...a.in, recalclist, FUN, ...) { ? data.notdone <- data.in[recalclist,] ? cat.stderr("[mc.byselectrows: ", nrow(data.notdone), "rows to be recomputed out of", nrow(data.in), "]\n") ? FUN.ON.ROWS <- function(.index, ...) as.matrix(FUN(data.notdone[.index,], ...)) ? soln <- mclapply( as.list(1:nrow(data.notdone)) , FUN.ON.ROWS, ... ) ? rv <- do.call("rbind", soln) ?## omits naming. ? if (ncol(rv)==1) rv <- as.vector(rv) ? rv } this works fine, except that what I want to get NA's in the return positions that were not recalculated. then, I ca...
2007 Oct 16
1
underdetermined system
Hi, sorry, I'm an idiot.. and I know I'm missing something stupid.. I thought if we solve an underdetermine system with QR, my soln is: min ||x|| (L2 sense) such that Ax = b then say i have: > w <- matrix(c(1, 5), ncol=2) > sw = 2 > qrW = qr(t(w) %*% w) > qr.coef(qrW, t(w) %*% sw) [,1] [1,] 2 [2,] NA but we also have soln (0, 2/5) which obviously has a smaller distance in L2 than (2, 0). Am I missi...
2011 Oct 22
0
simplified multicore by() function
...]] ) ) row.names(mc.rv[[i]]) <- rep( names(mc.rv)[i], nrow(mc.rv[[i]]) ) } mc.rv } mc.by <- function(data, INDICES, FUN, ...) { FUN.i <- function(.index, ...) { cbind(FUN(data[.index,], ...)) } ## we cbind, so we always get an array back si <- split(1:nrow(data), INDICES) soln <- mclapply( si, FUN.i, ... ) rv <- do.call("rbind", add.by.names(soln)) if (ncol(rv)==1) { nm <- rownames(rv) rv <- as.vector(rv) names(rv) <- nm } rv } mc.byallrows <- function(data, INDICES, FUN, ...) { FUN.i <- function(.index, ...) { cbind(...
2008 Dec 16
1
refer to next line within a data-frame an select cases
Hi, I have a problem sorting and selecting entries within a data-frame and I don't know if it is possible to solve it with R ... (probably yes, but I have no idea how). Following Data; row1 row2 a 12 pos NA a 3 neg NA a 5 neg NA a 11 pos NA I want to extract the values in row 2 in the lines with an "a" in row1. But I want to have two vectors: vector x with all
2010 Apr 20
2
QCA3 segfault
...unt = as.integer(x.count), objective = as.double(objective), const.count = as.integer(const.count), constraints = as.double(constraints), int.count = as.integer(int.count), int.vec = as.integer(int.vec), bin.count = as.integer(bin.count), binary.vec = as.integer(binary.vec), num.bin.solns = as.integer(num.bin.solns), objval = as.double(objval), solution = as.double(solution), presolve = as.integer(presolve), compute.sens = as.integer(compute.sens), sens.coef.from = as.double(sens.coef.from), sens.coef.to = as.double(sens.coef.to), duals = as.double(duals), duals.fro...
2012 Jan 30
2
ode() tries to allocate an absurd amount of memory
...same.) I have included a trivial example below that uses a function that returns a rate of change of zero for all state variables. > require(deSolve) Loading required package: deSolve > C<-rep(0,34000) > TestFunc<-function(t,C,para){ + return(list(rep(0,length(C)))) + } > soln<-ode(y=C,times=seq(0,1,0.1),func=TestFunc,parms=c(0),method="vode") Error in vode(y, times, func, parms, ...) : cannot allocate memory block of size 137438953456.0 Gb In addition: Warning message: In vode(y, times, func, parms, ...) : NAs introduced by coercion > Am I making a fo...
2006 Jan 11
1
can remote_function update two div simultaneously?
hi all i m using remote_function , & i need to update two divs at same time (so no :success/:failure).... is there any posiible soln for this thanks rohit --------------------------------- Yahoo! Photos Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rail...
2005 Mar 11
1
Simplex(boot) returning invalid answer
...(1,1,-1,0,-1,-1), 3, 2) > ubVector <- c(2,1,-1) > objective <- c(0,1) > ubMatrix [,1] [,2] [1,] 1 0 [2,] 1 -1 [3,] -1 -1 > ubVector [1] 2 1 -1 > smplx <- simplex( a = objective, A1 = ubMatrix, b1 = ubVector) > smplx$solved [1] 1 > smplx$soln x1 x2 0 0 > ubMatrix %*% smplx$soln <= ubVector [,1] [1,] TRUE [2,] TRUE [3,] FALSE The correct answer to the problem, which also has a value of 0, but satisfies the constraints is [1, 0] : > ubMatrix %*% c(1,0) <= ubVector [,1] [1,] TRUE [2,] TRUE [3,] TRUE Any...
2006 Oct 03
0
rsync stops outputting when synchronizing a directory with many files
...ory was removed in the original, and is being removed in the mirror), it stops outputting results in the middle of reporting the next file to be deleted: . . . deleting d1/cfd/james/CFDkit+caboodle_Jai/pdes++/examples/EmbeddedBoundaries2D/naca0012/oscillating/SU/AMR_3/naca0012_adjustment_blk005325.soln deleting d1/cfd/james/CFDkit+caboodle_Jai/pdes++/examples/EmbeddedBoundaries2D/naca0012/oscillating/SU/AMR_3/naca0012_adjustment_blk005324.soln deleting d1/cfd/james/CFDkit+caboodle_Jai/pdes++/ex It doesn't even seem to finish outputting the file name. Afterwards, rsync remains in memory and...
2018 Feb 10
0
Optim function returning always initial value for parameter to be optimized
...ent methods require differentiable (smooth) functions. A numerical approximation will be zero unless you are right near a jump point, so you are unlikely to move from your initial guess. Paul > > total.err <- (op1.err + op2.err) > > return(total.err) > } > > soln <- optim(par = 300, fn=err.th.scalar, data = data.input, method = > "BFGS") > soln > require("numDeriv") > gtest <- grad(err.th.scalar, x=300, data = data.input) > gtest > > > On 2018-02-09 09:05 AM, BARLAS Marios 247554 wrote: >> data.input...
2018 Feb 09
1
Optim function returning always initial value for parameter to be optimized
Hello, I'm trying to fminimize the following problem: You have a data frame with 2 columns. data.input= data.frame(state1 = (1:500), state2 = (201:700) ) with data that partially overlap in terms of values. I want to minimize the assessment error of each state by using this function: err.th.scalar <- function(threshold, data){ state1 <- data$state1 state2 <- data$state2
2016 Apr 07
5
Suddenly increased my hard disk
...type and i have removed .bz2 type file with the same backup/mailbkup directory. After removed .bz2 file it's gone backup.gz also which was 184 GB file. I have run this command locate .gz but couldn't find out it. how do i see the open files. Could you help me to find out this file or any soln. On Thu, Apr 7, 2016 at 12:55 PM, Ashish Yadav <gwalashish at gmail.com> wrote: > Hi Chandran, > > > On Thu, Apr 7, 2016 at 9:14 AM, Chandran Manikandan <tech2mani at gmail.com> > wrote: > > > Hi All, > > > > I have running Centos 6.5 32 bit machin...
2010 Mar 11
4
help about solving two equations
I have two matrix s1 and s2, each of them is 1000*1. and I have two equations: digamma(p)-digamma(p+q)=s1, digamma(q)-digamma(p+q)=s2, and I want to sovle these two equations to get the value of x and y, which are also two 1000*1 matrices. I write a program like this: f <- function(x) { p<- x[1]; q <- x[2]; ((digamma(p)-digamma(p+q)-s1[2,]) )^2 +((digamma(q)-digamma(p+q)-s2[2,]) )^2
2012 Nov 15
2
Optimizing
Hello, I am fairly new with R and am having trouble finding an optimal group. I checked the help functions for the various optimize commands and it was a little over my head. I have a dataset with 4 columns, name, type, value, and cost. The set consists of a list of people, which have 3 types. I want to choose 6 people, two of each type, and maximize the sum of their values. However, I'm
2010 Jul 27
2
lattice: option to sort x when type = l
...data > D <- read.csv ('http://www.stat.osu.edu/~pkapat/miscl/Data4xyplot_sort_type_l.csv') > > # default behavior: obviously wrong > xyp1 <- xyplot (y ~ x/1000 | C, groups = G, data = D, type = "o", main = 'Wrong behavior, obviously') > > # simplest soln: > xyp2 <- xyplot (y ~ x/1000 | C, groups = G, data = with (D, D[do.call (order, list (x, C, G)),]), type = "o", main = 'Using pre-sorted data frame') > > # hack: > # adds an additional `if' inside the `if ("l" %in% type) {...}' block of the defaul...
2016 Apr 07
0
Suddenly increased my hard disk
...e file with the same backup/mailbkup directory. > > After removed .bz2 file it's gone backup.gz also which was 184 GB file. > I have run this command locate .gz but couldn't find out it. > > how do i see the open files. > > Could you help me to find out this file or any soln. > Follow this link for more information, <http://www.cyberciti.biz/faq/howto-linux-get-list-of-open-files/> --Regards Ashishkumar S. Yadav
2004 May 27
0
How to use R Library in VC++ wrapper dll (SOS)
...rom some wrapper function calling int i = do_seq(1, 1, 1, 1); function (do_seq is in export symbols in R.dll). Now it is not recoginising. So , guide me in first l how to use SEXP varaible, and make me run 1 functionality .pls Reply ASAP. * I will appreciate if I can chat with the person who has soln for my problem for 10-15 min to help me live.Pls contact me on rnassa123@yahoo.com rnassa@hotmail.com Rakesh Nassa [[alternative HTML version deleted]]
2009 Apr 07
0
Repeated SANN values.
I tried optim using the SANN algoithm. To start things out I tried the example of solving the "traveling salesman" problem as given in the documentation. The example works just fine. But if I comment out the line: set.seed(123) # chosen to get a good soln relatively quickly More often than not it doesn't converge to the optimum solution as shown in the example. Alos with trace on it seems that the algoritm is easily fooled by a local mimimum as once it gets close to the solution it seems to get "stuck" and repeatedly returns the same...