0
如何计算两个多项式的乘积?Ocaml两个多项式的乘积
例如:X^3 + 3×^ 2 + 0.2×和2x^4 + 3
首先我由类型
Type term = {coefficient:int; name:string; exponent:int};;
Type polynomials = term list;;
然后我做了一个函数计算系数
let product l l' =
List.concat (List.map (fun e -> List.map (fun e' -> (e*e')) l'.coefficient)
l.coefficient);;
这是我卡住的地方。我想我可以使用指数相同的功能,很好,但问题是问写一个多项式函数与一个PARAM,这意味着两个多项式将在同一个变量
有人能帮助我在这里