Hi Thanks. I am sorry i mistakenly put different question here. After taking derivative of absolute value function, I will have expression with step function.I have to integrate the expression which contains step function as follows
int_{0}^{infty} g(x)[theta(f(x))-theta(-f(x))] dx here argument of theta is function f(x). If there is already developed routine for such integral it would be preety simple for me. If i simply analyze I notice limit of integration is zero to infity. But argument of theta function selects new limit for the integration. So I have difficulty writing code for this step. Thank you suvas On Thu, Mar 11, 2010 at 6:35 AM, kamaraju kusumanchi < raju.mailingli...@gmail.com> wrote: > To evaluate the absolute value, you can use fabs in <math.h>. It is > part of standard C (no gsl needed). Is that what you are looking for > or did I miss something? > > raju > > On Tue, Mar 9, 2010 at 10:53 AM, Churna Bhandari <cbhandar...@gmail.com> > wrote: > > Hi > > Please, can anyone suggest me i have no idea how to integrate for the > > absolute value function. Is there any gsl routine for absolute function > > integration written in c language? I would be happy if anyone help me. > > Thanks, > > suvas > > > > On Tue, Mar 9, 2010 at 3:20 AM, Francesco Abbate < > francesco....@gmail.com>wrote: > > > >> 2010/3/9 Srimal Jayawardena <srim...@gmail.com>: > >> > Hi > >> > > >> > Is there a simple function/method for me to obtain the variance - > >> > covariance matrix of a given matrix. > >> > > >> > I'm looking for the equivalent of 'cov' in MATLAB > >> > >> Here what the Matlab documentation says: > >> > >> ------ > >> C = cov(x) where x is a vector returns the variance of the vector > >> elements. For matrices where each row is an observation and each > >> column a variable, cov(x) is the covariance matrix. diag(cov(x)) is a > >> vector of variances for each column, and sqrt(diag(cov(x))) is a > >> vector of standard deviations. > >> ------ > >> > >> So actually what Matlab calculates is the covariance between each of > >> the column vectors. > >> > >> Here a simple routine that, given a matrix m, calculates the > >> covariance matrix by in the matrix r. > >> > >> void > >> cov_calculate(gsl_matrix *r, gsl_matrix *m) > >> { > >> gsl_vector_view a, b; > >> size_t i, j; > >> > >> for (i = 0; i < m->size1; i++) { > >> for (j = 0; j < m->size2; j++) { > >> double v; > >> a = gsl_matrix_column (m, i); > >> b = gsl_matrix_column (m, j); > >> v = gsl_stats_covariance (a.vector.data, a.vector.stride, > >> b.vector.data, b.vector.stride, a.vector.size); > >> gsl_matrix_set (r, i, j, v); > >> } > >> } > >> } > >> > >> Note that the function gsl_stats_covariance does not works with > >> vectors or matrices but only with double pointer. This is why we need > >> to take directly the "data" field of the vector struct. > >> > >> Best regards, > >> Francesco > >> > >> > >> _______________________________________________ > >> Help-gsl mailing list > >> Help-gsl@gnu.org > >> http://lists.gnu.org/mailman/listinfo/help-gsl > >> > > _______________________________________________ > > Help-gsl mailing list > > Help-gsl@gnu.org > > http://lists.gnu.org/mailman/listinfo/help-gsl > > > _______________________________________________ Help-gsl mailing list Help-gsl@gnu.org http://lists.gnu.org/mailman/listinfo/help-gsl