I want the product of two functions $f(x),g(x)$
$$f(x) = x + \sin(x)\\ g(x) = x - \sin(x)$$
then
$$f(x)g(x) = x^2 - \sin^{2}(x)$$
How could I compute the product of two functions?.
I tried searching through Google which says to use inline or something like this
>> f = @(x) x - sin(x)
f =
@(x) x - sin (x)
>> g = @(x) x + sin(x)
g =
@(x) x + sin (x)
>> h = @(x) f(x)*g(x)
h =
@(x) f (x) * g (x)
But could not get the product.
Also, will the syntax change if I give the functions as the arguments of another function say $fun$ and will require products of functions inside the function $fun$?
I am using MATLAB 2013a.
>> h(1)
gives0.29193
and>> 1 - sin(1)^2
gives0.29193
. I have Octave, but it should not be different. $\endgroup$ – nicoguaro♦ May 31 '17 at 15:23chebfun
. $\endgroup$ – nicoguaro♦ May 31 '17 at 15:31