do we have relation between LommelS2 and MeijerG in matlab?
2 次查看(过去 30 天)
显示 更早的评论
Do we have matlab relation between two special function "LommelS2 and MeijerG"?
How to convert LommelS2 code into MeijerG?
Please help !!
回答(2 个)
Walter Roberson
2021-1-25
编辑:Walter Roberson
2021-1-26
and scroll down to near the bottom to see the conversions.
19 个评论
gourav pandey
2021-1-25
thank you for you reply
n=2;
m=5;
omega=10;
a=-(1./4).*n-(1./4).*m+5./4
k2=(1./4).*n+(1./4).*m+1./4
k3=-(1./4).*n-(1./4).*m-1./4
k4=-(1./4).*n-(1./4).*m+5./4
z=-(1./4).*omega.^2
fun=meijerG([[a], []], [[k2,k3,k4], []], z);
LommelS2 = -fun./(2.*sqrt(pi).*gamma((1./2).*n+(1./2).*m).*2.^((1./2).*n+(1./2).*m-1./2));
## can you tell me what is wrong in this code??
Walter Roberson
2021-1-26
format long g
n=2;
m=5;
omega=10;
a=-(1./4).*n-(1./4).*m+5./4
a =
-0.5
k2=(1./4).*n+(1./4).*m+1./4
k2 =
2
k3=-(1./4).*n-(1./4).*m-1./4
k3 =
-2
k4=-(1./4).*n-(1./4).*m+5./4
k4 =
-0.5
z=-(1./4).*omega.^2
z =
-25
fun=meijerG([a], [], [k2,k3,k4], [], z);
LommelS2 = -fun./(2.*sqrt(pi).*gamma((1./2).*n+(1./2).*m).*2.^((1./2).*n+(1./2).*m-1./2));
LommelS2
LommelS2 =
2.52409581072613e-06 + 0.000920671745445133i
gourav pandey
2021-1-27
actually not completely.
fun1:=evalf(convert(LommelS2(-(1/2)*n-(1/2)*j+3/2, (1/2)*n+(1/2)*j+1/2, I*omega),MeijerG))assuming omega::real,0<omega;
fun1 := 0.00004212956333 + 0.00001923699304 I
fun2:=evalf(convert(LommelS2(-(1/2)*n-(1/2)*j+3/2, (1/2)*n+(1/2)*j+1/2, -I*omega),MeijerG))assuming omega::real,0<omega;
fun2 := 0.00004212956333 + 0.00001923699304 I
fun3:=evalf(LommelS2(-(1/2)*n-(1/2)*j+3/2, (1/2)*n+(1/2)*j+1/2, -I*omega));
fun3 := 0.00004212956330 - 0.00001923699311 I
fun4:=evalf(LommelS2(-(1/2)*n-(1/2)*j+3/2, (1/2)*n+(1/2)*j+1/2, I*omega));
fun4 := 0.4212956330e-4+0.1923699311e-4*I
as you suggested to get relation from MAPLE. so the above code is coded in maple. fun1 and fun2 are conjugate of eact other similarly fun3 and fun4. but we can see the difference in the answer of fun2 and fun3. you can see in BOLD letters.
fun1 and fun2 are converting the lommelS2 into MeijerG where fun3 and fun4 are directing calculating the lommelS2.
there is an issue with conjugate no. in MeijerG. do you know how to resolve this issue??
thank you!!
Walter Roberson
2021-1-28
Your output of a specific numeric number for fun1 implies that you were using specific numeric n and specific numeric omega (even though you have an assumption as-if omega were a variable instead of constant.) . However, I was not able to figure out what specific numeric n and omega you were using.
Is it correct that your j in the Maple code refers to sqrt(-1) ?
Walter Roberson
2021-1-28
Maple does indeed produce inconsistent results for the conversion depending upon whether the z is positive imaginary or negative imaginary. I have filed a bug report for Maple and will see what the response is.
gourav pandey
2021-1-28
"n" and "j" are the constant where omega is variable between -infinity to +infinty. actually bymistakenly i forget the write the value of n,j,omega. but here my point is "why we are getting different answer for same values of n,j and omega"
even you can check the above code for any random values of n,j,omega.
'j' is not an sqrt(-1)
Walter Roberson
2021-4-4
编辑:Walter Roberson
2021-4-4
syms mu nu z
numer = meijerG([mu/2 + 1/2], [], [mu/2 + 1/2, nu/2, -nu/2], [], z.^2/4) .* 2.^mu;
denom = 2 .* gamma(-mu/2 + nu/2 + 1/2) .* gamma(-mu/2 - nu/2 + 1/2);
S2 = numer./denom;
LommelS2(nu, nu, z) = S2;
Caution: this might not operate properly if mu or nu are not scalars. Also, there could be problems if nu = mu+1
Mubashara Wali
2021-4-4
Walter Roberson its not working, giving a error "Attempt to execute SCRIPT Lommel as a function:"
Actually I need to find the value of the following
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/572537/image.png)
where 0 <alpha <1
ABC(alpha)=1- alpha + (alpha / gamma(alpha))
and t belongs to [0, 1]
Your kind help will be appreciated.
Walter Roberson
2021-4-4
编辑:Walter Roberson
2021-4-4
Could you post a link to where I suggested creating or calling a function or script named Lommel ? The code I posted at https://www.mathworks.com/matlabcentral/answers/726363-do-we-have-relation-between-lommels2-and-meijerg-in-matlab#comment_1437812 shows creating a symbolic function named LommelS2
Your "actually I need" uses LommelS1 not LommelS2 so I am confused.
Walter Roberson
2021-4-4
编辑:Walter Roberson
2021-4-5
syms mu nu z
S1part1 = meijerG([mu/2 + 1/2], [], [mu/2 + 1/2], [nu/2, -nu/2], z^2/4);
S1part2 = 2.^(mu - 1);
S1part3 = 2 .* gamma(mu/2 + 1/2 + nu/2) .* gamma(mu/2 + 1/2 - nu/2);
LommelS1(mu, nu, z) = simplify(S1part1 .* S1part2 .* S1part3)
LommelS1(mu, nu, z) =
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/572712/image.png)
S2part1 = meijerG([mu/2 + 1/2], [], [mu/2 + 1/2, nu/2, -nu/2], [], z.^2/4);
S2part2 = 2.^mu;
S2part3 = 2 .* gamma(-mu/2 + nu/2 + 1/2) .* gamma(-mu/2 - nu/2 + 1/2);
LommelS2(mu, nu, z) = simplify(S2part1 .* S2part2 ./ S2part3)
LommelS2(mu, nu, z) =
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/572717/image.png)
syms alpha t real
assume(0 < alpha & alpha < 1)
assume(0 <= t & t <= 1)
ABC(alpha) = 1 - alpha + (alpha / gamma(alpha)) %CORRECTED
ABC(alpha) =
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/572862/image.png)
ypart1 = (1-alpha)/ABC(alpha);
ypart2 = gamma(alpha+1) * ABC(alpha);
ypart3 = t.^(1+alpha) - sqrt(t) * LommelS1(3/2+alpha, 1/2, t)
ypart3 =
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/572867/image.png)
y(t) = simplify(ypart1 + ypart3 ./ ypart2)
y(t) =
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/572872/image.png)
Mubashara Wali
2021-4-5
编辑:Walter Roberson
2021-4-5
Walter Roberson thanx for detailed answer. It made my concept clear now
Walter Roberson
2021-4-5
it looks like I entered the wrong ABC; I will fix it when I get back to my computer.
Walter Roberson
2021-4-5
I have corrected the ABC and regenerated the result. I had accidentally put in 1 - 1- alpha instead of 1 - alpha
gourav pandey
2021-4-5
编辑:gourav pandey
2021-4-5
Walter Roberson, thanks for your reply..can you help me here also
clc;
close;
clear all;
n=5;
h=@(omega1) 0;
for m= 0:1:n
mu1c = -(1./2).*n-(1./2).*m+3./2 ;
nu1c = (1./2).*n+(1./2).*m+1./2 ;
Lommels =@(omega1) meijerG([(1./2).*mu1c+1./2], [], [(1./2).*mu1c+1./2, (1./2).*nu1c, -(1./2).*nu1c], [], -(1./4).*omega1.^2).*2^mu1c./(2.*gamma(-(1./2).*mu1c+(1./2).*nu1c+1./2).*gamma(-(1./2).*mu1c-(1./2).*nu1c+1./2))
end
Lommels(1)
Lommels(10)
Lommels(99)
Lommels(100)
Lommels(500)
Lommels(1000)
%% Why m i getting sudden blow in value of 'Lommels' when omega1 veluse more than 120 or 150... it should decay as omega1 increase.
Thank you in advance!!
1 个评论
Walter Roberson
2021-4-5
You are overwriting Lommels within the loop, so the final result will reflect only m == n
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)