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
3
votes
2 answers

adding Calculation row to PivotTable in r

here's my data df=data.frame("indication"=c(1,1,0,0,1,0,1,1),"indication2"=c(1,0,1,0,1,0,0,1),"grade"=c(65,67,80,20,100,91,70,55), "group"=c("blue","red","green","blue","green","blue","red","green")) indication indication2 grade group 1 …
nomi
  • 91
  • 7
3
votes
2 answers

Pandas: Dataframe Calculation - New Rows with Division, New Columns with Sums and Averages

So i got an Pandas DataFrame that looks like this: import pandas as pd df1 = pd.DataFrame([[5618, 5863, 8873, 7903, 9477, 7177, 7648, 9592], [5698, 6009, 8242, 7356, 6191, 8817, 7340, 11781], [5721, 6858,…
krat0r
  • 33
  • 3
3
votes
2 answers

Calculating a Grand Total Based on Other Totals Vanilla JavaScript

I followed a tutorial to make a shopping cart that uses localstorage. Now I'm trying to make adjustments to it to fit my own needs to expand my knowledge of JavaScript and to give myself more practice. The instructor made a div for each of the…
redliz5808
  • 97
  • 1
  • 10
3
votes
1 answer

how to correctly measure print size & distance from web?

I'm trying to build a t-shirt printing website and I'm currently stuck on how to correctly measure/calculate the position of the print on x/y axis and the print size itself. You can get the idea of what I mean by visiting spreadshirt selecting…
ctf0
  • 6,991
  • 5
  • 37
  • 46
3
votes
3 answers

Need help in calculation 1+2+3+4...+n?

So I'm assigned to write a program, which asks a number (n) and then makes a addition like this: 1+2+3+4...+n and prints the addition I keep getting wrong numbers though and can't figure out what is wrong? import java.util.Scanner; public class…
pakkis26
  • 53
  • 2
3
votes
1 answer

SSAS MDX Calculation - Sum based off a group value

I work for a hotel company and I have set up a fact table with the granularity of a stay night for each guest, e.g. if a guest stays for 3 nights, there would be a row for each night of the stay. What I am trying to do is create a measure for the…
Femmer
  • 133
  • 12
3
votes
2 answers

How do I calculate a ratio from 2 numbers and return an equivalent list of about 1000 numbers?

I was online at this amazing site for equivalent ratios. I would love to mimic or do the same as an output in python, but its a bit over my skills. Can you help me put it in this format, here is what the first 3 pairs would look like in the output…
Tom E. O'Neil
  • 527
  • 4
  • 10
3
votes
2 answers

Calulate two random numbers in flutter

I'm trying to generate two different random numbers and add those together, but Flutter doesn't seem to like my math. I keep getting the message that '+' isn't defined for the class Random. import 'package:flutter/material.dart'; import…
J.W
  • 1,135
  • 4
  • 13
  • 21
3
votes
7 answers

Python: How do I calculate the sum of numbers from a file?

How do I calculate the sum of numbers from a .txt file? Data in file is formatted as: 7 8 14 18 16 8 23 ... I read the data from the file and assign every line value to 'line' vatiable, but I want to get something like: result = 7+8+14+... f =…
coredumped0x
  • 768
  • 1
  • 12
  • 28
3
votes
2 answers

Can't get fixed setprecision doubles to show decimal places

I'm brand new here so I apologize in advance if I don't format this correctly. I have a C++ assignment that requires me to take a data file, process it, and then output a data file. I think I've done the input and output correctly, but my…
Joe Butto
  • 31
  • 2
3
votes
3 answers

How to change list values in dictionary in python?

I have a dictionary like this, {'A':[[1,30],[40,50],[60,79]] 'B':[[2,23],[26,43],[59,119]] 'C':[[1,100],[149,167],[199,250]] ... } I had the MAX value which is 600. Is it possible to calculate the difference between…
Jiayu Zhang
  • 719
  • 7
  • 22
3
votes
3 answers

Convert days in decimal to years, months, days, hours, minutes and seconds

What I have: A spreadsheet in which Column C consists of number of days in decimal format. What I need: I need Column E to convert the value of Column C to years, months, days, hours, minutes and seconds. What I've tried: The following formula works…
3
votes
3 answers

Modulo - calculations error

Let me be brief. I'm trying to calculate alert((Math.pow(7,35))%71) but it gives me 61, when the result must be 70. What's wrong?
3
votes
4 answers

Angular4 - Calculation in style bindings

Is there anyway you can do calculation in the style binding target in Angular4 ? I've tried [style.width]="{{1+1}}" [style.width]="{{1+1}}px" [style.width]="{{1px+1px}}"
ekclone
  • 1,030
  • 2
  • 17
  • 39
3
votes
1 answer

Displaying Calculations On different html pages, from a javascript

I'm a total noob at this, just learning HTML and JavaScript. I am making a step by step how to draw a Sri Chakra, there are calculations you have to make for each step, and I want them user to just input a number, after which all of the formulas…