But interesting nonetheless.
>> syms x
>> f = @(x) log(sqrt(x)).^2
f = function_handle with value:
@(x)log(sqrt(x)).^2
>> f(x)
ans = log(x^(1/2))^2
>> finverse(f(x))
ans = exp(2*x^(1/2))
And to implement under: function u = under(f, g)
syms x
g_inv = matlabFunction(finverse(g(x)));
u = @(x) g_inv(f(g(x)));
end function y=odddouble(a,b)
y=2*x+1
endfunction
you can do >>> h = under(@(x) 1/x, odddouble)
>>> h(3)
?
If so, yeah, I agree you can implement under in matlab (as long as you have the symbolic toolbox as well); in which case it's probably one of very few non-CAS systems where you can define it.It is definitely not as elegant as the built-in facility in J, but definitely doable and usable in Matlab. In fact, I think any language with flexible enough function overloading should be able to implement such a feature.