必须编写一个函数,该函数接受三个Double参数并生成一个[Double](即列表
双打)回归。如果三个自变量对应于二阶的系数多项式(即,分别为a、b和c),则返回值列表应包含所有实值多项式的根。因此,有效的返回值要么是空列表(即[]),要么是列表包含一个元素(例如,[1.23]),或包含两个元素的列表(例如,[12.34.56])。•您的解决方案必须使用保护,并且不允许使用if-then-else语法。•您的解决方案必须(在每个用例中)使用“trace”函数来解释答案已确定。为了澄清,如果您作为参数传递的系数导致负判别式,那么这就是为什么返回值是空列表[]的解释,并且必须显示该解释。请记住,跟踪函数必须从Trace并在显示第一个参数之前获取两个参数(一个String和其他参数)参数字符串,然后返回第二个参数。•您可以放心地假设您的函数将始终接收三个Double类型的参数,以及第一个参数(即共效“a”)将始终具有非零值。•您必须使用自己设计的测试用例彻底测试功
COMP 3007 A/B (Winter 2023) Programming Paradigms"
1.Specification
For Assignment 3Your submission for this assignment must be commented and must include both your name and yourstudent number as a comment at the top of every source file you submit. Each of your submitted files mustuse a file name beginning'comp3007_w23_#########_assignment_03' (replacing the number signs withyour own student number) and any submissions that crash (i.e., terminate with an error) on execution willautomatically receive a mark of 0.Officially, the Due Date for this Assignment is:Friday, February 10th, 2021, at 11:59pm EST.Late Submissions are Accepted Without Penalty Until Sunday, February 12th, by 11:59pm EST.Submissions received after that will not be accepted and will receive a mark of 0.The objective of this assignment is to allow you to practice with guards and tracing in Haskell by designingand implementing a simple program for determining the real-valued roots of a second-order polynomialusing the quadratic formula.A second-order polynomial is a polynomial of the forIf you do not recall how to use this formula, you are directed to first take a few minutes and read the articleathttps://mathworld.wolfram.com/QuadraticEquation.html. Essentially, the use of this formula will resultin either 0, 1, or 2 real-valued roots, depending upon whether the "discriminant"
subexpression under the radical) is negative, zero, or positive (respectively).For this assignmentyou must write a function that takes three Double arguments and produces one [Double] (i.e., a listof Doubles) return. If the three arguments correspond to the coefficients of a second-orderpolynomial (i.e., a, b, and c, respectively), then the return value list should contain all the real-valuedroots of that polynomial. A valid return value would thus be either an empty list (i.e., []), a listcontaining one element (e.g., [1.23]), or a list containing two elements (e.g., [1.23, 4.56]).your solutions must use guards and is not permitted to use the if-then-else syntaxyour solution must(in every use case) use the "trace" function to provide an explanation of how youranswer was determined. To clarify, if the coefficients you passed as arguments resulted in a negativediscriminant, then that is your explanation for why the return value would be the empty list [] andthat explanation must be displayed. Please recall that the trace function must be imported fromDebug.Trace and takes two arguments (a String and something else) before displaying the firstargument string and then returning the second argument.ou may safely assume that your function will always receive three arguments of type Double, andthat the first argument (i.e., co-efficient 'a') will always have a non-zero value.you must test all branches of your function thoroughly, using test cases you have designed yourselfand have included as comments at the top of the program.
WX:codehelp
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。