Question
Implementing complex numbers. Mathematical preliminaries A complex number is a number that can be expressed in the form a + bi , where a and
Implementing complex numbers. Mathematical preliminaries A complex number is a number that can be expressed in the form a + bi , where a and b are real numbers and i is the imaginary unit, which satises the equation i 2 = 1 . 1 For a + bi we call a the real part and b the imaginary part. We defne addition, subtraction, multiplication, and division as follows: Addition: (a + bi) + (c + di) = (a + c) + (b + d)i Subtraction: (a + bi) (c + di) = (a c) + (b d)i Multiplication: (a + bi)(c + di) = (ac bd) + (bc + ad)i Division: (a + bi) / (c + di) = ((ac + bd) / (c 2 + d 2)) + ((bc ad) / (c 2 + d 2))i
Defne the following Scheme functions that allow you to implement complex numbers: (a) (make-complex a b) , which constructs a complex number with real part a and imaginary part b (b) (real x) , which returns the real part of complex number x , and (c) (imag x) , which returns the imaginary part of complex number x . Hint: use pairs for your information, as in Monday's lecture.
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