Methane Rotation

Back to General discussions forum

CSFPython     2024-03-21 18:29:52

Kevin,

Thanks for the new problem. It was an interesting introduction to 3D rotations.

Rodion (admin)     2024-03-21 18:45:25
User avatar

I had similar observation, but upon asking Kevin I believe I confused myself and failed to fix it... verily, looking into the setter/checker code I see

array_push($H, array(-sqrt(2/9), sqrt(2/3), -1/3));
array_push($H, array(0, 0, 1));
array_push($H, array(sqrt(8/9), 0, -1/3));
array_push($H, array(-sqrt(2/9), -sqrt(2/3), -1/3));

so perhaps let me change the checker to match description (so this 0, 0, 1 has "logically" singled place)...

Now I think we need correct the example answer if necessary... shall try solving it myself and check it...

Please sorry for such an inconvenience!

CSFPython     2024-03-21 18:52:36

We seem to have crossed over with these posts. I think I might have made an error in my previous statement. The example in the question now seems to work but the random problem now doesn't. Sorry if I've confused the issue.

Rodion (admin)     2024-03-21 19:15:50
User avatar

Clive, no worry, I hope to work through it in a 10-20 minutes probably so I can verify both statement, example and generator simultaneously. Meanwhile of course let's return these lines which I so cleverly copied :)))

CSFPython     2024-03-21 19:23:07

Rodion,

Both versions are now working with my code. I'm sorry to have caused you unnecessary work. The issue was caused by my assumption that two negatives make a positive; i.e. the axis direction and the direction of rotation. By the time that I had realised that this is not the case, you had already picked up my message and acted on it; before I had time to remove it!

I think that Kevin's choice of such nice coordinates made it harder to spot what was going on.

Rodion (admin)     2024-03-21 20:20:57
User avatar

However I still am confused why coordinates in the checker code are in different order :) so it is definitely not your fault, there is something more to think about. I'm probably bit slow already at this hour so thanks to your confirmation let it wait till morn :) Feeling somewhat sorry for abusing your time on this!

moxieman     2024-03-21 21:06:25
User avatar

Hi All,

@Rodion, I do now see the issue which you tried to bring to my attention before. I'm not sure why I didn't understand before since after re-reading your concern you were being quite clear... my bad!

I agree that we should rearrange the point order in the checker for this problem to:

array_push($H, array(0, 0, 1));
array_push($H, array(sqrt(8/9), 0, -1/3));
array_push($H, array(-sqrt(2/9), sqrt(2/3), -1/3));
array_push($H, array(-sqrt(2/9), -sqrt(2/3), -1/3));

Then the traceability between points will match the order given in the prompt.

The real reason why the points were arranged in this unusual order is for the checker of the next problem. If for each point the value y * z + y + z is computed, then those results will be in order. This helps to quickly sort points in user-inputted solutions for that problem without requiring traceability between points to be maintained. But clearly that shouldn't be the case with this problem :)

Sorry for all the confusion!

Rodion (admin)     2024-03-22 08:52:54
User avatar

I completed my implementation, and see that both initial suggestion by Clive, my observation and Kevin's confirmation - they seem right. With checker in its current form I get

Wrong answer! Expected:
-97.751231824517 -31.83140527386 -36.227866554364
0.044277790192025 0.22545165521132 108.99975784849
21.351626022481 100.44509395884 -36.549844949007
76.355328011844 -68.839140340188 -36.222046345114

your answer:
0.044277790192025 0.22545165521132 108.99975784849
21.351626022481 100.44509395884 -36.549844949007
-97.751231824517 -31.83140527386 -36.227866554364
76.355328011844 -68.839140340188 -36.222046345114

So I think I'll change it to the order corresponding problem statement :) Example answer is also updated.

Please tell if I did something wrong again...

BTW, Kevin, there is more human-friendly syntax for this, just like in python:

$H = [[0, 0, 1],
      [sqrt(8/9), 0, -1/3],
      [-sqrt(2/9), sqrt(2/3), -1/3],
      [-sqrt(2/9), -sqrt(2/3), -1/3]];

(which also could be written with old-fashioned array(...) instead of [...], but anyway in a single nested construction)

Please login and solve 5 problems to be able to post at forum