alex cole
11/25/2020, 12:50 AMdef myFunction(a,b,c):
return lambda x: a * x ** 2 + b * x + c
however I am not understanding what is wrong with
fun potentialEnergy(charge1, charge2, k){
val x = {position: Double -> k * charge1 * charge2 / position / position} // creating lambda function
return x
}
What is wrong with this lambda function expression.alex cole
11/25/2020, 1:14 AMalex cole
11/25/2020, 1:15 AMMartin Nowosad
11/25/2020, 5:53 AMMilan Hruban
11/25/2020, 7:38 AMimport kotlin.math.pow
fun myFunction(a: Double, b: Double, c: Double) = { x: Double -> a * x.pow(2.0) + b * x + c }
alex cole
11/25/2020, 4:09 PMnanodeath
11/25/2020, 4:36 PM