|
Thanks for your help and ideas.I even tried trial and error by hand for a couple of hours.I think it is a Diophantine equation and has solution but i 'm not good at this.I 'll check for it and come back.
|
|
|
|
|
you can help me help you by telling me which values are given and which you are looking for.
if a,b and c are given values (you know their value) and x,y,z and g are the unknown onesthen there exist multiple solutions
these solutions are in a hypercube, but an easier way of describing the solutions is:
- set g as parameter
- draw the plane of all (x,y,z) which satisfy the solution into a 3d grid
then you can visualize the (x,y,z)s for different gs
edit: I could solve it analyticly, but then where is the fun for you
eidt2:
my bad. forgot you have 4 equatations! with 4 eqs and 4 unknown values, there is a solution for each x^2, y^2, z^2 and g^2 !
just simple gauss algorithm
modified on Tuesday, June 15, 2010 8:15 AM
|
|
|
|
|
Could you think of the problem as a Pythagorean triangle in 3d space and the last 3 equations as projections of this triangle on the xy,xz,yz planes and find the right coordinates for the vertices of the triangle,because these equations remind me of the Pythagorean Theorem?
Tnx in advance.
|
|
|
|
|
this has got nothing to do with pythagoras.
it is now the third time I ask you: which values are you looking for??? is it x,y,z or x,y,z and g?
make life easier and replace all squares:
p=x^2,...,a^2=d,...g^2=h
p + q + r = h
p + q = d
p + r = e
q + r = f
does this look any pythagorean? no
now look for the gauss algorithm to solve linear equatations (or similar solvers)
|
|
|
|
|
you hit ht enail on the head - it looks much simpler now!
|
|
|
|
|
Assuming your instructor uses the convention that variable quantities are represented by x,y and z, and that constant values are represented by the values a,b and c:
g(x,y,z) = x2 + y2 + z2 and
x2 + y2 = a2
x2 + z2 = b2
y2 + z2 = c2
You have three equations in three independent variables, and one dependent equation based on the values of the variables from the first three. Solving first the independent equations:
x2 + y2 = a2
-(x2 + z2) = b2
y2 - z2 = a2 - b2
y2 - z2 = a2 - b2
+(y2 + z2 = c2)
2y2 = a2 - b2 + c2
y2 = (a2 - b2 + c2)/2
Substituting,
y2 + z2 = c2
(a2 - b2 + c2)/2 + z2 = c2
a2 - b2 + c2 + 2z2 = 2c2
2z2 = -a2 + b2 + c2
z2 = (-a2 + b2 + c2)/2
Again substituting,
x2 + z2 = b2
x2 + (-a2 + b2 + c2)/2 = b2
2x2 = a2 + b2 - c2
x2 = (a2 + b2 - c2)/2
Finally, returning to the dependent equation and substituting the determinant vales:
g(x,y,z) = x2 + y2 + z2 = (a2 + b2 - c2)/2 + (a2 - b2 + c2)/2 + (-a2 + b2 + c2)/2 = (a2 + b2 + c2)/2
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Yes but i'm looking for integer solutions and i want the number g(x,y,z)=x^2+y^2+z^2 to be a square of an integer number.
Tnx.
|
|
|
|
|
all that is true,
x2 + y2 + z2 = (a2 + b2 + c2)/2 is obvious when summing the three simpler equations
x2 + y2 = a2
x2 + z2 = b2
y2 + z2 = c2
but none of it brings us any closer to finding all possible solutions when x,y,z,a,b,c are all unknown.
The first step would be the introduction of a 2-D parameter space (u,v) that yields all solutions of a simple x2 + y2 = a2, then doing similar things to the others, and finally unite the conditions.
|
|
|
|
|
That might work, but as an engineer, armed with the new information that the OP is seeking integer solutions only, I'd simply write a program the cycles through all integer values of a, b, c then pick the results I like.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
that may take "a while" as there are infinitely many non-trivial solutions to the single equation x2+y2+z2=g2 (1,2,2,3 would be a simple one of them), and probably (I'm still looking into this) a non-zero fraction (hence also infinitely many) of those also satisfy the three extra conditions.
It really is a challenge that deserves a mathematical approach, not a brute-force one.
|
|
|
|
|
Luc Pattyn wrote: deserves a mathematical approach
True, but it's been about 30 years since I did any of that.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
You usually don't count building steps, do you, Watson?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
This is not a programming question, it is a math problem.
The latter 3 equations define a Euler Brick, all 4 together define a "perfect cuboid", no solution is known so far. See here[^].
|
|
|
|
|
Spent many a day on that page.
|
|
|
|
|
|
Hi,
I have to write a program which converts NFA to DFA.I know the algorithm, but I have no idea, how translate it to any C++ / Java code. I would be grateful for advices how to do it (simple pseudocode or something),
Thank you for any sugestion
Paul
|
|
|
|
|
I'm puzzled here, you say you know the algorithm, so you have or could write an English description of it; well, that is the pseudo-code you want, isn't it? I think what you need most is the courage the get started...
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
|
the image only shows an example of input and output. it is not an algorithm.
if you know the algorithm, it is expressed either in human language or in a programming language, the former is easier for humans (and possibly ambiguous), the latter is easier for machines.
If you don't have the algorithm, come up with one yourself and/or do your research through google. There's lots of relevant stuff around.
Maybe this CP article is useful: Writing own regular expression parser[^]
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Hi,
Ok, I done this program, is very stupid, but works
Thanks for all,
Paul
|
|
|
|
|
Paul6915 wrote: is very stupid, but works
A program can be very stupid, or it can work. It can't do both. If you've written a program that solves the problem, you have every reason to be proud of it. When someone comes up with a better program to solve the same problem, you have a learning opportunity.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Define the DFA "state" of an NDFA as being the list of all states that the NDFA "could" be. Then determine for each possible combination of states, what combinations of states could occur as a result of each possible input character. For example, consider the following NDFA:
1. START STATE. If input is "T", maybe advance to state 2. In any case, maybe stay in state 1.
2. If input is "E", advance to state 3.
3. If input is "S", advance to state 4.
4. If input is "T", advance to state 5.
5. If input is "E", advance to state 6.
6. If input is "R", advance to state 7.
7. ACCEPTING STATE. Stay in state 7 regardless of input.
It's possible that the machine will only be in state 1 (call that DFA state "1").
If it's in DFA state 1 and it gets a "T", it could be in state 1 or 2 (call that DFA state "1/2"); if it gets anything else, it can only be in state 1.
If it's in DFA state "1/2" and it gets a "T", it could be in state 1 or 2; if it gets an "E", it can be in state 1 or 3 ("1/3"). Anything else, it can only be state 1.
If it's in DFA state "1/3" and it gets a "T", it could be in state 1 or 2; if it gets an "S", it can be in state 1 or 4 ("1/4"). Anything else, it can only be state 1.
If it's in DFA state "1/4" and it gets a "T", it could be in state 1, 2, or 5. Anything else, it can only be state 1.
If it's in DFA state "1/2/5" and it gets an "E", it could be in state 1, 3, or 6. Anything else, it can only be state 1.
If it's in DFA state "1/3/6" and it gets an "R", it could be in state 1 or 7 (though state 1 won't really matter); if "S", it can be in state 1 or 4; if "T", state 1 or 2. Anything else, it can only be state 1.
If it's in DFA state "1/7", one could evaluate further state transitions, but since "acceptance" is guaranteed, they're moot.
|
|
|
|
|
|
Did you try a search?[^]
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Hey does anyone know of an algorithm to find the point that resides inside a polygon that is farthest (on average) to any other point in the polygon? The polygons don't have to be regular and not all points can see the other points (IE you may not be able to draw a line between every point without intersecting the outer edge of the polygon)
|
|
|
|
|