Triplequad function with symbolic variables
2 次查看(过去 30 天)
显示 更早的评论
Hi Dear Matlab users
My problem is I wrote a function just below.
function out = ahmet(r,s,zeta)
syms z1
out=2*r.^2*s.^4*zeta*z1;
end
Then I called this function to be used for
k=triplequad('ahmet',-1,1,-1,1,-1,1)
It gives me errors telling that ''Inputs must be floats, namely single or double.''
If I omit z1 variable which is symbolic then it evaluates the quadrature but I want z1 stay and not calculated in the equation. Is it possible for quadrature ?
It is possible for int() command using symbolic variables. But I have to bring together both quadrature and symbolic variables ?
Thank you
0 个评论
回答(1 个)
Walter Roberson
2013-3-2
syms r s zeta
k = int( int( int( ahmet(r, s, zeta), r, -1, 1), s, -1, 1), zeta, -1, 1);
Note that the result (if it can be analytically found) will likely have z1 as a free variable.
Caution: if you replace the limits of integration for zeta with "a" and "b", the integral works out as (4/15)*z1*(b^2-a^2) . And when abs(a) = abs(b) as is the case for -1 to +1, the solution is going to be identically 0 for all values of z1.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Number Theory 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!