Sponsored Content
Top Forums Programming C language to calculate mean,variance Post 302156567 by shamrock on Tuesday 8th of January 2008 02:56:08 PM
Old 01-08-2008
Code:
#include <math.h>
void moment(float data[], int n, float *ave, float *var)

{
    void nrerror(char error_text[]);
    int j;
    float ep=0.0,s,p;
    if (n <= 1) nrerror("n must be at least 2 in moment");
                                              
    s=0.0;
    for (j=1;j<=n;j++) s += data[j];
      *ave=s/n;
    variance = sqrt(pow((s - avg), 2)/(n - 1));

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

calculate output

I was wondering can anyone give me a clue how to start script which would do the following: I have 2 numbers as input for example: 100 and 1000 and I need to create file and in that file should be written 100 - 199 200 - 299 300 - 399 400 - 499 500 - 599 600 - 699 700 - 799... (3 Replies)
Discussion started by: amon
3 Replies

2. Shell Programming and Scripting

calculating variance in perl programming

#!/usr/bin/perl -w use strict; open(FH,"$ARGV") or die; my @temp=<FH>; close FH; my $mean = Mean(\@temp); my $var = variance(\@temp); print "$var\n"; sub estimate_variance { my ($arrayref) = @_; my ($mean,$result) = (mean($arrayref),0); foreach (@$arrayref) {... (4 Replies)
Discussion started by: cdfd123
4 Replies

3. AIX

calculate time

Hi, How do I calculate time? I need to create an alert if a process is running more than 30 minutes. I need to get the first time and then get another, calculate it if more than 30 mins and then alert it to pager. Can't find it in internet. Thanks in advance, itik (2 Replies)
Discussion started by: itik
2 Replies

4. Shell Programming and Scripting

How To Calculate

I have 2 variables in my shell scripts in which i am using awk and calculating 2 files and getting 2 different variable called in_total and out_total. I want to subtract one variable from another so plz tell me how i can do that. Example is: cat in_file | awk -F: '{ in_total += $1 * 86400... (3 Replies)
Discussion started by: krishna_sicsr
3 Replies

5. Shell Programming and Scripting

Calculate age of a file | calculate time difference

Hello, I'm trying to create a shell script (#!/bin/sh) which should tell me the age of a file in minutes... I have a process, which delivers me all 15 minutes a new file and I want to have a monitoring script, which sends me an email, if the present file is older than 20 minutes. To do... (10 Replies)
Discussion started by: worm
10 Replies

6. Shell Programming and Scripting

Awk total and variance

File1 0358 Not Visible ***:* NA:NA RDF1+TDEV Grp'd (M) RW 102413 0359 Not Visible ***:* NA:NA RDF1+TDEV N/Grp'd (m) RW - 035A Not Visible ***:* NA:NA RDF1+TDEV N/Grp'd (m) RW - 035B Not Visible ***:* NA:NA ... (2 Replies)
Discussion started by: greycells
2 Replies

7. Shell Programming and Scripting

Calculating Running Variance Using Awk

Hi all, I am attempting to calculate a running variance for a file containing a column of numbers. I am using the formula variance=sum((x-mean(x))^2)/(n-1), where x is the value on the current row, and mean(x) is the average of all of the values up until that row. n represents the total number... (1 Reply)
Discussion started by: Jahn
1 Replies

8. Shell Programming and Scripting

AWK sample variance

I would like to calculate 1/n In awk, I wrote the following line for the sigma summation: { summ+=($1-average)^2 } Full code: BEGIN { Print "This script calculate error estimates"; sum=0 } { sum+=$1; n++ } END { average = sum/n } BEGIN { summ=0 } { summ+=($1-average)^2 } END { print... (8 Replies)
Discussion started by: chrisjorg
8 Replies

9. UNIX for Dummies Questions & Answers

Calculate

i have file input abcedef|wert|13|03|10|04|23|A1|13|05|01|09|31 fsdasdf|ferg|12|04|25|21|21|A1|13|02|26|20|31 dfsfsad|gerg|12|04|25|21|21|A1|13|02|25|25|31 i expect the output abcedef|wert|13|03|10|04|23|A1|13|05|01|09|31|9.516666667... (5 Replies)
Discussion started by: radius
5 Replies

10. UNIX for Beginners Questions & Answers

Compare sum of two columns if variance is zero do nothing else send an email

11☺Hi, I have to data sets: One is in .txt format and other is in .csv format, please refer below two outputs from two files. File1.txt SOURCE PAYDATE TOTAL_DOLLARS RECORD_COUNT ASSET 05/25/2018 247643.94 ASSET 06/20/2018 ... (27 Replies)
Discussion started by: Tahir_M
27 Replies
HARUPAGE(3)								 1							       HARUPAGE(3)

The HaruPage class

INTRODUCTION
Haru PDF Page Class. CLASS SYNOPSIS
HaruPage HaruPage Methods o bool HaruPage::arc (float $x, float $y, float $ray, float $ang1, float $ang2) o bool HaruPage::beginText (void ) o bool HaruPage::circle (float $x, float $y, float $ray) o bool HaruPage::closePath (void ) o bool HaruPage::concat (float $a, float $b, float $c, float $d, float $x, float $y) o object HaruPage::createDestination (void ) o object HaruPage::createLinkAnnotation (array $rectangle, object $destination) o object HaruPage::createTextAnnotation (array $rectangle, string $text, [object $encoder]) o object HaruPage::createURLAnnotation (array $rectangle, string $url) o bool HaruPage::curveTo2 (float $x2, float $y2, float $x3, float $y3) o bool HaruPage::curveTo3 (float $x1, float $y1, float $x3, float $y3) o bool HaruPage::curveTo (float $x1, float $y1, float $x2, float $y2, float $x3, float $y3) o bool HaruPage::drawImage (object $image, float $x, float $y, float $width, float $height) o bool HaruPage::ellipse (float $x, float $y, float $xray, float $yray) o bool HaruPage::endPath (void ) o bool HaruPage::endText (void ) o bool HaruPage::eofill (void ) o bool HaruPage::eoFillStroke ([bool $close_path = false]) o bool HaruPage::fill (void ) o bool HaruPage::fillStroke ([bool $close_path = false]) o float HaruPage::getCharSpace (void ) o array HaruPage::getCMYKFill (void ) o array HaruPage::getCMYKStroke (void ) o object HaruPage::getCurrentFont (void ) o float HaruPage::getCurrentFontSize (void ) o array HaruPage::getCurrentPos (void ) o array HaruPage::getCurrentTextPos (void ) o array HaruPage::getDash (void ) o int HaruPage::getFillingColorSpace (void ) o float HaruPage::getFlatness (void ) o int HaruPage::getGMode (void ) o float HaruPage::getGrayFill (void ) o float HaruPage::getGrayStroke (void ) o float HaruPage::getHeight (void ) o float HaruPage::getHorizontalScaling (void ) o int HaruPage::getLineCap (void ) o int HaruPage::getLineJoin (void ) o float HaruPage::getLineWidth (void ) o float HaruPage::getMiterLimit (void ) o array HaruPage::getRGBFill (void ) o array HaruPage::getRGBStroke (void ) o int HaruPage::getStrokingColorSpace (void ) o float HaruPage::getTextLeading (void ) o array HaruPage::getTextMatrix (void ) o int HaruPage::getTextRenderingMode (void ) o float HaruPage::getTextRise (void ) o float HaruPage::getTextWidth (string $text) o array HaruPage::getTransMatrix (void ) o float HaruPage::getWidth (void ) o float HaruPage::getWordSpace (void ) o bool HaruPage::lineTo (float $x, float $y) o int HaruPage::measureText (string $text, float $width, [bool $wordwrap = false]) o bool HaruPage::moveTextPos (float $x, float $y, [bool $set_leading = false]) o bool HaruPage::moveTo (float $x, float $y) o bool HaruPage::moveToNextLine (void ) o bool HaruPage::rectangle (float $x, float $y, float $width, float $height) o bool HaruPage::setCharSpace (float $char_space) o bool HaruPage::setCMYKFill (float $c, float $m, float $y, float $k) o bool HaruPage::setCMYKStroke (float $c, float $m, float $y, float $k) o bool HaruPage::setDash (array $pattern, int $phase) o bool HaruPage::setFlatness (float $flatness) o bool HaruPage::setFontAndSize (object $font, float $size) o bool HaruPage::setGrayFill (float $value) o bool HaruPage::setGrayStroke (float $value) o bool HaruPage::setHeight (float $height) o bool HaruPage::setHorizontalScaling (float $scaling) o bool HaruPage::setLineCap (int $cap) o bool HaruPage::setLineJoin (int $join) o bool HaruPage::setLineWidth (float $width) o bool HaruPage::setMiterLimit (float $limit) o bool HaruPage::setRGBFill (float $r, float $g, float $b) o bool HaruPage::setRGBStroke (float $r, float $g, float $b) o bool HaruPage::setRotate (int $angle) o bool HaruPage::setSize (int $size, int $direction) o bool HaruPage::setSlideShow (int $type, float $disp_time, float $trans_time) o bool HaruPage::setTextLeading (float $text_leading) o bool HaruPage::setTextMatrix (float $a, float $b, float $c, float $d, float $x, float $y) o bool HaruPage::setTextRenderingMode (int $mode) o bool HaruPage::setTextRise (float $rise) o bool HaruPage::setWidth (float $width) o bool HaruPage::setWordSpace (float $word_space) o bool HaruPage::showText (string $text) o bool HaruPage::showTextNextLine (string $text, [float $word_space], [float $char_space]) o bool HaruPage::stroke ([bool $close_path = false]) o bool HaruPage::textOut (float $x, float $y, string $text) o bool HaruPage::textRect (float $left, float $top, float $right, float $bottom, string $text, [int $align = HaruPage::TALIGN_LEFT]) PREDEFINED CONSTANTS
PHP Documentation Group HARUPAGE(3)
All times are GMT -4. The time now is 04:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy