Questions tagged [calculation]

Mathematical operation or series of operations which takes some input and gives an output.

A calculation is at the simplest level the execution of some mathematical equation. Based upon the composition of this equation, including variables, operators or more complex functions implementing user-defined logic, a particular calculation can be very crucial to the correct operation of an overall system.

In software there are many different mathematical operators which may make up an equation a calculation executes:

  • Addition (+)
  • Subtraction (-)
  • Multiplication (x)
  • Division (/)
  • Bitwise AND (&)
  • Bitwise OR (|)
  • Bitwise XOR (^)
  • Bitwise NOR (~)
  • Bitwise LSHIFT (<<)
  • Bitwise RSHIFT (>>)
1579 questions
4
votes
2 answers

How can I calculate the number of months between two given dates ( baseline and follow-up)

I'm trying to determine the number of months between baseline and followup my date looks like this ------------------------- | Baseline | Follow_Up | ------------------------- | 10/6/15 | 10/10/17 | | 10/6/15 | 4/20/18 | | 10/6/15 |…
Mr.M
  • 111
  • 1
  • 9
4
votes
2 answers

Calcuation Result Always 0

I'm trying to write a very simple program to calculate liquid nicotine strengh. Basically it's (strengh / nicStrengh) * amount. And it always comes out as 0. private void lblCalculate_Click(object sender, EventArgs e) { int strengh =…
inFlux
  • 45
  • 5
4
votes
1 answer

LibreOffice writer field calculations

In a LibreOffice writer document with a field of #temperature_farenheit. Is there a way to create a field named #temperature_celcius that would automatically calculate and insert the correct temperature? And if this is possible, what types of…
BrianWilson
  • 1,653
  • 2
  • 12
  • 16
4
votes
2 answers

Application Calculate from VBA - Ignore Volatile Functions

Question Is it possible to efficiently simulate the result of application.calculate from VBA, but ignoring volatile functions? Detail Definition: Non-Volatile Equivalent: For any volatile workbook, define the non-volatile equivalent as the workbook…
Colm Bhandal
  • 3,343
  • 2
  • 18
  • 29
4
votes
1 answer

Why does the CRC of "1" yield the generator polynomial itself?

While testing a CRC implementation, I noticed that the CRC of 0x01 usually (?) seems to be the polynomial itself. When trying to manually do the binary long division however, I keep ending up losing the leading "1" of the polynomial, e.g. with a…
David Schneider
  • 472
  • 5
  • 13
4
votes
2 answers

Calculating frequency

I'm creative a forum and want to calculate the frequency of new posts per day. So, each post has timestamps: $post_1 = 1526083200; $post_2 = 1524083200; $post_3 = 1523083200; $post_4 = 1522083200; What calculation do I do to find out how often…
Henrik Petterson
  • 6,862
  • 20
  • 71
  • 155
4
votes
2 answers

How to find coordinates of a point where 2 points and distance are given with Javascript

I have the coordinates of 2 points A1 (x1,y1) and A2 (x2,y2) and a distance d. I need to find the coordinates of point A3 that is the distance d from point A2 on the linear graph defined by A1 and A2. How can i do that with JavaScript? similar to…
user24957
  • 315
  • 3
  • 11
4
votes
3 answers

Android calculating Velocity wtih Accelerometer data

Due to the power consuming GPS data, I would like to calculate the device speed with only the accelerometer x,y and z data. I have read a lot of questions about this topic and I tried many set-ups to find a satisfactory solution to calculate the…
Frits Molenkamp
  • 175
  • 1
  • 10
4
votes
1 answer

How to account for the observer's elevation when calculating sunrise/sunset?

How to account for observer elevation when calculating sunrise/sunset? Calculating sunrise/set for any lat/longitude is no problem, but how to account for elevation instead of sea-level??? I've run out of combinations to try, and having spent over…
Stephen J
  • 41
  • 3
4
votes
6 answers

Calculations with arrays with a for loop in java

I'm making a calculation in java with arrays here's the code, I have 3 arrays: int pag_size; int pag_array_size=pag_size*4; int[] pag = new int [pag_size]; int[] marc = {5, 6, 1, 2}; int[] calc1 = new int[pag_array_size]; and I'm adding the…
3
votes
3 answers

Indefinite integral of 1/(L-x) dx in sympy python

I tried to calculate the indefinite integral of 1/(L-x)dx in sympy: from sympy import * x, L = symbols('x L') f = 1/(L-x) integrate(f, x) it returned: -log(-L + x) while it should be: -log(L-x) Is it related to sympy or I missed something,…
Hadi Pourbagher
  • 151
  • 1
  • 5
3
votes
1 answer

Curious case of efficiency of equation algorithm, why are more operations faster?

I lately wrote a bit that shall smooth out the extends of a 0-1 range. Out of curiousity I measured the performance of two possibilities to acchieve the same end result. What came out is that this: _ = (Mathf.Sin(-1.57079633f + (time * 3.14159265f))…
CBX_MG
  • 93
  • 8
3
votes
1 answer

Double integral in R with variable in the bound

How can the below integral be calculated in R? : The difficulty is that in the inner integral the upper bound contains one of the variables. Anyone knows ? The result must be : 0.0104166666666667
Homer Jay Simpson
  • 1,043
  • 6
  • 19
3
votes
0 answers

Using a Python dictionary value in a calculation

I have some Python code that takes user input for mass and diameter of an object. Those data parameters I later use in a calculation formula. Instead of having the user input those two values, I now have a dictionary that stores the values. How can…
Iridium
  • 31
  • 1
3
votes
2 answers

(Edit) I wrote same code with Swift and C lang(Find Prime number), but C lang is much faster then Swift

(There has some Edit in below) Well, I wrote exactly the same code with Swift and C lang. It's a code to find a Prime number and show that. I expect that Swift lang's Code is much faster than C lang's program, but It doesn't. Is there any reason…
Luna
  • 43
  • 7