math

Return elements of the Groebner Basis as they are found

ⅰ亾dé卋堺 提交于 2020-01-22 19:16:10
问题 This question could refer to any computer algebra system which has the ability to compute the Groebner Basis from a set of polynomials (Mathematica, Singular, GAP, Macaulay2, MatLab, etc.). I am working with an overdetermined system of polynomials for which the full groebner basis is too difficult to compute, however it would be valuable for me to be able to print out the groebner basis elements as they are found so that I may know if a particular polynomial is in the groebner basis. Is there

How does using log10 correctly calculate the length of a integer? [closed]

浪尽此生 提交于 2020-01-22 14:39:46
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . int length = (int) floor( log10 (float) number ) + 1; My question is essentially a math question: WHY does taking the log10() of a number, flooring that number, adding 1, and then casting it into an int correctly calculate the length of number? I really want to know the deep mathematical explanation please! 回答1:

How does using log10 correctly calculate the length of a integer? [closed]

天大地大妈咪最大 提交于 2020-01-22 14:38:11
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . int length = (int) floor( log10 (float) number ) + 1; My question is essentially a math question: WHY does taking the log10() of a number, flooring that number, adding 1, and then casting it into an int correctly calculate the length of number? I really want to know the deep mathematical explanation please! 回答1:

Enumerate grid points on 2D plane with descending order of (x * y)

£可爱£侵袭症+ 提交于 2020-01-22 12:35:48
问题 Given N > 0 and M > 0 , I want to enumerate all (x, y) pairs such that 1 <= x <= N and 1 <= y <= M in descending order of (x * y). An example: given N = 3 and M = 2, the enumeration sequence should be: 1. (3, 2) -- 3 * 2 = 6 2. (2, 2) -- 2 * 2 = 4 3. (3, 1) -- 3 * 1 = 3 4. (2, 1) -- 2 * 1 = 2 5. (1, 2) -- 1 * 2 = 2 6. (1, 1) -- 1 * 1 = 1 The order of (2, 1) and (1, 2) could be swapped. One obvious way is to list them all, insert into a vector<pair<int, int> > , and call std::sort() with my

How to determine path from noisy X, Y data

心不动则不痛 提交于 2020-01-22 11:46:33
问题 I have an unsorted list of noisy X, Y points. They do, however, form a path through the world. I would like an algorithm to draw an approximation of this data using line segments. This is similar to how you would use a line -fitting algorithm to pick an approximation of linear data. My problem is only harder because the path bends and winds around the world. alt text http://www.praeclarum.org/so/pathfinder.png Does anyone know of any standard / robust / easy to comprehend algorithms to

log2 in python math module

风格不统一 提交于 2020-01-22 08:16:12
问题 why doesn't it exist? import math [x for x in dir(math) if 'log' in x] >>> ['log', 'log10', 'log1p'] I know I can do log(x,2), but log2 is really common, so I'm kind of baffled. Oh, it looks like it's only defined in C99, not C90, I guess that answers my question. Still seems kind of silly. 回答1: I think you've answered your own question. :-) There's no log2(x) because you can do log(x, 2) . As The Zen of Python (PEP 20) says, "There should be one-- and preferably only one --obvious way to do

Get just the scaling transformation out of CGAffineTransform

时光总嘲笑我的痴心妄想 提交于 2020-01-22 06:57:26
问题 I found a similar question about getting just the rotation, but as I understand scaling and rotating work different in the transform matrix. Matrixes are not my strength, so if anybody would hint me how to get only the scaling out of a CGAffineTransform I'd greatly appreciate. btw. I tried applying the CGAffineTransform on a CGSize and then get the height x width to see how much it scaled, but height x width have strange values (depending on the rotation found in the CGAffineTransform, so ...

Get just the scaling transformation out of CGAffineTransform

依然范特西╮ 提交于 2020-01-22 06:54:46
问题 I found a similar question about getting just the rotation, but as I understand scaling and rotating work different in the transform matrix. Matrixes are not my strength, so if anybody would hint me how to get only the scaling out of a CGAffineTransform I'd greatly appreciate. btw. I tried applying the CGAffineTransform on a CGSize and then get the height x width to see how much it scaled, but height x width have strange values (depending on the rotation found in the CGAffineTransform, so ...

Get just the scaling transformation out of CGAffineTransform

本小妞迷上赌 提交于 2020-01-22 06:53:05
问题 I found a similar question about getting just the rotation, but as I understand scaling and rotating work different in the transform matrix. Matrixes are not my strength, so if anybody would hint me how to get only the scaling out of a CGAffineTransform I'd greatly appreciate. btw. I tried applying the CGAffineTransform on a CGSize and then get the height x width to see how much it scaled, but height x width have strange values (depending on the rotation found in the CGAffineTransform, so ...

Need Better Algorithm for Finding Mapping Between 2 Sets of Points with Minimum Distance

风流意气都作罢 提交于 2020-01-22 05:30:06
问题 Problem: I have two overlapping 2D shapes, A and B, each shape having the same number of pixels, but differing in shape. Some portion of the shapes are overlapping, and there are some pieces of each that are not overlapping. My goal is to move all the non-overlapping pixels in shape A to the non-overlapping pixels in shape B. Since the number of pixels in each shape is the same, I should be able to find a 1-to-1 mapping of pixels. The restriction is that I want to find the mapping that