Group Abstract Group Abstract

Message Boards Message Boards

Integrate this equation using the Wolfram Language?

Posted 9 years ago
Attachments:
POSTED BY: Nurul Ainina
12 Replies
POSTED BY: Henrik Schachner
Posted 9 years ago

Hi Henrik!

Thank you very much for your response and sharing your code! Mathematica is great and so are you :)

POSTED BY: Nurul Ainina

Numeric solution.

ClearAll["Global`*"]
f[a_?NumericQ, \[Alpha]_?NumericQ] := NIntegrate[x^3/Sqrt[(1 - x)*(1 - x*a^2*Cos[\[Alpha]]) - 3*a*x*Log[x]], {x, 0, 1}]

for a=1 and alfa=Pi

a = 1;
\[Alpha] = Pi;
f[a, \[Alpha]]
(*0.422834*)

  Plot[Evaluate@Table[f[a, \[Alpha]], {\[Alpha], 0, Pi, Pi/4}], {a, 0, 5}, PlotLegends -> {"\[Alpha]=0", "\[Alpha]=Pi/4", "\[Alpha]=Pi/2", 
    "\[Alpha]=3Pi/4", "\[Alpha]=Pi"}, AxesLabel -> {a, f[a, \[Alpha]]}]
  Plot[Evaluate@Table[f[a, \[Alpha]], {a, 0, 3, 1/2}], {\[Alpha], 0, Pi}, PlotLegends -> {"a=0", "a=1/2", "a=1", "a=3/2", "a=2", "a=5/2",
     "a=3"}, AxesLabel -> {\[Alpha], f[a, \[Alpha]]}]

enter image description here

Plot3D[f[a, \[Alpha]], {a, 0, 3}, {\[Alpha], 0, Pi},  AxesLabel -> Automatic, PlotLegends -> {"Integral"}]

enter image description here

ParametricPlot3D[Evaluate[Table[{a, \[Alpha], f[a, \[Alpha]]}, {\[Alpha], 0, 3, 0.25}]], {a, 0, 3}, BoxRatios -> {1, 1, 1}, AxesLabel -> {"a", "\[Alpha]", "f[a,\[Alpha]]"}]

enter image description here

POSTED BY: Mariusz Iwaniuk
Posted 9 years ago

Thank you very much! I really appreciate your help!

POSTED BY: Nurul Ainina
Posted 9 years ago
POSTED BY: Nurul Ainina

Ok.Maybe like this:

ClearAll["Global`*"]
\[Alpha] = Pi/4;
f[a_?NumericQ] :=  NIntegrate[x^3/Sqrt[(1 - x)*(1 - x*a^2*Cos[\[Alpha]]) - 3*a*x*Log[x]], {x, 0, 1}]
Plot[f[a], {a, 0, 5}, PlotLegends -> {"\[Alpha]=Pi/4"}, AxesLabel -> {a, f[a]}]

enter image description here

POSTED BY: Mariusz Iwaniuk
Posted 9 years ago

Hi, sorry for the hiatus.

What if I want to know the value of "a" if I prescribed the value of C? enter image description here

POSTED BY: Nurul Ainina
 ClearAll["Global`*"]
 Remove["Global`*"]

 f[a_?NumericQ] := NIntegrate[x^3/Sqrt[(1 - x)*(1 - x*a^2*Cos[\[Alpha]]) - 3*a*x*Log[x]], {x, 0, 1}]

 c = 0.7;
 \[Alpha] = Pi/4;

 sol1 = FindRoot[c == f[a], {a, 1/2}]
 (* {a -> 0.267439} *)

 sol2 = FindRoot[c == f[a], {a, 4}]
 (* {a -> 4.15722} *)

 Plot[{f[a], c}, {a, 0, 5}, PlotLegends -> {"\[Alpha]=Pi/4", "c"}, Epilog -> {Red, AbsolutePointSize[6], Point[{{a /. sol1, c}, {a /. sol2, c}}]}, 
 Prolog -> {Green, Line[{{a /. sol1, 0.4}, {a /. sol1, c + 0.1}}], Line[{{a /. sol2, 0.4}, {a /. sol2, c + 0.1}}]}, AxesLabel -> {a, f[a]}]

enter image description here

POSTED BY: Mariusz Iwaniuk
Posted 9 years ago

Wow! You are amazing! I have learned a lot from you! Thank you very much!

POSTED BY: Nurul Ainina

You're welcome. :)

POSTED BY: Mariusz Iwaniuk

This is just too complicated to integrate in closed form. Numerical integration will work.

POSTED BY: S M Blinder
Posted 9 years ago

Thank you for your comment :D

POSTED BY: Nurul Ainina
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard