Question
Let a pair (a,b) be a grouping of two elements a and b where a and b are complex numbers. In (a,b), a is the
Let a pair (a,b) be a grouping of two elements a and b where a and b are complex numbers. In (a,b), a is the first element of the pair and b is the second element of the pair. A complex number z is of the form x + iy with the real part x and the imaginary part y where x and y themselves are reals. (a) Design a type called Pair for pairs of complex numbers as described above. Use type declaration in RSL. (b) Define two functions add and subtract for two values of type Pair. Use value declarations in RSL. The result of adding two pairs p1 and p2 is another pair p such that the first element of p is the addition of first elements in p1 and p2. Similarly, the second element in p is the addition of the second elements in p1 and p2. The result of subtracting two pairs p1 and p2 is another pair p such that the first element of p is the subtraction of first elements in p2 from the first element in p1. Similarly, the second element in p is the subtraction of the second element of p2 from p1.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started