Question: write a c program for this Sample Run #1: Math Tool Box /////// Number of equations [1-9]: 3 1H+1K+2D=10 2H+0K+2D=12 2H+4K+4D=24 Number of equations =
write a c program for this

![/\/\/\/\/\/\/ Number of equations [1-9]: 3 1H+1K+2D=10 2H+0K+2D=12 2H+4K+4D=24 Number of equations](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f5a4aa20e30_50566f5a4a9a74b9.jpg)
Sample Run #1:
Math Tool Box /\/\/\/\/\/\/ Number of equations [1-9]: 3 1H+1K+2D=10 2H+0K+2D=12 2H+4K+4D=24 Number of equations = 3 +1.00 H +1.00 K +2.00 D = +10.00 +2.00 H +0.00 K +2.00 D = +12.00 +2.00 H +4.00 K +4.00 D = +24.00 / \ | +1.00 +1.00 +2.00 | | +2.00 +0.00 +2.00 | | +2.00 +4.00 +4.00 | \ / DetA = 4.000000 H = 4.000000 K = 2.000000 D = 2.000000
Sample Run #2:
Math Tool Box /\/\/\/\/\/\/ Number of equations [1-9]: 4 1P+1Q+2R-3S=10 1.7P+0Q+2R+1S=-3.4 1.7P+0Q+2R+1S=1.2 2P+4Q+4R-0.9S=2.7 Number of equations = 4 +1.00 P +1.00 Q +2.00 R -3.00 S = +10.00 +1.70 P +0.00 Q +2.00 R +1.00 S = -3.40 +1.70 P +0.00 Q +2.00 R +1.00 S = +1.20 +2.00 P +4.00 Q +4.00 R -0.90 S = +2.70 / \ | +1.00 +1.00 +2.00 -3.00 | | +1.70 +0.00 +2.00 +1.00 | | +1.70 +0.00 +2.00 +1.00 | | +2.00 +4.00 +4.00 -0.90 | \ / DetA = 0.000000 There is no solution!
Sample Run #3:
Math Tool Box /\/\/\/\/\/\/ Number of equations [1-9]: 1 10X=-9 Number of equations = 1 +10.00 X = -9.00 / \ | +10.00 | \ / DetA = 10.000000 X = -0.900000
Task A is about modeling and solving problems as a system of linear equations of some unknowns. Here is an example scenario involving 3 unknowns in a system of a 3x3 matrix and 3-element vectors Each hen (H) has one head, two wings and two legs. Each kitten (K) has one head, no wing and four legs. Each dragon (D) has two heads, two wings and four legs. Now, we see 10 heads, 12 wings and 24 legs. How many hen, kitten and dragon are there? That is, we want to find unknowns H, K and D And our example model in 3 equations of 3 unknowns Head count: 1H+1Kt2D = 10 Wing count: 2H+0K+2D = 12 Leg count : 2H-4Kt4D = 24 We need to solve for 3 unknowns, H, K and D, in the above linear system | 2 0 2|.IK I | 2 4 4 | | 24 | coefficients . Variables = Constants Matrix A Unknowns Vector b You are suggested solving the above system using Cramer's rule, i.e., substituting columns one-by-one in the matrix A using the constants vector b and finding determinants. Explanation and examples: https://en.wikipedia.org/wiki/Cramer%27S rule#Explicit formulas for-small-systems To find determinants recursively, we can apply Laplace (cofactor) expansion. Explanation and examples: https://www.mathsisfun.com/algebra/matrix-determinant.html . More about minor and cofactor: https://en.wikipedia.org/wiki/Minor_(linear_algebra)#First-minors . Laplace expansion formula: https://en.wikipedia.org/wiki/Minor (linear algebra)#Cofactor expansion-ofthe-determinant The maximum number of unknowns is 9, thus we need to handle systems up to dimension equals User input and text output formatting requirements Assume user inputs are always valid The first integer input indicates the number of equations, N, within 1 to 9 Subsequently one line per equation and there is no space in the equation inputs Each unknown symbol is an uppercase alphabet (except E because +3E+4Y means +30000Y) The order of the symbols in the equations is always the same All equation parameters are double-type floating-point numbers You shall use format specifier "%+7.2f" in printing elements in vectors and matrices. You shall use format specifier "%f" in printing scalar results
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
