1
$\begingroup$

I'm really new to Mathematica and all the other answers to similar questions don't seem to help me. I have an integral I'd like to solve, and I'm having problems. My integral looks like this:

$\int_{0}^{\pi}e^{\frac{\gamma\beta}{r^3}[3\cos{\theta}\cos{\theta'}-\cos{(\theta-\theta')}]} d\theta'$

where all other parameters should be free to change after the integration. My attempt in Mathematica was this:

funct[theta0_?NumericQ, r_?NumericQ, beta_?NumericQ, gamma_?NumericQ] := 
   NIntegrate[
     Exp[(beta*gamma/r^3)*(3*Cos[theta]*Cos[theta0] - Cos[theta0 - theta])], 
     {theta, 0, Pi}]

I'm not even sure if it's working or not. What should this even return? Eventually I'd like to plot the function in the $(r,\,\theta)$ plane with $\gamma$ and $\beta$ free to change for the user. Any help is appreciated.

$\endgroup$

1 Answer 1

2
$\begingroup$

Try utilizing Manipulate.

Manipulate[
  tbl = 
    Flatten[
     Table[{θ0, r, funct[θ0, r, β, γ]}, {θ0, 1, 10, 0.5}, {r, 1, 10, 0.5}],  
     1];
   ListPlot3D[tbl, AxesLabel -> {θ, r, v}, PlotRange -> All],
   {β, -2, 2, 0.1},
   {γ, -2, 2, 0.1}]

enter image description here

$\endgroup$

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.