Questions tagged [math]
Math involves the manipulation of numbers within a program. For general math questions, please ask on math.stackexchange.com. Note: If your question is about unexpected results in floating point calculations, please read https://stackoverflow.com/questions/588004/is-floating-point-math-broken first.
44,362
questions
-1
votes
0
answers
12
views
Get the next building upgrade in monopoly
Each street in Monopoly is comprised of 2 or 3 different properties.
When a user upgrades a street, it will build 1 of 3 buildings on the appropriate property.
House - least valuable, will build this ...
1
vote
0
answers
30
views
Determine next building upgrade in Monopoly
Each street in Monopoly is comprised of 2 or 3 different properties.
When a user upgrades a street, it will build 1 of 3 buildings on the appropriate property.
House - least valuable, will build this ...
2
votes
3
answers
33
views
Find the smallest polygon with a certain edge on a 2d dijkstra graph
Sorry for bad English.
I'm currently working on some algorithm to seperate a graph into rooms. Like the example.
I have a graph link like the one in left, I want to tell there are 2 rooms in the graph,...
0
votes
0
answers
55
views
Integer solutions for equation with approximated real variable
I'm trying to solve an equation of the kind:
f1(x)*m^2 + f2(x)*m*n + f3(x)*n = 0
for given x real defined up to a certain precision, f1, f2, f3 given linear functions and m and n positive integers, ...
1
vote
2
answers
43
views
Graph traversal algorithm: when it is possible to move to the next node only after having visited it earlier with all incoming edges of the graph
There is a graph that consists of vertices (industrial installations) and edges flows of raw materials, intermediates and products between this nodes.
I need some kind of algorithm for "...
-3
votes
1
answer
41
views
Extract specific columns from a table based on a value [closed]
Trying to extract column values (type, xxx, yyy, hhh, Ci) based on "W" column value from "Sheet2" table:
Sheet2
Sheet1
I tried some index and match functions, but it didn't work ...
1
vote
1
answer
39
views
Function to rotate a quaternion by the given amount
class quaternion:
__slots__ = ("x", "y", "z", "w")
def __init__(self, x: float, y: float, z: float, w: float):
self.x = x
self.y = y
...
0
votes
0
answers
24
views
Conversion between euler and quaternion rotation produces incorrect results when using multiple angles
I'm trying to apply a previous answer to my code, I double-checked it on multiple sites where others came up with the same algorithm independently, but no matter which version I use I can't get the ...
-1
votes
1
answer
73
views
Is there a way to simplify a fraction including decimals? [duplicate]
Whenever a user inputs a fraction, it might be contain decimals (long double). I have some code (C++) below to show how I implement this:
class Fraction
{
public:
long double numerator, ...
2
votes
2
answers
68
views
How to locate the most sparse point within a defined 2D region?
The core of the problem is to algorithmically determine the coordinates of the point E that maximizes the distance to the nearest other point in the bounded 2D space.
For example, in the space defined ...
-1
votes
4
answers
81
views
Mathematical condition in C
Im a CSE fresher. I found this code on w3school and dont know whats going on.
#include <stdio.h>
int main() {
// A variable with some specific numbers
int numbers = 12345;
// A ...
0
votes
0
answers
10
views
Can I include a variable related to the outcome variable into statistical analysis?
My research question is about intra-individual variation, meaning how the variaion in the personal level is associated with other variables. The study population reported their behaviour for three ...
1
vote
2
answers
72
views
Discrete mathematics: Simulate the probability question [duplicate]
Problem
There are 1, 2, 3, 4 number card in a bag.
If you pick up 1, add one white ball into box_b.
If you pick up 2 or 3, add one white ball and one balck ball into box_b.
If you pick up 4, add two ...
1
vote
0
answers
17
views
Add Bearing (WITH N,S,E,W) AND DISTANCE (M) To another coordinates (LAT, LON)
Good morning.
I would like to know how do I add kilometers to a map point (latitude / longitude).
For example: The city Jaraguá do Sul is in latitude -26.462049, longitude -49.059448. I want to add ...
1
vote
0
answers
24
views
What is the most efficient way to detect when a moving 3D position entered a new area delimited by a fixed scale?
Context: I have a CPU based raytracing engine written in Pygame, it works by having rays move 1 unit per loop in the direction of their velocity and detecting any voxel at that integer position. I ...