In Math, functions are pretty much multipliable,
If you have f(x) = 2x, and g(x) = x+5,
then f.g(x) = 2x * (x+5)
To achieve that, you can use a function that takes 2 functions as arguments and multiplies them mathematically:
public static class FunctionsHelper
{
private static Func<double, double> MultiplyTwoFunctions(Func<double, double> f1 , Func<double,double> f2)
{
Func<double, double> result = (double x) => f1(x) * f2(x);
return result;
}
private static Func<double, double> GetSquareOfFunction(Func<double, double> f)
{
Func<double, double> result = (double x) => Math.Pow(f(x) ,2);
return result;
}
}
double cste = 10.0;
Func<double,double> F = (double x) => x * cste;
Func<double,double> SquaredFunction = FunctionsHelper.GetSquareOfFunction(F);
doube x = SquaredFunction(5.00);