# ApproxFun for vector-valued function

Hello,

I have a vector-valued and nonlinear function f:\mathbb{R}^n \xrightarrow{} \mathbb{R}^m with n, m \sim 50.
I am only interested in the local behavior of this function about a n-dimensional interval [a_1, b_1] \times [a_2, b_2] \times \ldots \times [a_n, b_n].

Do you have an example that use ApproxFun on multi-dimensional function

This function f  is just an example

using LinearAlgebra
using ApproxFun

n = 50
m = 50
a = randn(n)

b = a .+ rand(n)

# [a; b] defines the lower-upper bound intervals

function f(x)
out = zeros(m)
out[1] = 1.0
for i=2:m
out[i] = out[i-1]*cos(x[i])*exp(-x[i-1]^2)
end
return out
end

1 Like

What behaviour are you interested in?

I would like to get the Jacobian and Hessian. The function f involves intermediates computations in the complex space.

1 Like

Do you want to evaluate the Jacobian and Hessian at a single point? If so then you can use ForwardDiff.jl. Note that you will need to change zeros(m) to something like zeros(eltype(x), m).

ForwardDiff doesnâ€™t support intermediate computations in the complex space. I need to evaluate the derivatives (Jacobian and Hessian) at multiples evaluation points. These evaluation points are â€ścloseâ€ť.

This is well-beyond ApproxFunâ€™s capabilities: it can only do 2D, not 50D. To get to 50D one would need more sophisticated low rank approximation like tensor trains, but that will only work well Cass with low rank functions

3 Likes

Can there be something done analytically using ModelingToolkit?

I agree that TT is probably the best approach, but a Smolyak grid may also be viable alternative and there are some Julia implementations. I saw some TT libraries for Julia on Github but didnâ€™t try any of them.

1 Like

Smolyak grid support in ApproxFun would be awesome

2 Likes

What do you think about the approach in

?

1 Like

Thank you all for your feedbacks =)

Do you have some references of Julia packages that implement TensorTrain or Smolyak grid techniques, and support differentiation?

Itâ€™s not documented , but this package will compute derivatives too, via the smolyak_derivative() function.

3 Likes