Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Dear sirs,
I am trying to obtain the improper integral that appear in the attached file. I cannot find the mistakes that I am having here.
As you can see the variables and constants inside the integral are column matrices.
Any advice will be highly appreciated.
thank you in advance,
Rogelio
Solved! Go to Solution.
If you still need the vector argument - both sheets, your original one and the modified one of Alan work, if you properly vectorize and use symbolic evaluation. However calculation time is rather long,
Find attached both sheets appropriatly modified - I just limited the vectors to three elements instead of the original 21 to "speed" up execution time. I haven't tried but I would expect the sheets to evaluate with larger vectors, too (unless it will run out of memory - not sure if this could be an issue).
Remark: The original sheet will take about 35% longer to evaluate compared to Alan's modification!
I would first try with scalar values to make that indefinite integral evaluate.
Then, when applying vectors, you should vectorize your expressions.
Rogelio de las Casas wrote:
...
I am trying to obtain the improper integral that appear in the attached file.
It's a proper integral - it has limits.
Note Werner's comments.
Also, the upper limit of your integral is too high - it involves numbers greater than Mathcad can handle. However, a lower limit works - you can test convergence by trying a few different upper limits. See attached.
There are improvements you could make to the worksheet. For example you've defined three different alpha functions, but you really only need one to which you pass the appropriate parameters. However, I haven't taken the time to do this in the attached.
Alan
It's a proper integral - it has limits.
Note Werner's comments.
But one of the limits is infinity - isn't that called an improper integral of type 1 in English? So if that integral is supposed to converge, maybe there is something wrong with the formulas.
BTW, I just noticed that, while being good habit when working with vector parameter lists, it wouldn't even be necessary in case of those functions to vectorize.
Werner Exinger wrote:
But one of the limits is infinity - isn't that called an improper integral inEnglish?
I understand an improper integral to be one without any specific limits.
Alan
But one of the limits is infinity - isn't that called an improper integral inEnglish?
I understand an improper integral to be one without any specific limits.
Alan
I thought thats called an indefinite integral.
I wasn't sure about the correct English expression (and in the first version of my reply I mistakenly called the integral in question an indefinite one) but (Google an Wikipedia are my friends 😉 I'm pretty sure now that an integral with an infinite integration interval is called inproper.
Werner Exinger wrote:
I'm pretty sure now that an integral with an infinite integration interval is called inproper.
Yes, you're right!
Alan
I am not sure that the integral fails because of results gretaer than 10^307. The result seems to be constant up to ul=88 and for ul=89 the error is thrown. But I have no clue what would cause that error in first place.
Also, if I try to evaluate the function with the integral symbolically, I get errors (used trace) about variables not defined, division by zero, etc. which as it seems all are due to missing vectorization (gamma, C1,..). Adding the necessary vectorization will let the expression evaluate symbolically, but unfortunately I did't had the time to wait for the eval to finish (if it would ever do so), one time MC crashes and "vanished" without any message.
Werner Exinger wrote:
I am not sure that the integral fails because of results gretaer than 10^307. The result seems to be constant up to ul=88 and for ul=89 the error is thrown. But I have no clue what would cause that error in first place.
if you extract function f1 (or function g1) from the integral and insert u = 89 (or bigger), with x,y and z =1, then you get the error message that Mathcad has encountered a number greater than 10^307, which was the reason I suggested this was the problem.
Alan
AlanStevens wrote:
Werner Exinger wrote:
I am not sure that the integral fails because of results gretaer than 10^307. The result seems to be constant up to ul=88 and for ul=89 the error is thrown. But I have no clue what would cause that error in first place.
if you extract function f1 (or function g1) from the integral and insert u = 89 (or bigger), with x,y and z =1, then you get the error message that Mathcad has encountered a number greater than 10^307, which was the reason I suggested this was the problem.
Alan
Yes, you are right. Just found it out by playing around with the expressions.
While f1(89) is a very small value with real and imaginary parts smaller than 10^-1000, during calculation its the term e^(alpha1(u)*d) which is responsible for the error. The real part of alpha1(89)*d is 712 and e^712 is 1.65*10^309, too large for Mathcads numerics.
So the integral should evaluate symbilically?
Werner Exinger wrote:
So the integral should evaluate symbilically?
It does if you replace the vectors at the start by scalars.
Alan
Can you please, provide the calculation in the mathcad file, i cannot take what you put there to insert in my mathcad file.
and thanks,
rogelio
Rogelio de las Casas wrote:
Can you please, provide the calculation in the mathcad file, i cannot take what you put there to insert in my mathcad file.
and thanks,
rogelio
Ok see attached. I've not bothered to change all the intermediate evaluations, just the final integration.
Alan
Thanks Alan.
Rogelio
If you still need the vector argument - both sheets, your original one and the modified one of Alan work, if you properly vectorize and use symbolic evaluation. However calculation time is rather long,
Find attached both sheets appropriatly modified - I just limited the vectors to three elements instead of the original 21 to "speed" up execution time. I haven't tried but I would expect the sheets to evaluate with larger vectors, too (unless it will run out of memory - not sure if this could be an issue).
Remark: The original sheet will take about 35% longer to evaluate compared to Alan's modification!
Perfect!!!
I really, really, appreciate all your help,
thank you to both of you: Wenner and Alan.
it is working great.
Regards,
Rogelio