TOTAL AREA = △1 AREA + △2 AREA
Using Heron's Formula
All values are known in the equation except the length of the diagonal X
I used the ( for each number from to ) block to test the numbers that give the same area result, but unfortunately it doesn't work. I don't know what the problem is !! aia file attached
There are some mathematical issues regarding your approach.
Not all areas can be fitted into a particular set of side lengths. Some may be too large or too small. You don't check for that before sending your app on an impossible task.
You check for an exact match, assuming the diagonal to be a rational number that can be enumerated, and assuming that the floating point calculation results will match exactly.
A more appropriate approach would be to use Newton's Method in a Clock Timer to run its steps until you get within some small distance of a solution.
Your diagonal length iteration range can be made shorter, starting at max(abs(A-B),abs(C-D)) and ending at min(A+B,C+D)
You can use a courser iteration step for a first approximation, like min(A,B,C,D)/10 and then use that to home in on a shorter range once you know which sub-range is closest to the solution
If you calculate the difference between target area and calculated area, you would be searching for zero crossings, a known mathematical technique.
P.S. AI2 has easy graph components that could be used to graph the area difference across the domain of diagonal lengths. That could be used to show the iterative nature of the calculations as you home in on the smaller diagonal domains.
This is just to add a bit of showmanship to the app, and to help the viewer see how the process works.
Is this a test of coding ability, or a test of knowledge of the trigonometric functions and construction techniques that would result in the creation of a trigonometric formula that should be solved symbolically?