Discussion thread for day 24 of the Advent of Code - https://adventofcode.com/2023/day/24
Part 1 is fairly straightforward vector intercept calculation (recommend converting to slope/intercept form and then comparing.)
Part 2 is a linear algebra mess that is probably better solved in Mathematica than Alteryx.
One hint for part 2:
Agree. Part 1 is just about a formula about the two lines intersecting point.
For part 2, unfortunetly, Linear Algebra is not my thing 🤣....
I did MATH, rather than building WF. No macro solution.
Part1
Part2
Overall WF
Not a pleasant one, and I can't figure out what's wrong with my WF (Answer is too high)
Anyone care to help? @gawa , @Qiu , @ScottLewis ? Workflow attached
I've had quite a few "edge case" type data sets, though I can't see how that would be impacting my calculations in a straightforward-ish linear algebra problem....
Thank you!!
You're appending a fileset to itself to create a full match. This works, but it gives you two rows for every pair of input rows (A->B & B->A.) If you don't account for that you're going to double count everything (which you are, checked your workflow with my dataset.)
The way I like to correct for this is to do a record ID before the append and then filter on LeftID>RightID. That also removes the self matches (and can be changed to >= if you want to include them.)
@ScottLewis , thank you! I was wondering if that were the problem. Thanks for confirming. I usually like to solve for that with a Generate Rows and then join on the record IDs
@estherb47
I agree with @ScottLewis and that is how your result is doubled. 🤣
I usually do is to create another parameter by using Min and Max to pair A and B.
Now it gives correct answer for my input.
and I almost give up on Part 2.
@estherb47 This is a typical pitfall for me, that is simple one but cannot find it immediately😅
As @Qiu and @ScottLewis mentioned, I always go with "Appendix Field + Filter" method to create the unique pairs without duplication.
Good luck!
This problem killed me XD I built a Big Num system in Alteryx which handles Multiplication, Division, and Addition (Subtraction is just addition with sign change).
Wrote out the formulae to generate a system of equations, then used Alteryx to calculate the solution to the system of equations for single variable. The equations are the same whether solving for x,y, or z so substitute relevant variables and the answer is done. One of the worst possible ways to solve, but I did it, and I'm quite happy about that.
Also noticed a cool graph pattern that I couldn't think how to exploit:
Workflow: