Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Can you perform mathematical equations in UNIX? Post 302140591 by VioletFairy on Sunday 14th of October 2007 09:52:28 PM
Old 10-14-2007
Can you perform mathematical equations in UNIX?

Hello one and all,

I have a basic background in UNIX, but I was wondering if there is a way to perform simple mathematical equations (like multiplication, addition)? If so, is there a way to multiply values from a column by a value to produce a column with the answers? Smilie

I am working on a simple research project and in some data sets I have to get the the values of the velocity for a string of data...i.e.

data * (speed of light) = [desired answers]
5.7 * (299792458) = [1708817010.6]
6.8 = [2038588714.4]
7.3 = [2188484943.4]
5.1 = [1528941535.8]

Is there a simpler way to get my desired values besides find the values individually on my calculator? I would greatly appreciate any assistance.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to perform comparision in unix

I am trying to perform a simple if/else check. if ; then mkdir /wdnet/oracletest else mkdir $CON_DIR fi I guess I don't understand the unix basics about comparisons. My scripts always executes the if, even though my CON_DIR variable is not blank. What am I doing... (5 Replies)
Discussion started by: artfuldodger
5 Replies

2. UNIX for Dummies Questions & Answers

how can perform zip or unzip at unix console

how can perfrom zip or unzip for bulk of files at unix console can anybody tell that command (2 Replies)
Discussion started by: lmraochodisetti
2 Replies

3. High Performance Computing

Differential Equations

I`m having a cluster with Rocks 5.2 distribution and I want to solve differential equations and I`m interested to know if are some programs already developed to do this. (3 Replies)
Discussion started by: rapo
3 Replies

4. UNIX for Dummies Questions & Answers

Awk - Two equations?

I really know barely anything about awk and the like but I have a bit of code I need help with. The bash script is meant to get my usage numbers from my ISP and it does so perfectly. However I want to know how much I can use each day. So to do this I would need to divide its output by the number... (5 Replies)
Discussion started by: Light_
5 Replies

5. Shell Programming and Scripting

Unix Script -- Unable to perform division

I'm new to scripts, i wrote the below script to capture the percentage of FreeMemory available in Linux box. Output of UsedfreeMemory is displayed as '0'. I'm expecting the output like 0.89 (or) .89 --- ( 0.89 perferable) Anyone can help me on this pls. ... (3 Replies)
Discussion started by: murali1687
3 Replies

6. Shell Programming and Scripting

UNIX shell script - cut specified line and perform loop

Guys, I have a requirement as below. consider,if i use df command, its getting the below output. file system kbytes used avail %used Mounted on /dev/sample/ 45765 40000 5765 50% / /dev/filesys/ 30000 20000 1000 80% /u .... .... Now i wanted to cut the /u... (11 Replies)
Discussion started by: AraR87
11 Replies

7. Shell Programming and Scripting

How To Perform Mathematical Operation Within If in awk?

Hi All, I am using an awk script as below: awk -F'|' 'BEGIN{OFS="|";} { if ($1==$3 && $3==$7 && $7==$13 && $2==$6 && $6==$11 && $15-$14+1==$11) print $0"|""TRUE"; else print $0"|""FALSE"; }' tempfile.txt In above script, all conditions are being checked except the one which is... (4 Replies)
Discussion started by: angshuman
4 Replies

8. Shell Programming and Scripting

awk script to perform an action similar to vlookup between two csv files in UNIX

Hi, I am new to awk/unix and am trying to put together an awk script to perform an action similar to vlookup between the two csv files. Here are the contents of the two files: File 1: Date,ParentID,Number,Area,Volume,Dimensions 2014-01-01,ABC,247,83430.33,857.84,8110.76... (9 Replies)
Discussion started by: Prit Siv
9 Replies

9. Shell Programming and Scripting

Should pick latest file within past 3 days using UNIX script and perform steps in message below.

Hi , Can anyone help me how do perform below requirement in unix. Step1:we will receive multiple files weekly with same name(as below) in a folder(In folder we will have other files also def.dat,ghf.dat) Filenames: 1) abc_20171204_052389.dat 2)abc_20171204_052428.dat DON'T modify... (23 Replies)
Discussion started by: sunnykamal59
23 Replies
math::constants(3tcl)						 Tcl Math Library					     math::constants(3tcl)

__________________________________________________________________________________________________________________________________________________

NAME
math::constants - Mathematical and numerical constants SYNOPSIS
package require Tcl ?8.3? package require math::constants ?1.0.1? ::math::constants::constants args ::math::constants::print-constants args _________________________________________________________________ DESCRIPTION
This package defines some common mathematical and numerical constants. By using the package you get consistent values for numbers like pi and ln(10). It defines two commands: o One for importing the constants o One for reporting which constants are defined and what values they actually have. The motivation for this package is that quite often, with (mathematical) computations, you need a good approximation to, say, the ratio of degrees to radians. You can, of course, define this like: variable radtodeg [expr {180.0/(4.0*atan(1.0))}] and use the variable radtodeg whenever you need the conversion. This has two drawbacks: o You need to remember the proper formula or value and that is error-prone. o Especially with the use of mathematical functions like atan you assume that they have been accurately implemented. This is seldom or never the case and for each platform you can get subtle differences. Here is the way you can do it with the math::constants package: package require math::constants ::math::constants::constants radtodeg degtorad which creates two variables, radtodeg and (its reciprocal) degtorad in the calling namespace. Constants that have been defined (their values are mostly taken from mathematical tables with more precision than usually can be handled) include: o basic constants like pi, e, gamma (Euler's constant) o derived values like ln(10) and sqrt(2) o purely numerical values such as 1/3 that are included for convenience and for the fact that certain seemingly trivial computations like: set value [expr {3.0*$onethird}] give exactly the value you expect (if IEEE arithmetic is available). PROCEDURES
The package defines the following public procedures: ::math::constants::constants args Import the constants whose names are given as arguments ::math::constants::print-constants args Print the constants whose names are given as arguments on the screen (name, value and description) or, if no arguments are given, print all defined constants. This is mainly a convenience procedure. BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category math :: constants of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
constants, degrees, e, math, pi, radians CATEGORY
Mathematics COPYRIGHT
Copyright (c) 2004 Arjen Markus <arjenmarkus@users.sourceforge.net> math 1.0.1 math::constants(3tcl)
All times are GMT -4. The time now is 08:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy