Questions tagged [simplification]
249 questions
25
votes
6 answers
simplifying fractions in Java
My task is to develop a rational class. If 500 and 1000 are my inputs, then (½) must be my output.
I have written a program on my own to find it.
Is there another best way to find the solution, or my program is already the best one?
public class…

Pari Sairam Mohan
- 421
- 1
- 4
- 11
17
votes
1 answer
How do I reduce the coordinate count of an arbitrary SVG path, without losing much or any precision?
I am scouring the web for tools, programs, utilities, supporting libraries and code primitives that help optimize SVGs for simplicity, space and elegance recently, to link to from the Kilobyte SVG Challenge's tools section, but have yet to find good…

ecmanaut
- 5,030
- 2
- 44
- 66
13
votes
1 answer
line simplification algorithm: Visvalingam vs Douglas-Peucker
I am trying to implement a line simplification algorithm. The main 2 algorithms I found are:
Ramer-Douglas-Peucker
Visvalingam-Whyat
Currently I am running a few simulations of them on Matlab in order to determine which answers my needs…

Nir Agami
- 231
- 2
- 4
11
votes
3 answers
C standard addressing simplification inconsistency
Section §6.5.3.2 "Address and indirection operators" ¶3 says (relevant section only):
The unary & operator returns the address of its operand. ...
If the operand is the result of a unary * operator, neither that operator nor the & operator is…

Chris Lutz
- 73,191
- 16
- 130
- 183
11
votes
3 answers
Visvalingam-Whyatt polyline simplification algorithm clarification
I'm trying to implement a polyline simplification algorithm. The original article can be found here: http://archive.is/Tzq2. It seems straightforward in concept but I don't understand the sample algorithm (I think it's poorly worded) pseudocode…

Prismatic
- 3,338
- 5
- 36
- 59
10
votes
1 answer
Have any simplified YAML formats become widespread?
I love YAML.
Wait, let me back up. I love YAML that looks like this, even more than JSON:
Projects:
C/C++ Libraries:
- libyaml # "C" Fast YAML 1.1
- Syck # (dated) "C" YAML 1.0
- yaml-cpp # C++ YAML 1.2 implementation
…

Andy
- 7,885
- 5
- 55
- 61
9
votes
1 answer
Is minimization of boolean expressions NP-Complete?
I know that boolean satisfiability is NP-Complete, but is the minimization/simplification of a boolean expression, by which I mean taking a given expression in symbolic form and producing an equivalent but simplified expression in symbolic form,…

sgibbons
- 3,620
- 11
- 36
- 31
9
votes
1 answer
Python : Ramer-Douglas-Peucker (RDP) algorithm with number of points instead of epsilon
I would like to modify this following python script for RDP algorithm with the purpose of not using epsilon but to choose the number of points I want to keep at the final :
class DPAlgorithm():
def distance(self, a, b):
return …

Momow
- 143
- 2
- 8
8
votes
0 answers
Can I guess the appropriate epsilon for RDP (Ramer-Douglas-Peucker)?
I have sets of time series data which I display as charts in mobile applications.
To make the charts clearer, I simplify the sets by applying Ramer-Douglas-Peucker.
If I apply RDP to a small set with an epsilon that's too high, the set becomes over…

noamt
- 7,397
- 2
- 37
- 59
6
votes
6 answers
How can this very long if-statement be simplified?
How can this if-statement be simplified? It makes a plus sign:
https://i.stack.imgur.com/PtHO1.png
If the statement is completed, then a block is set at the x and y coordinates.
for y in range(MAP_HEIGHT):
for x in range(MAP_WIDTH):
if…

Bryce Guinta
- 3,456
- 1
- 35
- 36
6
votes
1 answer
Sympy absolute value of complex exponential
When working with complex numbers in polar form, I've experienced a strange behavior. For example, doing
from sympy import *
simplify(Abs(exp(I)))
I would expect the result 1 because the absolute value of a complex exponential should always be one…

jan
- 927
- 2
- 9
- 20
6
votes
1 answer
How do I simplify this Enumerator code?
I'd like to optimize following code for conciseness.
x1.each { |x|
x2.each { |y|
....
xN.each { |z|
yield {}.merge(x).merge(y)...... merge(z)
}
}
}
Assume x1, x2, ..., xN are Enumerator objects.
The above is not concise
It…

Alex
- 1,210
- 8
- 15
6
votes
4 answers
Boolean Algebra Simplification
Need help have no idea the thought process in doing this kind of simplification.
! - Denotes NOT
Lets say I have !((A+B) * (A+!B)) I need to simplify that using all rules except absortion.
I know it is A * !B + !A * B but I need to know the process…

Doug
- 1,316
- 6
- 19
- 36
5
votes
2 answers
simplifying regular expression
I am going through exercises regarding regular expressions, and I am really unsure on how to do this.
The regular expression is:
((a*)(b*))* ∪ (a*)
I am really bad at this, but I think that ((a*)(b*))* can be simplified to (a ∪ b)* But if this is…

user2795095
- 501
- 2
- 9
- 13
5
votes
1 answer
How to stop the Matlab from rearranging symbolic variables?
This symbolic expression in Matlab
syms x y;
f = x * y * y
returns
f =
x*y^2
How can I stop Matlab from simplifying the expression and let it remain as x * y * y?
I'm trying to print the steps of a calculation this way, so reordering the terms…

semekh
- 3,867
- 2
- 24
- 34