44,468 questions
1
vote
1
answer
31
views
Unexpected token in Hyperbolic geometry undecidability proof with lean 4
I am trying to use Lean 4 to reduce the halting problem to hyperbolic geometry to prove the undecidability of hyperbolic geometry, having problems with the diagonalization of the Turing machines, also ...
-2
votes
0
answers
23
views
accumulator problem to know which set contain a element? [closed]
Problem statement.
Given :
Set1 = (a * b * c * d * ……) MOD N
Set2 = (e * f * g * ….) MOD N
c, g.
We want to know from which set c and g belong, see we only have the above final value’s {
set1, set2, N,...
0
votes
1
answer
33
views
How to calculate percent difference among 2 or more numbers
I have a dataframe with two columns. (It can have more data columns)
I want to sort by values according to the volatility of each row.
For example,
import pandas as pd
import numpy as np
df = pd....
0
votes
0
answers
18
views
Is the image rotation function (as seen in Word or PowerPoint) a Group?
I have been thinking of this problem for a while now, but can't seem to figure it out. We are all familiar with adding an image in a PowerPoint file, say for example, a square. We can rotate however ...
-1
votes
0
answers
49
views
My Exponential Moving Average calculations are still somehow wrong?
Where am I going wrong...
Here is my Python code which interacts with the MetaTrader5 API.
import numpy as np
import MetaTrader5 as mt5
import pandas as pd
from sklearn.preprocessing import ...
1
vote
2
answers
57
views
Convert float base 2 to base 10 to 100+ decimal places [closed]
I'm trying to find more decimal places to the 'Prime Constant'. The output maxes out at 51 decimal places after using getcontext().prec=100
from decimal import *
getcontext().prec = 100
base = 2
s = &...
0
votes
0
answers
55
views
How to check if 2 doubles are relatively equal in C language? [duplicate]
I'm working on some old C code that checks if two doubles are relatively equal. It works most of the time but sometimes it says the 2 doubles aren't equal even though the Print statement shows they ...
1
vote
1
answer
75
views
Finding the Minimum Distance Between a Circle and a Line in 3D Space
In 3D space, I want to find a point Pc on a given circle and a point Pl on a given line such that the distance between Pc and Pl is minimized. How can I calculate these points?
I have tried finding ...
1
vote
1
answer
124
views
Prime-k solution doesn’t go above certain number in c++
Im currently trying to solve the prime-k factor problem, where I have to find the sum of all primes factorial 1-5 ! and then mod(%) to itself. An example would be the prime 7.
(7-1)!+(7-2)!....(7-5)!=....
1
vote
0
answers
23
views
Prometheus increase() and delta() functions returning results that are exactly x2 higher than expected
I have a Prometheus metric to count the number of successfully processed messages in a given queue:
counter_success{queueName="myTestQueue"}
Here is the output graph for this query:
My ...
-2
votes
0
answers
34
views
How to determine the latitude and longitude of a sighting at sea level from a raised point on land [closed]
First off, I am new to Swift, but have been a software systems engineer for the last 40 years. I am fluent in C, C++, Java and Python.
I have implemented a version of the following solution in Python ...
-2
votes
0
answers
26
views
Get a size of a vertex in oriented graph with weights [closed]
I am working with graph algorithm of circular laying attributed hierarchical graph with ports and there is a term in it that I do not understand. It is the size of a graph vertex. Moreover, in such a ...
1
vote
1
answer
55
views
How do I make an algorithm for tracing lines given a set a points?
I need an algorithm to position lines on a set of points in a 2D environment. The algorithm should identify collinear points within a specified tolerance and place lines accordingly. Each resulting ...
0
votes
1
answer
70
views
Point inside circle
I want to check if a point Q is inside a circle (P1, P2, P3) but I'm having problems when the point is part of the circle because the last condition return it as false when it should be true, this is ...
0
votes
3
answers
65
views
How to do a gaussian blur without modifying the original pixels?
Given an image such as below, I want to blur it such that none of the original black pixels change in value. The blur should have a nice S curve fade-off to white.
If I apply a 15px gaussian blur to ...
0
votes
1
answer
75
views
Sympy running without providing solution given initial conditions
I have 2 differential equations I am trying to solve. Running the code below takes about an hour on my computer before it outputs a very long equation if i do not include the initial conditions. I ...
0
votes
1
answer
55
views
Dividing in SQL Server (calculate Weekend Transactions as a % of Total transactions) [duplicate]
I need to calculate "% Weekend Transactions" dividing Weekend Transactions by total number of transactions.
The column transaction_date of the Transaction_data table has of course a date ...
0
votes
0
answers
52
views
How many ways are there to distribute k balls into m groups such that each group has at most t elements? [closed]
How many ways are there to distribute k balls into m groups such that each group has at most t elements (with the possibility of having 0 elements in a group)?
In fact, this problem stems from: There ...
2
votes
2
answers
80
views
Numerically integrate function with parameters
I have an integrand function f(x) that depends on x and several other parameters, a1, a2, a3, etc. This function could be hard or impossible to integrate symbolically via SymPy; that's why I want to ...
-4
votes
1
answer
51
views
Calculate the value of an angle in JavaScript [closed]
Im trying to make a code that calculates the value of an angle in a right angle triangle provided its sin, cos or tan. For example, in a calculator, if you have the value of sin(x) and you want to ...
1
vote
1
answer
22
views
How to colour each number differently in latex subscript
I have the following latex I am using in Lucidchart application:
\omega_{11}^{\ell}
I want the first 1 to be a red colour and the second 1 to be a green colour. How do I achieve that?
I have tried ...
1
vote
3
answers
45
views
Searching for points inside a circle on a sphere surface
I have many points scattered on a sphere surface. I need to find which of them are inside an arbitrary circle drawn on the surface.
This looks like it'd require some sort of space partitioning but I'm ...
1
vote
2
answers
96
views
How to find if four lines make a quadrilateral, either convex or concave?
How can I detect if any given four lines make a quadrilateral, be convex or concave, and if they make more than one quadrilateral, in c++?
For example, with this:
There is this one:
And this one:
I ...
0
votes
0
answers
30
views
Some Cube solver using Python/SageMath
I'm new in SageMath/Python and I try to use the Tiling Solver.
I failed to retrieve the 240 expected solutions of the Soma Cube (see the Wikipedia page).
Here's what I've done so far:
from sage....
-2
votes
0
answers
66
views
Sum of the least common multiples of subsets
Problem Statement
Given a set of n positive integers, you need to calculate the sum of the least common multiples (LCM) of all non-empty subsets of the given set.
Since the result can be very large, ...
0
votes
0
answers
43
views
Cycling of Lexicographic simplex method
I am studying the cycling of simplex method. I know that there is a lexicographic rule to prevent looping of the simplex method, and I also know that this rule should be applied to a lexicographically ...
-1
votes
0
answers
27
views
dashboard that shows uptime percentage from oci-metrics-datasource oci_healthchecks?
I've been asked to create a dashboard to show uptime \ pass rate as a percentage from a high level external monitoring ping to our services rest api.
When importing the data into Grafana, using the ...
0
votes
1
answer
26
views
How to use trigonometric functions in .vdmrt files?
I am attempting to perform this operation in my program:
x := x + sin(y) * 0.05;
However the error Name 'sin(real)' is not in scope(3182) is returned.
I've tried to import what I think is the MATH ...
1
vote
0
answers
19
views
How to Implement Drone Identification Using Camera, Coordinates, and Orientation in React Native?
I’m developing a feature in a React Native application where I need to open the camera and point it towards drones flying in the air. The idea is to identify a specific drone by cross-referencing its ...
0
votes
2
answers
42
views
2D Canvas JavaScript | How do I draw a circle in canvas that is set to a defined number of degrees?
I simulate an interactive view for a player. As long as a component of the game is within the view width, it should be possible to interact with it. With my code, it is not a problem to play the ...
1
vote
1
answer
59
views
How does Meshlab actually do edge decimation
When using meshlab, if one selects the decimation operation a textbox opens up saying:
Simplify a mesh using a quadric based edge-collapse strategy. A variant of the well known Garland and Heckbert ...
0
votes
0
answers
16
views
How does the calibration method by Toscani and Faugeras work?
First, I tried a basic approach to get the parameters of the camera.
In the matrix A, you have the two equations that a 3D point can give (multiplied by the number of points):
Because we have uZ -uoZ -...
2
votes
2
answers
87
views
Calculate rotation to have div in "front" when parent container is rotated (Solved)
I have a problem to calculate the good angle to rotate a div child of a div rotated on x axis.
To make it more understandable, I did a fast draw of what I have :
In a scene with configurable ...
0
votes
1
answer
62
views
Mathematical Predicate Equality in Java
I am writing a class PredicateSet in Java to model the mathematical definition of a countable set using predicates to accept or reject membership. But I am having trouble coming up with an equals ...
0
votes
1
answer
44
views
How to register a set of points with subset of points?
I have a set of points (let's say 10000 points), which are detected with much time.
Then, some points (let's say 100 points) are quickly detected, which should be included by the 10000 points. The ...
0
votes
0
answers
35
views
Resize rotated rectangle with skew
can you please tell me how to calculate the compression of a rectangle in svg. let's say there is a rectangle with x0, y0, w100, h100, r45, it is in an imaginary box, I have reduced this box by 50px, ...
0
votes
0
answers
31
views
Backtransforming standard errors from scaled variables
I use data with scaled values based on this dataset I made a model such as :
data <- data.frame(
X1 = c(1.2, 2.3, 3.1, 4.8, 5.5, 4.6),
X2 = c(10.4, 9.3, 8.2, 7.1, 6.0, 5.2),
X3 = ...
-2
votes
1
answer
47
views
Issues when revolving an object around 2 axis(C#)
I have some C# code here, which rotates the camera around the player
The BasePosition is the camera's position used for calculation and the CoreCamera is the camera, The Anchor is the anchor
...
0
votes
0
answers
54
views
Rotating a 2D polygon to always face camera in 3D space
I'm adding arrowed lines on a mesh in PyVista. I want the surface of lines to always face the camera without changing it's starting and ending axis.
When I add the arrowed line polygon, it's surface ...
3
votes
2
answers
118
views
Using SciPy minimize to solve the Catenary problem
I am attempting to use SciPy optimization to find the function that minimizes the potential energy of a hanging rope between 2 points, the catenary problem. The objective function is defined by
The ...
2
votes
1
answer
80
views
Why are mathematical constants truncated differently in powershell?
I was doing some command-line math in powershell and ran into to the following curiosity.
# "{0:f64}" -f ([Math]::PI); "{0:f48}" -f ([Math]::PI)
3....
1
vote
2
answers
147
views
How to prove that "i & (i - 1) == 0" means "i is the power of 2"
If we know beforehand that i must be something like 10...0, it's not hard to imagine.
But how to mathematically prove that i & (i - 1) == 0 is sufficient to say i is the power of 2, at lease for ...
0
votes
0
answers
38
views
How to get distance between an object and viewpoint after rotating projected 3D coordinates on a 2D plane?
I have a question related to projecting 3D xyz coordinates to a 2D representation in a window. So far, I have succesfully created a 3D world where the coordinates are happening correctly. I have also ...
0
votes
2
answers
32
views
R calculating Decreasing Rolling Percentage with fixed start point across data frame
I have a data frame below, would like to add a column call Percentage.
Sort by each Trade
In CofQYr == 0 row, Percentage would be row Sum across all columns (from 2014 5o 2024) divide by the row sum ...
2
votes
1
answer
56
views
How can I simulate firefox animation behaviour on chrome when using calcMode="linear"?
I have two charts, the first one plots two functions, predators and prey. Each containing a circle with an animateMotion that goes along the function path.
The other chart is a phase curve generated ...
1
vote
0
answers
25
views
The problem with the movement and behavior of the ghost indicator when dragging items in PySide6
I am working on an application on PySide 6, which implements the function of dragging elements to change their order. In the program, the user can create elements (such as TextElement, HeaderElement, ...
1
vote
1
answer
49
views
Why are the percentages mixed up after the webpage has been running for a day?
In this code, the month is supposed to reset "every month of the week", "every week and day", and "every day."
Based on how the code is written, when it runs for a single ...
-1
votes
2
answers
113
views
calculate shift hours with break time deductions starting from current night to next day morning using google apps script [closed]
I'm trying to calculate the shift hours in a day, accounting for different types of shifts (Normal, Evening, and Night), and also considering overlapping break times during those shifts. Here's the ...
-1
votes
1
answer
48
views
Constraining a number to a looping range. Is there a more elegant function? [closed]
Take this function
func f(x,y) => x % y
Given the following inputs, here are the corresponding outputs.
f(0, 30) => 0
f(7.5, 30) => 7.5
f(15, 30) => 15
f(22.5, 30) => 22.5
f(30, 30) =&...
-1
votes
1
answer
40
views
What's the problems in my custom layernorm function?
import numpy as np
import torch
import torch.nn.functional as F
def layer_norm(x, weight, bias, eps=1e-6):
# x shape: [bs, h, w, c]
# Calculate mean and variance across the spatial dimensions ...