Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I just need help finishing this simplify function in racket. As you can see it is working correctly for addition and subtraction. I just need
I just need help finishing this simplify function in racket. As you can see it is working correctly for addition and subtraction. I just need help finishing the case operations for multiplication (just needs an else statement), division and for exponents if possible. The most important ones are for multiplication and division. I need to be able to simplify expressions such as (* 2 1), (* x 0), (/ x 1), and (+ (+ (* 2 1) (* x 0)) 0). This will be usefull when I want to simplify the results of my differentiation function.
simplity tunctionrkt- DRacket File Edit View LangeRacke Irsert Tabs Help Simplify functicnrkl .define..) 0 #1ang racket ; the simplify function is usd to simplify the results of a differentiation function I have ritten in order to make them more readable (dotinc isimplity oxpr if (nat (list? expr expr (Let {(operation (car expr)) ; Is part of our il a simplify (cadr oxp :rocursivo call bsimplify (caddr exp13 recursive call :a is a numbor and a-0 a is a number and a 0 ;) is a number b-1a b :b is a numbor and b-1a case operaticn (+) (and abe? a) - a )) ba is if number? b if (-b0) a :a is a non-0 numbor and b-0 +a bbis a nan-0 number (list operation a b))) a and b are not numbers - if (and (umbe aa1))aa is 1 (1ist operation ab)a and b are not numbers (if numbor? a) if (-a1) b a is 1 if (a0)0;a is (f number? b) {f (-b 1) a ; is 1 ({*) is correct up to this point i am rally certain a blnot suro how to finish else statement gos here list operation ab) THIS part is not correct yet, mostly justa placehalder copy of ) else statement goes here l anguage racket, with dehugging memory imit 12R MB -1 Deternine language fron source 50 12 MO-- . O Type here to search ^ 10/16/2018 to simplity tunctionrkt- DRacket File Edit View LangeRacke Irsert Tabs Help Simplify functicnrkl .define..) 0 #1ang racket ; the simplify function is usd to simplify the results of a differentiation function I have ritten in order to make them more readable (dotinc isimplity oxpr if (nat (list? expr expr (Let {(operation (car expr)) ; Is part of our il a simplify (cadr oxp :rocursivo call bsimplify (caddr exp13 recursive call :a is a numbor and a-0 a is a number and a 0 ;) is a number b-1a b :b is a numbor and b-1a case operaticn (+) (and abe? a) - a )) ba is if number? b if (-b0) a :a is a non-0 numbor and b-0 +a bbis a nan-0 number (list operation a b))) a and b are not numbers - if (and (umbe aa1))aa is 1 (1ist operation ab)a and b are not numbers (if numbor? a) if (-a1) b a is 1 if (a0)0;a is (f number? b) {f (-b 1) a ; is 1 ({*) is correct up to this point i am rally certain a blnot suro how to finish else statement gos here list operation ab) THIS part is not correct yet, mostly justa placehalder copy of ) else statement goes here l anguage racket, with dehugging memory imit 12R MB -1 Deternine language fron source 50 12 MO-- . O Type here to search ^ 10/16/2018 toStep 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