You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
do we have relation between LommelS2 and MeijerG in matlab?
8 views (last 30 days)
Show older comments
Do we have matlab relation between two special function "LommelS2 and MeijerG"?
How to convert LommelS2 code into MeijerG?
Please help !!
Answers (2)
Walter Roberson
on 25 Jan 2021
Edited: Walter Roberson
on 26 Jan 2021
and scroll down to near the bottom to see the conversions.
19 Comments
gourav pandey
on 25 Jan 2021
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
on 26 Jan 2021
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
on 27 Jan 2021
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
on 28 Jan 2021
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
on 28 Jan 2021
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
on 28 Jan 2021
"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
on 4 Apr 2021
Edited: Walter Roberson
on 4 Apr 2021
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
on 4 Apr 2021
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
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
on 4 Apr 2021
Edited: Walter Roberson
on 4 Apr 2021
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
on 4 Apr 2021
Edited: Walter Roberson
on 5 Apr 2021
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) =
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) =
syms alpha t real
assume(0 < alpha & alpha < 1)
assume(0 <= t & t <= 1)
ABC(alpha) = 1 - alpha + (alpha / gamma(alpha)) %CORRECTED
ABC(alpha) =
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 =
y(t) = simplify(ypart1 + ypart3 ./ ypart2)
y(t) =
Mubashara Wali
on 5 Apr 2021
Edited: Walter Roberson
on 5 Apr 2021
Walter Roberson thanx for detailed answer. It made my concept clear now
Walter Roberson
on 5 Apr 2021
it looks like I entered the wrong ABC; I will fix it when I get back to my computer.
Walter Roberson
on 5 Apr 2021
I have corrected the ABC and regenerated the result. I had accidentally put in 1 - 1- alpha instead of 1 - alpha
gourav pandey
on 5 Apr 2021
Edited: gourav pandey
on 5 Apr 2021
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 Comment
Walter Roberson
on 5 Apr 2021
You are overwriting Lommels within the loop, so the final result will reflect only m == n
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)