# Questions tagged [math]

7,151 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2kviews

### The correct bone data to export from blender to view in ogl?

Edit (Original post below): So I have come up with the following code. I can export the mesh, bone structure and animations. I can animate a simple skeleton. But for some reason if I animate more ...
421views

### In Idris, why do interface parameters have to be type or data constructors?

To get some practice with Idris, I've been trying to represent various basic algebraic structures as interfaces. The way I thought of organizing things at first was to make the parameters of a given ...
815views

### Correctly compute the divergence of a vector field in Python

I am trying to compute the divergence of a vector field: Fx = np.cos(xx + 2*yy) Fy = np.sin(xx - 2*yy) F = np.array([Fx, Fy]) Analytic Solution This is how the divergence (div(F) = dF/dx + dF/dy ) ...
626views

### Synchronize transform matrix of superview and individual views in different coordinate space

Given following view hierarchy: root (e.g. view of a view controller) |_superview: A view where we will draw a cross using core graphics |_container: Clips subview |_subview: A view where ...
5kviews

### How does one divide a big integer by another big integer?

I've been researching this the last few days and I have been unable to come up with an answer. I have come up with one algorithm that works if the divisor is only one word. But, if the divisor is ...
190views

### How to get sympy to give solutions with smaller coefficients

Consider the following example Diophantine equation -118w + 989x + 918y -512z == 0 You can solve this in sympy with: import sympy from sympy.solvers.diophantine import diophantine w, x, y, z = ...
146views

### Testing which trits are set in a binary representation

