Jiri Kriz
  • Member for 10 years, 7 months
  • Last seen more than a month ago
Optimum solution to a Linear programming problem
Accepted answer
13 votes

In two dimensional case the linear optimization (linear programming) is specified as follows: Find the values $(x, y)$ such that the goal function $$g(x, y) = a x + b y \;\;\; (Eq. 1)$$ is maximized (...

View answer
How do I rotate a matrix transformation with a centered origin?
Accepted answer
12 votes

Let xc, yc be the coordinates of the center of the rectangle. Translate your points such that the center is the new origin: xt = x1 - xc; yt = y1 - yc; Rotate around the origin by the angle a: c = ...

View answer
Difference between $:=$ and $=$
9 votes

The notation := was used in some early programming languages. The meaning of x := 3 was "assign 3 to the variable x". So, the assignment could be distinguished from the the test if (x = 3) .... In ...

View answer
"Trivial" trigonometry problem
Accepted answer
8 votes

I am refering to the picture below, where the rotation angle is denoted by $\alpha$. We have for the new $x', y'$ if $0 \le \alpha \le 90$:: $$x' = BD = BC + CD = FE \cos(90-\alpha) + CD = (h - y) \...

View answer
Convert coordinates from Cartesian system to non-orthogonal axes
7 votes

Let us denote by "old" the usual cartesian system with orthogonal axes and by "new" the system with the skew axes $(\alpha_1, \alpha_2)^T, (\beta_1, \beta_2)^T$ (expressed in the old system). An old ...

View answer
What is the logical operator for but?
7 votes

This is indeed an exercise in semantics as mentioned by @Asaf. My interpretation would be: $$fine(\text{me}) \land flue(\text{him})$$ where $fine, flue$ are predicates and me, him are constants. ...

View answer
Two 2d vector angle clockwise predicate
Accepted answer
6 votes

For 2 vectors $a = (a_x, a_y), b = (b_x, b_y)$ compute $$c_z = a_x b_y - a_y b_x$$ If $c_z > 0$ then $b$ is on the CCW side of $a$. If $c_z < 0$ then $b$ is on the CW side of $a$. If $c_z = 0$ ...

View answer
Find extra arbitrary two points for a plane, given the normal and a point that lies on the plane
Accepted answer
6 votes

The fundamental problem here is to find two vectors $u, v$ that are orthogonal to the vector $n = (n_x, n_y, n_z)^T$. Morevover, the procedure should be numerically stable. I assume that $|n| = 1$. ...

View answer
Arranging a $30$ character word with letters $x, y, z$
5 votes

Let us denote by $X_n$ the number of possible words of length $n$ ending with the letter $X$, and similarly $Y_n, Z_n$. Then the reccurence applies: $$X_{n+1} = X_n + Y_n + Z_n$$ $$Y_{n+1} = X_n + Z_n$...

View answer
Membership problem for convex cones
5 votes

Suppose that the vectors $v_1, ..., v_n$ are $m$-dimensional. Build an $m \times n$ matrix $A$ such that the vectors $v_i$ are columns of $A$. The problem is now formulated as follows. Find the $n$-...

View answer
Rotating a rectangle
Accepted answer
5 votes

$$ wh(d) = \begin{cases} h \cos(d) + w \sin(d), & \mbox{if} \;\; 0^\circ \le d \le 90^\circ \;\; \mbox{or} \;\; 180^\circ \le d \le 270^\circ \;\; \\ w \cos(d-90) + h \sin(d-90), & \mbox{...

View answer
Sudoku mathematically, MILP?
Accepted answer
4 votes

The linear program can be formulated just using the binary 0/1-variables $x_{rcn}$ with the meaning $x_{rcn} = 1$ if and only if there is the number $n$ in the cell $rc$, i.e in the row $r$ and the ...

View answer
How many arrangements of $\{a,2b,3c,4d, 5e\}$ have no identical consecutive letters?
4 votes

I do not have any explicit formula (this could be hard), but invested some time into an enumeration program. This is a nice exercise in backtracking. The heart of the algorithm is the recursive ...

View answer
The Berlin Airlift
4 votes

The problem has already been analyzed by @joriki. You can get a numerical solution by trying an online Simplex solver. Just google for it. I tried the first one that I found: Simplex Method Tool and ...

View answer
Moving a rectangular box around a $90^\circ$ corner
Accepted answer
4 votes

Here is an attempt based on my experiences with furniture moving. The long dimension a=4.3 will surely be horizontal. One of the short dimensions, call it b will be vertical, the remaining dimension c ...

View answer
Two plane intersection and angle between 2 planes
Accepted answer
3 votes

Your considerations about the quality of the intersection of two planes are correct. The intersection will be computed most accurately if the planes are orthogonal. The interection is not defined for ...

View answer
Can I find the distance?
Accepted answer
3 votes

This is a slightly different question to this one. But the answer is the same: it is not possible to determine $a$ or $b$ or $a+b$. Look at this figure: We can move the red lines anywhere in the $\...

View answer
what formula describes the convex hull of two circles (i.e. two circles connected by tangent lines)?
3 votes

I will use the notation of @Day and consider only the right half of the hull ($x \ge 0$). We have $$\cos \alpha = k, \;\;\; \sin \alpha = \sqrt{1 - k^2}, \;\;\; y_0 = r/k$$ So, the equation of the ...

View answer
Equation for the family of lines that passes through $3y-5x-10=0$ and $3y-\frac{x}{3}-\frac{5}{3}=0$
3 votes

Let us denote by $L = L(a, b, c)$ the line $ax + by + c = 0$. $(a, b, c)$ can be considered a 3-dimensional vector $v$ and all lines can be represented by the 3-dimensinal vector space $R^3$. The ...

View answer
Confirm some logical inferences for me please?
3 votes

The task is to prove $\neg s$ from the assumptions (1)-(4). Proof 1 (by deduction, Modus Ponens): These are true facts: $\neg p $ by (4) $o$ by (1) $\neg r$ by (3) in the equivalent form $\neg o \...

View answer
Maximum number of cubes within a radius
Accepted answer
3 votes

Let us first consider the two dimensional case to explain the concepts. A line segment of the length $L$ (I will call it line $L$) is to be laid down on a unit square grid such that the number of the ...

View answer
Can $A^2+B^2+C^2-2AB-2AC-2BC$ be a perfect square
3 votes

A more symmetric factorization would be: $$A^2 + B^2 + C^2 - 2AB -2AC - 2BC =$$ $$(A + B + C)^2 - 4AB - 4AC - 4BC =$$ $$(A + B + C - 2 \sqrt{AB + AC + BC}) (A + B + C + 2 \sqrt{AB + AC + BC})$$ if $$...

View answer
Finding a random vector exactly yay far from another point in 3D space
3 votes

Your problem can be reduced to the well known problem of picking a uniformly distributed point on a unit sphere. There are various methods for solving this problem, see e.g. www.cgafaq.info or ...

View answer
How quickly we forget - basic trig. Calculate the area of a polygon
3 votes

You will find simple formulae in http://en.wikipedia.org/wiki/Polygon. Look for the various formulae A = ... in the section Area and centroid. You will find the appropriate formula depending whether ...

View answer
Linear programming problem formulation
2 votes

Notice that Fred can always invest in 1-year deposits and get this money at the beginning of the next year for further investments. This means that all available money will always be invested and we ...

View answer
Question regarding upper bound of fixed-point function
Accepted answer
2 votes

The discrepancy is caused by taking the maximal derivative in the interval [2.5, 3.0]: $$k = \max |g'(x)| = |g'(2.5)| = \sqrt{10}/5 = 0.632$$ So, you assume that the solution error is ...

View answer
Degrees of freedom
Accepted answer
2 votes

If you impose $m$ linear and linearly independent constraints on $\mathbb R^n$, then the set has the dimension $n-m$. The vector space of these $m$ constraints has the dimension $m$. If only $k, k \...

View answer
Finding velocity and speed
2 votes

To obtain the instantaneous velocity, compute the derivative $f'(t) = d f(t) / dt$. The velocity at $t=5$ is $f'(5)$.

View answer
Expressing sums of products in terms of sums of powers
2 votes

Besides using the Newton's identities as mentioned in @Soarer's comment, you could also consider an algorithm to generate all combinations. E.g. to compute $$abc+abd+acd+bcd$$ you would generate 3-...

View answer
Can I find the angle?
2 votes

You can compute $x$ and $h$. (BTW, your second equation should be $\cos(\alpha) = (D+x)/a$.). Even then, you cannot determine $\alpha$. You just got the point $S$. According to the Intercept theorem ...

View answer