Is there function of Laplacian operator in scipy (or in other python library )? - scipy

I would like to take the Laplacian of a function in polar coordinates.
Is there any operator in python for this?

Related

Dot product between transpose of sparse matrix and vector in python scipy

I know the function spmat.dot(vec) that returns the standard matrix vector 'dot' product between a sparse matrix spmat and a numpy array vec in scipy.
I need to compute transpose(spmat).dot(vec). Is there a built in function that does exactly this ?
During my research, I stumbled upon scipy.sparse.linalg.LinearOperator.rmatvec, but it does not seem to be available in my scipy version.
Thanks,

Using cv.remap (mexopencv) instead of interp2 (MATLAB)

I am experimenting with the mexopencv project that allows using the
OpenCV library from MATLAB .m files in order to compare the performance
of the native MATLAB functions with the OpenCV functions
I would like to substitute a call to the MATLAB interp2 function:
Vq = interp2(X,Y,V,Xq,Yq) returns interpolated values of a function of two variables at specific query points using linear interpolation. The results always pass through the original sampling of the function. X and Y contain the coordinates of the sample points. V contains the corresponding function values at each sample point. Xq and Yq contain the coordinates of the query points.
The substitute shall be a call to the cv.remap function.
Applies a generic geometrical transformation to an image
dst = cv.remap(src, map1, map2)
dst = cv.remap(src, map1)
dst = cv.remap(..., 'OptionName',optionValue, ...)
The three SO questions Similar OpenCV Api for interp2 in Matlab,
How to do grid interpolation interp2 in OpenCV
and cv::remap (in opencv) and interp2 (matlab)
state that the OpenCV function remap can be used instead of the native MATLAB
function interp2, but I have no idea how-to correctly interpret/transform the
arguments (I have no experience regarding MATLAB and computer vision).
How can I use the mexopencv function cv.remap to get the same effect as if one
would call Vq = interp2(X,Y,V,Xq,Yq)?

Multidimensional Shape Preserving/Monotone Spline - Matlab

Does anyone know whether matlab has anything similar to PCHIP for multidimensional interpolation? I can use it for 1-dimensional interpolation. For multidimensional, matlab only allows me to use spline. The issue with splines is that they are not shape preserving. Below an example taken from here on why the difference between them is actually very important:

Differentiate function without Symbolic Math Toolbox

If I want to differentiate a function, I would do the following:
syms x
f(x) = sin(x^2);
df = diff(f)
,but that requires the use of the Symbolic Math Toolbox (for the syms function).
Is there a workaround (an alternative) to this method without the use of the Symbolic Toolbox?
If you have a numerical vector and you'd like to differentiate it, then the gradient function is your friend.
If you want to differentiate a symbolic expressing then the Symbolic Math Toolbox is the only way to go within Matlab. If pen&paper together with wolframalpha.com does not serve you, there is no way around to buy the toolbox or use alternatives like Wolframs Mathematica, Maple, Maxima, Sympy, Sage etc..
https://www.mathworks.com/matlabcentral/fileexchange/59438-symbolic-derivatives
In the above link, you will find a function that requires string 'sin(x^2)' as input and gives you something like 'cos(x^2)*2*x' (i.e. also a string). You may then use standard Matlab's eval() to evaluate the derivative numerically at any x point.

Transform a solution vector of PDE into a piecewise linear function - MATLAB

I know that when I use the PDE toolbox in Matlab to solve a PDE the result is a vector, which represents the values of the function in each vertex of the mesh.
Is there a command in the PDE toolbox such that we could transform the vector solution into a piecewise linear function on the domain of definition, so that we could be able to use it like u(x,y) to find directly the approximate value in (x,y)?
I don't know about such function. But your solution is defined on a structured rectangular grid. If you simply need to interpolate data on a 2D rectangular grid, you can use interp2 for that. If your grid is made of triangles, use TriScatteredInterp. If you want to use different interpolation (e.g., FEM), you will have to implement it yourself.