0
$\begingroup$

I have this function :

f[Lambda_] := K Integrate[x Exp[- x^2-Lambda x]
HypergeometricU[-Lambda,1/2,(x+ Lambda/2+2)^2],{x,0,Infinity}];

where

K = 1/(Lambda (Lambda +4)/(4(4-Lambda)) 
    HypergeometricU[1 -Lambda,3/2, ( Lambda+ 4)^2/4] + 
    Integrate[Exp[-y /2( 2 y +2 Lambda)] 
    HypergeometricU[- Lambda,1/2,(2y Lambda+4)^2/4],{y,0,Infinity}])

I want to plot it for lambda in $[0,4]$, but it seems that it is too complicated to plot directly. I wanted to know what is the best way to have an approximated plot of this function.

$\endgroup$
  • 1
    $\begingroup$ Have you actually tried to plot it and something has not worked? Show what you have tried and the error you are receiving. While you are editing your post format your code with the {} button. $\endgroup$ – Edmund Feb 4 '16 at 0:42
4
$\begingroup$

Some of the definitions in the original question were problematic. I edited the question to have more consistent code.

In order to plot the function numerical values are needed, so using Integrate is not necessary. We can use NIntegrate instead. The plot is produced within 30 seconds on my laptop with Mathematica 10.3.1.

Here is the function redefined:

fn[Lambda_?NumericQ] :=
  Block[{K},
   K = 1/(Lambda (Lambda + 4)/(4 (4 - Lambda)) HypergeometricU[
         1 - Lambda, 3/2, (Lambda + 4)^2/4] + 
       NIntegrate[
        Exp[-y/2 (2 y + 2 Lambda)] HypergeometricU[-Lambda, 
          1/2, (2 y Lambda + 4)^2/4], {y, 0, Infinity}, 
        Method -> {Automatic, "SymbolicProcessing" -> 0}]); 
   K*NIntegrate[
     x Exp[-x^2 - Lambda x] HypergeometricU[-Lambda, 
       1/2, (x + Lambda/2 + 2)^2], {x, 0, Infinity}, 
     Method -> {Automatic, "SymbolicProcessing" -> 0}]
   ];

Here is the plot of the function:

AbsoluteTiming[
 Plot[fn[x], {x, 0.1, 4}, PerformanceGoal -> "Speed"]
]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you so much ! I am a beginner with Mathematica :D $\endgroup$ – Rim Feb 5 '16 at 1:01
  • $\begingroup$ @Rim No problem, good luck! $\endgroup$ – Anton Antonov Feb 5 '16 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.