Skip to main content

Questions tagged [math]

Filter by
Sorted by
Tagged with
0 votes
1 answer
38 views

I just wanted to build a simple bash script that inverted a 'hex color code' (made up of 3 pairs of 2-digit hexadecimal numbers, in the format #RRGGBB). In my first code block I attempt to perform ...
Signor Pizza's user avatar
-1 votes
1 answer
73 views

Does anyone know how the Unix find search -name queries with _? in leftmost column relate to Kleene Star as defined on Wikipedia? How can I accomplish the rows with _? using find? . : empty ...
notaorb's user avatar
  • 101
1 vote
1 answer
41 views

Is there a software recommendation for an application for the Cartesian field in Debian?
Darevil294's user avatar
0 votes
2 answers
128 views

I am having an issue comparing epoch times. I'm really not sure what I'm doing wrong. I have been tasked with identifying and actioning files beyond and during certain date ranges. In this case, it's ...
Kevin Huntly's user avatar
0 votes
3 answers
828 views

I'm trying to sort out a bash command to convert a number from base 10 to an arbitrary base, using a specified set of characters (for example, to base 26 using letters a-z, although that's not ...
Hate9's user avatar
  • 21
2 votes
1 answer
127 views

Why does galculator miscalculate 4000225165312/512 and gets 781293977.6? Note This is intended as a canonical question cautioning against the unreflected use of galculator 1.2.4. Please do not use it....
Artem S. Tashkinov's user avatar
10 votes
3 answers
5k views

I'm using bc in Ubuntu Linux. It has a pre-defined constant PI that's set to 99. Why does bc define PI to be 99 instead of 3.14159...?
Jim's user avatar
  • 101
3 votes
2 answers
26k views

100 divided by 3 equals 33.3 bar. How can I put a bar symbol over the three like this: You'd think there would be 9 Unicode characters dedicated to this, but I couldn't find them.
Lonnie Best's user avatar
  • 5,465
0 votes
1 answer
337 views

What I am doing is working on a conky widget, and I am trying to get a voltage reading from the sensor chip on my motherboard to display it. I am getting a voltage reading and displaying it in the ...
SwervedOne's user avatar
9 votes
1 answer
1k views

If you load the bc math library you get the trig functions s() and c() and a() which are sine, cosine, and arctangent respectively. Why these three functions? I know why it's those three from the ...
Mike Pierce's user avatar
0 votes
1 answer
79 views

I have a text file with 3 columns of data. However at random times in the various files there is a change in the in the observed unit from ppn to ppb resulting in the need of a conversion factor and ...
stormctr2's user avatar
0 votes
1 answer
725 views

I have a numerous files in which I extract the total number of records and total number of missing files in order to compute data averages. I have numerous files where the number of missing records ...
stormctr2's user avatar
0 votes
1 answer
45 views

I have large datasets in where the natural log (LN) is being computed. However, there is many cases where there are negative values and awk is kicking out a warning line for each occurrence and will ...
stormctr2's user avatar
1 vote
3 answers
745 views

I have a set of data: 1.12158 0.42563 0.07 1.12471 0.42112 0.07 1.12784 0.41685 0.07 1.13097 0.41283 0.07 1.13409 0.40907 0.07 1.13722 0.40556 0.07 1.14035 0.40231 0.07 1.14348 0.39933 0.07 1.1466 0....
physu's user avatar
  • 201
2 votes
2 answers
909 views

When I perform a simple math operation in #!/bin/sh, does that create a subshell? E.g., addition=$(( 1 + 1 )) The syntax would suggest a subshell, but I couldn't find anything on this
Nick Bull's user avatar
  • 603
2 votes
4 answers
2k views

#!/bin/sh -- expression_to_evaluate='12 + 3' printf '%s\n' "Arithemtic Expansion: $(( $expression_to_evaluate ))" printf '%s' 'bc: ' printf '%s\n' "$expression_to_evaluate" | bc printf '%s' 'awk: '...
Harold Fischer's user avatar
1 vote
5 answers
2k views

I am trying to write a Bash script that takes a list of numbers as command line arguments and then outputs the sum of those numbers. So the script would be run as script.sh 1 555 22 122 66 and would ...
Vikings Dood's user avatar
2 votes
1 answer
5k views

This is part of my conky code. conky.config = { alignment = 'top_right', background = true, color2 = '2ECC71', cpu_avg_samples = 2, default_color = 'FFFFFF', double_buffer = ...
Ébe Isaac's user avatar
0 votes
1 answer
699 views

Ubuntu 16.04 GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu) We have to add ips to servers a few times a day. I find myself creating different variations of the same file according to the ...
Vituvo's user avatar
  • 411
0 votes
1 answer
62 views

I have multiple drawing files in the format detailed below. I need to increase the value of a number in the area of the file below after the line BO. All values (in the sample below) that are 14.00 ...
2CV375's user avatar
  • 3
1 vote
4 answers
2k views

I want to increment the decimal value to next integer value through shell script. For example: i=**1.6** then I need to print i=**2** i=**1.00001** then I need to print i=**2** i=**1.00049** ...
Sandosh Kumar P's user avatar
2 votes
2 answers
548 views

I'm generating numbers using a Java program (BigIntegers) and I want to know if there's a binary readily available that I could use to run primality tests on the numbers generated.... suppose I feed ...
eftshift0's user avatar
  • 785
0 votes
2 answers
96 views

Need some ideas here. I was using something along the lines of if $[$x-$y>1500] then etc.... to detect the size of the changes to a file. I've realized that won't work as the files sizes could ...
morgro269's user avatar
14 votes
1 answer
1k views

I am testing two different implementations of printf on my system: printf (GNU coreutils) 8.26, and the version bundled with zsh 5.3.1. I am testing how half numbers are rounded, i.e. for 1.5, 2.5, 3....
Sparhawk's user avatar
  • 20.6k
0 votes
1 answer
3k views

I know that both of them can do simple arithmetic. I'm wondering when it will be easier to use one versus the other. I know that expr evaluates an expression from its arguments, while bcl evaluates ...
Hurricane Hamilton's user avatar