I have a problem for which I have eight elements that can contain 0, 1, or 2. I can easily represent this in 16 bits, but for SIMD efficiency reasons, I need it to occupy 13 bits (it is not the only ...
731views

### Which axioms may be safely added to Coq?

This question is a request for references or explanation. The main idea is: What if I add every axiom from standard library of Coq? Will it raise a contradiction or they are well-adjusted to each ...
103views

### Isabelle/HOL sequents: meaning of types o, seq', meaning of nonterminals seq, seqobj, seqcont

I am trying to understand https://www.cl.cam.ac.uk/research/hvg/Isabelle/dist/library/Sequents/Sequents/Sequents.html and https://www.cl.cam.ac.uk/research/hvg/Isabelle/dist/library/Sequents/Sequents/...
775views

### Increasing accuracy of solution of transcendental equation

I have a specific kinematics as a part of a more complex machine and need to compute some physical parameters that are very hard (more like impossible) to measure with proper accuracy with instruments ...
1kviews

### Augmented Reality Bearing/Heading/Azimuth confusion. (iphone ARKit code)

- (float)angleFromCoordinate:(CLLocationCoordinate2D)first toCoordinate:(CLLocationCoordinate2D)second { //first is origin //second is point float longitudinalDifference = second.longitude - first....
216views

### Optimal covering with non-uniform discs

What kind of algorithm can I use to search for an optimal (minimum area) covering of a limited region of the XY plane with n discs ( xj, yj, rj ) ? I've found many investigations on fixed radius discs,...
2kviews

### Calculate SMA's Slope in pine script

I'm want to calculate the slope for the Simple Moving Average's (SMA). I have already tried the following code which is mathematically correct. rad2degree = 180/3.14159265359 //pi sma2sample = sma(...
254views

### Implementing a custom datatype in Sympy

I want to perform calculations with a binary operation (Tensor) that takes two non-commutative arguments, converts them into something like a pair, and then does funny things when I multiply these ...
416views

### Point/Feature detection from upper and lower threshold of curvature - Curvilinear Quadrilateral Shape Detection algorithm

Is it possible to create a polygon from a set of points along a line with rough curvature, such that the points are selected between two values of curvature? I am attempting to retrieve an ...
3kviews

### Line offset (parallel lines) without cusps

I'm trying to draw lines with offset to main line like on attachment. I have problems with my code. It generating intersections and cusps on the lines. (attachment) Maybe someone can help me with ...
1kviews

### Parametric equation to place a leaflet marker on the circumference of a circle is not precise?

I am working on an application where I have the center of a circle and the radius and I am plotting the circle with the help of Leaflet. I placed a marker on the north most end of the circumference ...
2kviews

### AS3 - geometry - perspective projection of a point on a 2D plane

I'm currently struggling on a problem that seems far beyond my maths capacities (been a long time since I've made some proper maths...) and I would appreciate some help on that. Here's my setting : I ...
6kviews

### Calculating a quad curve between two xy points

I have two (x,y) points start and end. I want to animate from start to end but instead of going a linear way I want to create a curved path. I am quite sure I'm not looking for an easing because I ...
5kviews

### Rounding away from zero in Javascript

We are building a table in Javascript with Handsontable representing currency amounts. We give the user the possibility of render the amounts with two decimal places or no decimal places (it's a ...
167views

### Checking condition on matrix/array element-wise modulo an integer

My aim is to check whether a matrix (i.e. a 2D array) modulo d is Symplectic (see condition on wikipedia: https://en.wikipedia.org/wiki/Symplectic_matrix). That is, whether there is any Symplectic ...
118views

### Why is the calculation result different between sassmeister and local environment?

I do complicated calculations. For example, the following mixin returns 0.00000096 for SassMeister (used in compiler dart-sass v1.18.0). But with gulp-dart-sass this gives different results (9....
298views

### How to call a julia method defined in an imported package from c++?

I need a c++ library to compute the polygamma function for complex arguments. After some googling that brought me to this https://scicomp.stackexchange.com/questions/23194/i-am-searching-for-c-code-of-...
611views

### Find minimum number of triangles enclosing all points in the point cloud

Input You have a points list which represents a 2D point cloud. Output You have to generate a list of triangles (should be as less as possible triangles) so the following restrictions are ...
474views

### Matrix indexes with ejml (or other Java libraries)

I'm using ejml library for writing mathematical algorithms in java. I think it is pretty useful, but I need to know if there is a fast mode (like print()) to print a matrix with indexes. Example: ...
226views

### Problems with including math parser "exprtk"

Instead of programming a math parser myself, I'm trying to implement the exprtk (exprtk) into my project. It works fine if I implement it in a console project. However, it fails in my CLR project. The ...
252views

### Feedback on ranking algorithm options for my website

I am currently working on writing an algorithm for my new site I plan to launch soon. The index page will display the "hottest" posts at the moment. Variables to consider are: Number of ...
955views

### Photoshop Photo filter math

Photoshop has a nice feature called Photofilter (Adjustments > Photo Filter). I've tried to understand the math behind it but no luck. It's not a standard blending and not a multiplication. By ...
2kviews

### How to show math equations in QTextEdit?

Does anyone know how to show mathematical equations in QTextEdit written in any format (TXT, MathML, MML, LaTeX, HTML, XML or anything) using only Python, that is without using 3rd party packages like ...
201views

### Three argument pow for arrays

pow accepts a third argument for modulo pow(x, y, z) that is more efficient computation than x ** y % z. How can you do that with arrays? What I've tried: >>> import numpy as np >>> ...
78views

### Find min(A[L], max(A[L+1], min(A[L+2],...,a[R]))) in range

Give array A consist of N (1 <= N <= 10^5) positive integer less than 10^6. Given Q (1 <= Q <= 10^5) queries, for each query of the form (L, R) (1 <= L <= R <= N), print out: min(...
160views

### C++ How std::fmod avoids round-off errors when calculating mod(a,b) for a which is much bigger than b

I have a small function to calculate mod as follows: double mod(double a, double b){ return a-floor(a/b)*b; } mod(1e15,3) returns 1 correctly, but mod(1e16,3) returns 0 due to numerical round-off ...
263views

### Numpy Convolution implementation for mode = same

I hope I chose the right platform for this question (wonders if it’s more related to math exchange or computer science). In any regard, I’ve read about convolution in signal processing and I want to ...
367views

### Prove that the powerset of a finite set is finite using Coq

While trying to prove some things, I encountered an innocent looking claim that I failed to prove in Coq. The claim is that for a given Finite Ensemble, the powerset is also finite. The statement is ...
867views

### How do you do large number math in QtQuick Qml using JavaScript

I want to calculate the circumstance of the Sun around the Galaxy; the Math Formula is ((241828072282107.5071453596951 * 666) * 2) * 3.14159265359, using QML JavaScript I get the answer ...
664views

### Generate a random number within a range using a poisson distribution

I need a Poisson distribution. Currently I have the following code: public static int getPoisson(double lambda) { double l = Math.exp(-lambda); double p = 1.0; int k = 0; do { ...
617views

### Intersection area of a 3D Triangle and AABB

I am looking to find the actual surface area of an intersection between a triangle and an AABB. Currently, I am using Tomas Akenine-Möller's AABB-Triangle intersection test, which works quite well - ...
576views

### Algorithm to assign Team based on player's choice

I found very similar questions in here but I couldn't find a solution which would work for me. So here's the problem: I have 4 teams and a vast (higher than 4) number of players. Each player ranks ...
701views

### Python integration with poles

I'm trying to integrate an expression with poles, something like: where the poles are at z = ib-a, ib+a, -ib-a, -ib+a Python has a range of integration tools in scipy, but I don't know if there are ...
464views

### Objective-C division on 32/64-bit device produces different results

As described in the title, when I try to do the following divsion I get two different results depending on the architecture of the device: unsigned int a = 42033; unsigned int b = 360; unsigned int c ...
902views

### 2D Self-Deconvolution in MATLAB

I have some data, a 2D matrix we'll call A, which I know in theory can be described by a self-convolution of another matrix we'll call B: A=conv2(B,B) I am trying to extract B. Is there a way to ...
1kviews

### Is there a good GLSL hash function?

So I am still getting upvotes for my ancient comment on this question: What's the origin of this GLSL rand() one-liner? And it got me thinking, what would a good GLSL hash function look like? ...
1kviews

### jQuery returns not a number only when I use subtract

I am having an issue with jQuery that I can't seem to figure out. If I do console.log(\$(window).width()/2) I get a numerical value. If I do \$('.modal_box').outerWidth() I get a numerical value. ...
130views

### Optimization: minimize painting errors

You are given an m*n grid, where each cell is marked either "b" or "w". You are also given black and white paints. You are allowed to use k strokes, each of any color (black OR white), a stroke is ...
837views

### Libm optimised for ARM?

Is there a libm (libmath) that is optimised for ARM(v6) processors? I was looking at the GNU implementation and it doesn't seem to be optimised (but it does have x86 ones). It seems that most ...
3kviews

### Is there C++ class that implements operations with permutations?

Is there C++ template class that implements operations with permutations and permutation group? Such class has to implement finding product and inverse, multiplication, etc.
554views

### Line Intersection with rotated box collider object

I'm implementing my own Raycasting library to learn how it works. As a starting point I have a box that rotates and, using rays, detects the different obstacles that it encounters in its way. Worth ...
121views

### How do I solve these Nonlinear equations in Python?

I'm new to stackoverflow so hopefully this post follows all the rules and is in the correct place. If there's any problems let me know so I don't do it again! Also I hope a little LaTeX notation is ok ...
347views

### How to generate equidistributed points (evenly distributed) on the surface of a sphere, specifying the distance between neighbouring points

In a nutshell: I need an algorithm that can generate points on the surface of a sphere, and the euclidean distance between each point and its neighbors must be the same. Here is a quick explanation ...