46,083 questions
2
votes
1
answer
169
views
diverging std::atan2's unit of least precision
I write a cross-platform program for Windows and Linux, and I would like it to behave as similar on both platforms as possible. I use some mathematics in the program, e.g. std::atan2 function calls, ...
2
votes
1
answer
117
views
What does <string>:2(__init__) have to do with mathematical computations?
I'm in the process of writing some mathematical operations. Here's a sample program to give you an idea of what kind of thing I could be doing:
from dataclasses import dataclass
import random
@...
Advice
1
vote
1
replies
73
views
Math for incrementing a counter for a very large progress bar where total doesn't fit in an int
There is a progress indicator with 100 steps. However, the total number of items being processed is much too large; it doesn't fit in a register. Thus, the simple way of V = (P * 100) / T is ...
Advice
2
votes
3
replies
108
views
Reverse-engineering CRC checksum algorithm from an oracle
I have an embedded device that implements an unknown 32-bit CRC-based checksum algorithm in hardware. I can use this device as an oracle to generate checksum values from arbitrary input, and verify ...
Best practices
3
votes
6
replies
142
views
Avoiding array duplication in big integer routine
I am working on a multiplication routine in a big integer library in POSIX C99 with a signature of bigint_st *bigint_mul(bigint_st *dest, const bigint_st *a, const bigint_st *b). Many of the routines ...
-1
votes
0
answers
72
views
Convert a 2D point (x, y) to 3D coordinates on plane y=-50
I have a 3D rasterization rendering program on scratch.mit.edu, which has proper movement and rotation matrices for yaw and pitch (not roll). The grid is located on y=-50, and I have near plane and ...
Advice
0
votes
4
replies
56
views
Intentionally Constructing Hash Collisions
I want a simple hashing algorithm with the following conditions:
1,) if n is a ten-digit integer, eg, 1234567890, then the hash of n will equal the hash of all (left-justified) sub-strings of n. As in,...
2
votes
1
answer
201
views
Accurate computation of the inverse gamma function with the standard C math library
The inverse of the gamma function over the reals is multivalued with an infinite number of branches. This self-answered question is about the principal
inverse of the gamma function, Γ0-1(x), whose ...
Advice
0
votes
1
replies
79
views
Generating SageMath codes to solve this elliptic curve equation
I was working on this elliptic curve equation: y^2 = x^3 - 228n*x - (432n^6 - 1368n^3 - 361) and using SageMath, I have been able to develop rational points for the cases n = 1, 3 and 4. For the case ...
Advice
0
votes
13
replies
210
views
Which algorithm does the truncate function use in c++
I'm wondering how the truncate function works. C++ is just an example i'm using because it's a language I know. I've searched online and I can't seem to find how it works, simply how to use it and ...
Advice
0
votes
0
replies
126
views
How to properly change the font family of KaTeX math text that also looks nice on stretched/large glyphs?
I was asking ChatGPT about how to take a custom-designed monospaced font, and specifically how to make the "stretchy math glyphs/constructs" (parentheses, brackets, braces, integrals, ...
Advice
1
vote
9
replies
114
views
Sum of a binary tree
I have a binary tree which leafs have a size of 1, and the parent double in size at each level.
I project those nodes on a linear axe (memory space).
I need to get the equation that gives the adress ...
9
votes
2
answers
382
views
Finding a maximum "score" of a permutation
Consider an array of a permutation P of length n (n > 2), namely some order of the integers 1 through n.
Example of P with length n = 7,
[6,5,2,3,7,1,4]
A "score" of a permutation is ...
-3
votes
1
answer
51
views
Auto converting typed math to Latex/Mathjax [closed]
I use a learning management system from my coaching classes, and due to copyrighted material, I can't share screenshots here. However, I'm attempting to convert typed math to Latex/Mathjax math ...
0
votes
2
answers
112
views
Weighted percentages
I have a problem on how to calculate "partial" percentages that match the "total" percentage.
My problem is as in the table below.
I have values for the beginning and end of the ...