# Tagged Questions

The tag has no usage guidance.

37 views

### negative values are being treated as positive in RHEL suddenly. Why?

For example: # [[ -24 > 0 ]] && echo "Hi" Hi Since yesterday, I found this weird behavior. What could be the reason?
121 views

### Why does the factor command produce nonsense on an RSA modulus?

Ok, so I think I may have found a flaw in... something. I honestly don't know. This is such a weird scenario. I was attempting to break very small asymmetric (RSA) encryption, just as a Proof of ...
11 views

### How to Do Trigonometric Range of Floats in Python? [migrated]

Matlab x = 0:pi/100:2*pi; y = sin(x); plot(y) I think range() cannot work here because it only accepts end arguments as integers but I need floats (0.0; 2*pi). Pseudocode in Python 2.7.11+ import ...
70 views

### Equation solver for the shell?

Is there an equation solver for the shell? For example, I enter input 1000=x^(1.02) and the shell solves for x.
16 views

### How do I compute the angle of the 2D 3 points ? [[ In kernel space]

I 'm looking at the touch driver 's Kennel. Sometimes a touch is bouncing County singah appear. Collected by recruiting three points 'm trying to calculate the angle between . But there is no such ...
21 views

### Mean and variance of words pronounced

I'm working on linguistics and am trying to calculate the average sentence length and how much this average varies. I worked to leave always one sentence per line For instance: La derniÃ¨re fois ...
275 views

### How can I do basic calculations in a shell script?

I want to perform some mathematical operations in the shelll. For example: 5+50*3/20 + (19*2)/7 I tried: #!/bin/bash read equ echo "scale=3; \$equ" | bc -l Expected output: 17.929 My ...
63 views

### A bc problem about long expression

I want to calculate an expression in shell. I use the following code: pi=\$(echo "scale=10; 4*a(1)" | bc -l) i=3 d=`expr (1+c(\$pi*(\$i/10)+\$pi))/2 | bc -l` But it says bad pattern: (1+c(3.1415926532*...
26 views

### Maths revision program [closed]

I have created a program that will randomly select two numbers out of a range and ask a multiplication question from it. It works well but as I am new too coding it looks very messy and repetitive. I ...
568 views

### Weird float rounding behavior with printf

I've read some answers on this site and found the printf rounding desirable. However when I used it in practice, a subtle bug led me to the following behavior: \$ echo 197.5 | xargs printf '%.0f' 198 ...
18 views

### How do I use octave to find the numerical solutions to a system of non-linear equations?

I have the following set of equations: acos(x/250)=t acos(w/300)=u asin(y/250)=u asin(z/300)=t w-x=150 z-y=150 How do I solve this system of non-linear equations using octave? The only ...
179 views

### How to add all values in an array

I have been stuck on this for way to long now. Tried googling and couldn't find what I was looking for. I simply need to add all the values in an array.(array called packets) I have gotten to the ...
546 views

### bash division of numbers in text file

I have two numbers in test.txt file, I would like a way to divide the second number by the first number and assign the result to a variable or file in a bash script that I can use. I have used awk "NR=...
274 views

### How do I add integer and floating numbers together to keep tally?

I'm just trying to do some simple math that is not turning out that simple. this is what I have tried so far and I have yet to find anything on the google net that combines integer and floating ...
8k views

### How do I print pi (3.14159)? [closed]

What command could print pi for me? I want to specify how many digits it prints, I couldn't find anything online. I just want to be able to print pi.
112 views

### Mathematical processing on text file

I have 200 text files. Each text file contains one column of mathematical numbers (100k rows). I want to do some statistical processing on these data (finding the probit or quantile). I know the ...
639 views

### Increment numbers inside strings by an offset

I want to search a text file for strings like these. [task0] [task1] ... [task1613] and increment each by a given offset, in this case by 3640. So, with the example I gave above, I'd get the ...
360 views

### Command line expression solver?

I'm looking for a Linux-compatible TTY-based calculator. For example: user@host:~\$ calculate > 2 2 user@host:~\$ calculate > 8*6-4 44 user@host:~\$ calculate > 8*(6-4) 16 Is there anything ...
2k views

### basic division using variable and integer

I'm an extreme beginner in bash commands, and am having trouble figuring out a basic division command. count = redis-cli llen domains; echo \$count returns 1000 How can I echo \$count/1000? I've ...
82 views

### Script is stuck saying 1 response with 2 available: Math related

I have a script that tells the user the square footage of 2 rooms based on user input. I think I have that part done right. The problem I have is that I need to have the script say which room is ...
43 views

### How to calculate (weighted) majority over columns?

I have two files: the first one contains lines where the first column is an ID, and the remaining columns are votes, e.g. 3242 -1 1 -1 1 1 1 In a first step I want to calculate the majority for ...
776 views

### How can I round all numbers in a file?

How can I round all numbers in a file that countains several columns of numbers up to a certain precision? Can this be done with awk? A single line looks like this: text - 0.1655456615 - 0.158645 - ...
3k views

### How to sum a bash array of numbers (some in scientific notation)?

Since the following command using bc does not work for numbers in scientific notation, I was wondering about an alternative, e.g. using awk? sum=\$( IFS="+"; bc <<< "\${arrValues[*]}" )
470 views

### expr command used to work and stopped

I am on SunOS machine trying to get the date string of the past minute, yesterday I used this command I found on the internet expr `date +%Y%m%d%k%M` - 1 which is worked just fine and I saw the ...
1k views

### Round/truncate digit in string in zsh (or with external tool)

I'm trying to do an interface to bc so it can be used intuitively and without the annoyance of getting "stuck" in it. I haven't got around to test it that much, because I got stuck on another detail, ...
306 views

### How do I convert my old PC to a data logging and presentation terminal?

Take an old PC (e.g. 1.8GHz P4 with 256MB RAM), install e.g. Ubuntu 10.04 LTS on it. Now go to your PIC or AVR based home project and hook up the thing. With only three connections and the onboard ...
170 views

### how to type linear algebra symbols

How do I type the symbols for linear algebra on Ubuntu? Are there any programs that use them? ( I understand this is trivial basket weaving. Whats the fastest way! )
189 views

### Illustrate the difference of two squares via the command line

So, after 10 years of wanting to study the book that Ramanujan relied upon for a lot of his early strides in mathematics, it's 2012, and the book is finally online. To celebrate, I want to go through ...
13k views

I am trying to perform a mathematical operation with sed, but it continues to treat my variables as strings. The input is of this kind: \$ echo 12 | sed 's/[0-9]*/&+3/' \$ 12+3 I'd like to have ...