# gcomp(1) [osf1 man page]

```GCOMP(1)						      General Commands Manual							  GCOMP(1)

NAME
gcomp - do computations on a graph file.

SYNOPSIS
gcomp [ -amilh ][ +variable value ..  ][ file ..  ]

DESCRIPTION
Gcomp reads each graph file in sequence and computes the specified calculations.  The type options are as follows:

-n	 Print the name of each curve.

-a	 Print average and standard deviation of each curve.

-m	 Print minimum and maximum for each curve.

-i	 Print Romberg's approximation to the integral of each curve.

-l	 Print the slope, intercept, and correlation coefficient using the least squares method of linear regression.

-h	 Do not print a header in the output.

The  calculations  will	be  displayed as columns in the order they are specified on the command line.  If no files are given, the standard

Variables can be set explicitly with +variable value options.  The only truely useful variables for this program are xmin and  xmax.   They
determine boundaries for the calculations.

EXAMPLE
To compute the approximate integral of sin(x)/log(x) from 2 to 4:
gcomp -i
A(x)=sin(x)/log(x);
Anpoints=100;
xmin=2;
xmax=4;
^D

AUTHOR
Greg Ward

BUGS
Only the y values can be used for computation.

bgraph(1), dgraph(1), icalc(1), igraph(1)

## Check Out this Related Man Page

```GCOMP(1)						      General Commands Manual							  GCOMP(1)

NAME
gcomp - do computations on a graph file.

SYNOPSIS
gcomp [ -amilh ][ +variable value ..  ][ file ..  ]

DESCRIPTION
Gcomp reads each graph file in sequence and computes the specified calculations.  The type options are as follows:

-n	 Print the name of each curve.

-a	 Print average and standard deviation of each curve.

-m	 Print minimum and maximum for each curve.

-i	 Print Romberg's approximation to the integral of each curve.

-l	 Print the slope, intercept, and correlation coefficient using the least squares method of linear regression.

-h	 Do not print a header in the output.

The  calculations  will	be  displayed as columns in the order they are specified on the command line.  If no files are given, the standard

Variables can be set explicitly with +variable value options.  The only truely useful variables for this program are xmin and  xmax.   They
determine boundaries for the calculations.

EXAMPLE
To compute the approximate integral of sin(x)/log(x) from 2 to 4:
gcomp -i
A(x)=sin(x)/log(x);
Anpoints=100;
xmin=2;
xmax=4;
^D

AUTHOR
Greg Ward

BUGS
Only the y values can be used for computation.

bgraph(1), dgraph(1), icalc(1), igraph(1)

Man Page

## Float calculations

As expr is used for integer calculations, which command is used for float calculations.

## fieldwidths, printf and calculations with variables

Hello guys, I have a problem concerning the formatting when performing calculations with variables passed to awk and using fieldwidth definitions and printf. I have the following code: awk 'BEGIN{ FIELDWIDTHS = "5 3 7 5 8 8 8" }{if (\$7 != "") printf"%s%-s%s%s%s%s%s\n",\$1,\$2,\$3,\$4,\$5,\$6,\$7;...

## Mathematical calculations in shellscript

Hi want to do below mathematical calculations in shellscrip but it is not giving me the exact output.Please help me to solve this price=95.3 price1=(20/100)*\$price+\$price echo "price=\$price1" finally the output should display price=114.36 Thanks

## gnuplot average of N curves

Hi I am faced with a situation where I have to plot an curve which is an average of 10 tables. It is not possible to mathematically find an average (which would be correct) because my tables have the time of occurences of events, sometimes events wont occur at similar times in two or more...

## Help with Arithmetic calculations in Shell script

Hi, I need a help with arithmetic calculations in my script. I have two variables: a=17; b=1712 I want to perform (\$a/\$b)*100 with two decimals in the result. I tried with following: res=\$((100*a/b)) res=`echo "scale=2; \$a / \$b" | bc` But I am not getting the decimal values....

## Arithmetic calculations in bash file

I have 2 numbers xmin = 0.369000018 xmax = 0.569000006 and want to calculate (xmax- xmin) / 5.0 I have tried using \$(( )) but is always giving an error

## Output calculations

Attached are the is original output (zipped file) and a custom file using the awk code below in which the average reads per bait are calculated (average.txt) awk '{if(len==0){last=\$4;total=\$6;len=1;getline}if(\$4!=last){printf("%s\t%f\n", last,...