A wrapper for MATLAB symbolic library implementation of the 'MeijerG' G^{m,n}_{p,q}(...|z) function.
A wrapper for MATLAB symbolic library implementation of the 'MeijerG' G^{m,n}_{p,q}(...|z) function.
Syntax : MeijerG({[a_1,...a_n],[a_n+1,...a_p]},{[b_1,...b_m], [b_m+1,...b_q]},z)
Input arguments :
a - {[a_1,...a_n],[a_{n+1},...a_p]}
b - {[a_1,...a_m],[a_{m+1},...a_q]}
z - matrix of (possibly complex) numbers
Output:
y - has same dimensions as 'z'
1.) For invalid arguments, 'double' function for converting results back from symbols would return an error. 'MeijerG' catches the error, displays a warning, and sets corresponding position of 'y' to 'nan'.
2.) 'double' to 'string' conversion used for forming the symbolic expressions causes a precision loss, and possibly, round of errors.
3.) Sometimes, even the slightest changes to arguments could produce unacceptable results.
e.g.
>> MeijerG({[1,1], []},{1, 1},[1,2,3])
ans =
NaN 0.666666666666667 0.750000000000000
>> MeijerG({[1,1], []},{1, 1},[1+1e-5,2,3])
ans =
0.500002499987500 0.666666666666667 0.750000000000000
Here the second result appears correct, since MeijerG({[1,1], []},{1, 1},z ) = z/(z+1).
Please let me know if such issues can be circumvented.
MOHAMMED ELAMASSIE (view profile)
noosa (view profile)
Hi Damith,
Thank you very much for your answers, they are very helpful for me.
Damith Senaratne (view profile)
@noosa,
There should be ways around the problem. But I cannot say which one will work for you.
1. There may be a simple fix because you already know that MeijerG output is probably wrong for k=1. I am assuming your mathematical expressions are correct (please double check to make sure k=1 is a valid value).
Since most of the functions we deal with are smooth, you can add a small perturbation to the arguments of MeijerG (as I have done with argument 1 in the example) . Try k = 1 + some delta (e.g. 1e-5). You cannot make delta arbitrarily small because of the lower precision. But you should be able to find a reasonably small value that gives acceptable results. The problem could be with a different parameter of MeijerG and not k. If so, you'll have to follow a trial and error approach.
2. Does your MeijerG compute only a mere factor in each term of a summation? If so the problem could be the terms not getting properly canceled out because of lower precision of MeijerG output. You can check the value each term of the summation evaluates to and detect if that's the case. Solution is not straightforward. You'd probably have to reformulate the expression to avoid the problem.
Hope my answer helps.
noosa (view profile)
Thank you Damith, I am also using the function for wireless performance analysis, but I got huge numbers with .10^25 :(((
Then I often get this error:
Warning: MeijerG: failed evaluating for k = 1
> In MeijerG at 85
It can influence the result? Or may it could be the reason of why I got huge numbers?
Thank you very much !
noosa (view profile)
Then I often get this error:
Warning: MeijerG: failed evaluating for k = 1
> In MeijerG at 85
It can influence the result? Or may it could be the reason of why I got huge numbers?
Thank you very much !
Damith Senaratne (view profile)
@noosa,
I haven't rigorously checked the output against maple or MATHEMATICA. However, I have tested the function with couple of examples. I have also used it to compute certain analytic (wireless communication) performance analysis results, and found them to agree with corresponding simulated values. But it is difficult to tell if the function produces accurate results all the time. The function merely invokes the MATLAB symbol engine (maple or mupad depending on the MATLAB version). So it shouldn't introduce errors, other than those caused in 'double'->'string' conversion.
Since you asked, I just tried my example on maple. The output I got (given below) seems to be consistent with what MATLAB function produces.
> evalf(MeijerG([[1, 1], []], [[1], [1]], 1));
MeijerG([[1.], []], [[1.], []], 1.)
> evalf(MeijerG([[1, 1], []], [[1], [1]], 2));
0.6666666667
> evalf(MeijerG([[1, 1], []], [[1], [1]], 3));
0.7500000001
> evalf(MeijerG([[1, 1], []], [[1], [1]], 1.00001));
0.5000025000 + 0. I
Hope this helps.
noosa (view profile)
I used your function in my code but it seems to give huge numbers ! please are you sure of output results? I mean did you compare some results with those given by maple for example?
Thank you !