Sponsored Content
Full Discussion: Atan2 function in awk
Top Forums Shell Programming and Scripting Atan2 function in awk Post 302816133 by RudiC on Monday 3rd of June 2013 11:02:50 AM
Old 06-03-2013
You are on the wrong track. atan is the arctangens. For angles, you can calculate tan (alpha). atan is the inverse, yielding an angle as a result.

Go back to high school maths: tan (alpha) = sin (alpha) / cos (alpha).
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk with function ?? please, help :(

Here is my test.in file Case Modify 10001 20002 30003 40004|Report Create 3417176211|Case Modify 10002 20002 30003 40004| Script: Remove.ksh This script to remove $1 which I type in: $ cat test.in Case Modify 10001 20002 30003 40004|Report Create 3417176211|Case Modify 10002 20002 30003... (0 Replies)
Discussion started by: sabercats
0 Replies

2. Shell Programming and Scripting

Help with the function awk

Hi I am trying to create a modify a txt file via a sh script and I'm not sure how to do it. I have this: data1a#data2a#data3aµ data1b#data2b#data3bµ data1c#data2c#data3cµ and I want to have this (more or less) data1a data2a data3a data1b data2b data3b data1c data2c data3c I know... (5 Replies)
Discussion started by: Morgwen
5 Replies

3. Shell Programming and Scripting

MODE function in awk

Hello, Can someone pls help me with some statistical calculation in awk In excel there is a statistical function called "Mode". How Mode works: MODE returns the most frequently occurring, or repetitive, value in array or range. Eg if we have 5 numbers in 5 different columns... (12 Replies)
Discussion started by: Needhelp2
12 Replies

4. Shell Programming and Scripting

use of substr function in awk

i want to get substring of second coloum of an file using awk substring function.please help me out (2 Replies)
Discussion started by: RahulJoshi
2 Replies

5. Shell Programming and Scripting

Awk problem: How to express the single quote(') by using awk print function

Actually I got a list of file end with *.txt I want to use the same command apply to all the *.txt Thus I try to find out the fastest way to write those same command in a script and then want to let them run automatics. For example: I got the file below: file1.txt file2.txt file3.txt... (4 Replies)
Discussion started by: patrick87
4 Replies

6. Shell Programming and Scripting

AWK Function syntax

Hi, I would like to know what is the correct syntax to perform a function in awk. Although I have seen several examples, not get it to work, this is what I'm trying: #!/bin/bash awk function multi (number) { return number * 3 } print multi (4)Thanks (2 Replies)
Discussion started by: Godie
2 Replies

7. Shell Programming and Scripting

Awk-using group function

Hi, I have file with below format and sample data - File is pipe delimited Col1|col2|Account|Bal1|Bal2 1|2|1|10|5 1|2|2|10|2 1|3|3|10|3 I want output as SUM|1|2|2|20|7 SUM|1|3|1|10|3 Can anyone give me awk command (4 Replies)
Discussion started by: sanranad
4 Replies

8. Shell Programming and Scripting

awk function

Hi all, I need to have informations in a URL : https://www.autolib.eu/stations/ Valors I need are in bold: {"charging_status": "nonexistent", "rental_status": "future", "subscription_status": "nonexistent", "station_id": 791, "address": "10 rue de Rome, 93110 Rosny-sous-Bois", "lat":... (3 Replies)
Discussion started by: roulitto
3 Replies

9. Shell Programming and Scripting

awk function

hi, I have used awk command to delimit my variable. But this that not worked. Could you please let me know what need to be changed in my awk command Input: home/unix>cat test.txt DAILY.JOB CHENNAI,8388 DAILY.JOB BANGLORE,3848 DAILY.JOB TRICHY,9489 DAILY.JOB TIRUPUR,8409 code ... (9 Replies)
Discussion started by: arun888
9 Replies

10. Shell Programming and Scripting

Need help on awk for printing the function name inside each function

Hi, I am having script which contains many functions. Need to print each function name at the starting of the function. Like below, functionname() { echo "functionname" commands.... } I've tried like below, func=`grep "()" scriptname | cut -d "(" -f1` for i in $func do nawk -v... (4 Replies)
Discussion started by: Sumanthsv
4 Replies
SIN(3M) 																   SIN(3M)

NAME
sin, cos, tan, asin, acos, atan, atan2 - trigonometric functions and their inverses SYNOPSIS
#include <math.h> double sin(x) double x; double cos(x) double x; double tan(x) double x; double asin(x) double x; double acos(x) double x; double atan(x) double x; double atan2(y,x) double y,x; DESCRIPTION
Sin, cos and tan return trigonometric functions of radian arguments x. Asin returns the arc sine in the range -pi/2 to pi/2. Acos returns the arc cosine in the range 0 to Atan returns the arc tangent in the range -pi/2 to pi/2. On a VAX, atan2(y,x) := atan(y/x) if x > 0, sign(y)*(pi - atan(|y/x|)) if x < 0, 0 if x = y = 0, or sign(y)*pi/2 if x = 0 != y. DIAGNOSTICS
On a VAX, if |x| > 1 then asin(x) and acos(x) will return reserved operands and errno will be set to EDOM. NOTES
Atan2 defines atan2(0,0) = 0 on a VAX despite that previously atan2(0,0) may have generated an error message. The reasons for assigning a value to atan2(0,0) are these:(1) Programs that test arguments to avoid computing atan2(0,0) must be indifferent to its value. Programs that require it to be invalid are vulnerable to diverse reactions to that invalidity on diverse computer systems.(2) Atan2 is used mostly to convert from rectangular (x,y) to polar (r,theta) coordinates that must satisfy x = r*cos theta and y = r*sin theta. These equations are satisfied when (x=0,y=0) is mapped to (r=0,theta=0) on a VAX. In general, conversions to polar coordinates should be computed thus: r := hypot(x,y); ... := sqrt(x*x+y*y) theta := atan2(y,x). (3) The foregoing formulas need not be altered to cope in a reasonable way with signed zeros and infinities on a machine that conforms to IEEE 754; the versions of hypot and atan2 provided for such a machine are designed to handle all cases. That is why atan2(+-0,-0) = +-pi, for instance. In general the formulas above are equivalent to these: r := sqrt(x*x+y*y); if r = 0 then x := copysign(1,x); if x > 0 then theta := 2*atan(y/(r+x)) else theta := 2*atan((r-x)/y); except if r is infinite then atan2 will yield an appropriate multiple of pi/4 that would otherwise have to be obtained by taking limits. ERROR (due to Roundoff etc.) Let P stand for the number stored in the computer in place of pi = 3.14159 26535 89793 23846 26433 ... . Let "trig" stand for one of "sin", "cos" or "tan". Then the expression "trig(x)" in a program actually produces an approximation to trig(x*pi/P), and "atrig(x)" approximates (P/pi)*atrig(x). The approximations are close, within 0.9 ulps for sin, cos and atan, within 2.2 ulps for tan, asin, acos and atan2 on a VAX. Moreover, P = pi in the codes that run on a VAX. In the codes that run on other machines, P differs from pi by a fraction of an ulp; the difference matters only if the argument x is huge, and even then the difference is likely to be swamped by the uncertainty in x. Besides, every trigonometric identity that does not involve pi explicitly is satisfied equally well regardless of whether P = pi. For instance, sin(x)**2+cos(x)**2 = 1 and sin(2x) = 2sin(x)cos(x) to within a few ulps no matter how big x may be. Therefore the difference between P and pi is most unlikely to affect scientific and engi- neering computations. SEE ALSO
math(3M), hypot(3M), sqrt(3M), infnan(3M) AUTHOR
Robert P. Corbett, W. Kahan, Stuart I. McDonald, Peter Tang and, for the codes for IEEE 754, Dr. Kwok-Choi Ng. 4th Berkeley Distribution May 12, 1986 SIN(3M)
All times are GMT -4. The time now is 02:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy