2
$\begingroup$

I'm trying to model an experiment for a paper which includes an integral that should be no problem for mathematica but it refuses to integrate it. The integral I need to evaluate is as follows

G[q_, t_] := (E^(2 I Sqrt[676000000 \[Pi]^2 -q^2] (23/1000000 + 
(1 - Cos[75000 t])/20000))q^3 ((8.46*^11 + 2.63*^11 I) 
Sqrt[1.88*^-13 - q^2] - Sqrt[(0.16 + 0.049 I) - q^2]))/(Sqrt[
676000000 \[Pi]^2 - q^2] ((8.46*^11 + 2.63*^11 I) Sqrt[1.88*^-13 
- q^2] + Sqrt[(0.15 + 0.049 I) - q^2]));

enter image description here

As you can see, it's a function of both q and t and I need to integrate it over q while keeping t constant as I have to integrate over t later on in the simulation. I have no idea why it won't integrate, please help!

Supplementary Information - this is me trying to solve the problem

The function G here is made up of two functions, rp, and another called Phi_{PDM}.

Phi_{PDM} integrated over q is no problem, it's also where the t dependence comes from, I've included here for completeness.

enter image description here

The problem lies with the function rp as I cannot get mathematica to integrate this function over q

enter image description here

enter image description here

As you can see, there is a singularity at small values of q which is probably whats causing the problem and I tried to mitigate this with assuming q is real and/or is above 10 but this still does not help. Here is the code for the equations:

Phi[q_, t_] := (q^3/(Sqrt[(2*\[Pi]*13000)^2 - q^2]))*Exp[I*2* 
(Sqrt[(2*\[Pi]*13000)^2 - q^2])*(23*^-6 + 50*^-6*(1 - 
Cos[75000*t]))];

rp[q_] := ((8.46*^11 + 2.63*^11 I) Sqrt[1.88*^-13 - q^2] - 
Sqrt[(0.16 + 0.049 I) - q^2])/((8.47*^11 + 2.63`*^11 I) Sqrt[
 1.88*^-13 - q^2] + Sqrt[(0.16 + 0.049 I) - q^2])

I'm not very good at mathematica and I'm certainly not the savviest when it comes to mathematics in general so any ideas regarding this, or indeed a method of solving G that I'm just not seeing due to me being a novice, would massively appreciate!

$\endgroup$
14
  • $\begingroup$ Welcome to the Mathematica Stack Exchange. Have you tried NIntegrate? $\endgroup$
    – Syed
    Commented Aug 26, 2022 at 17:50
  • $\begingroup$ Hey there, thanks for the welcome. As I said in the post, NIntegrate is useless for my purposes, I must solve it with the Integrate function $\endgroup$
    – Koji
    Commented Aug 26, 2022 at 17:52
  • 1
    $\begingroup$ It is not quite understandable: You have to integrate a numerical function und must avoid NIntegrate ? $\endgroup$ Commented Aug 26, 2022 at 19:07
  • $\begingroup$ Well I have isolated the problem I'm having later in the code with this expression. For my simulation there is also a time dependent variable "t" included in the integral leaving me with an expression to integrate over "q" while leaving "t" constant. Since I know it's this particular part of of the expression that's giving me trouble, I thought I would simplify but if you think it makes more sense to include the full expression then I shall do so! $\endgroup$
    – Koji
    Commented Aug 26, 2022 at 19:21
  • 1
    $\begingroup$ @Koji Please show the full expression. Knowing rp[q,t] you can calculate int[t_ NumericQ]:=NIntegrate[rp[q,t],{q,0,20}] depending on t. $\endgroup$ Commented Aug 26, 2022 at 19:32

1 Answer 1

3
$\begingroup$

I solved the issue and thought it instructive to post the solution:

A contributor in the comments mentioned using NumericQ with NIntegrate, a function I had never previously come across. Turn out you can attach this to variable in an equation and it acts as a placeholder until such time that there is a number for that variable that then allows you to solve the problem numerically

rp[q_] := ((8.46*^11 + 2.63*^11 I) Sqrt[1.88*^-13 - q^2] - 
Sqrt[(0.16 + 0.049 I) - q^2])/((8.47*^11 + 2.63`*^11 I) Sqrt[
1.88*^-13 - q^2] + Sqrt[(0.16 + 0.049 I) - q^2])

\[Phi][\[Omega]_, q_, t_] := (q^3/(Sqrt[(2*\[Pi]*\[Omega])^2 - q^2]))*
Exp[I*2*(Sqrt[(2*\[Pi]*\[Omega])^2 - q^2])*z[t]];

G[\[Omega]_, t_?NumericQ] := 
NIntegrate[rp[\[Omega], q]*\[Phi][\[Omega], q, t], {q, 0, 2000000}]
array = ConstantArray[0, 50];

For[i = 1, i < 51, i++,
   array[[i]] = NIntegrate[Rationalize[FullSimplify[\[Alpha]tip[[i]]/(
   1 - \[Alpha]tip[[i]]*G[\[Nu][[i]], t])]]*Exp[I*5*75000*t], {q,0, 
   2000000}, {t, 0, 2 \[Pi]/75000}, AccuracyGoal -> 5];
   ]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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