0
$\begingroup$

Now I have two functions f[x] and g[x] which both contains another variable a, or we can note as f[a,x] and g[a,x]. Now I need to solve the equation Solve[Integrate[f[a,x],{x,0,2Pi}]==Integrate[g[a,x],{x,0,2Pi}],a] to solve the value of a, however, f and g are both hard to do an analytical integral. So now I have to use NIntegrate instead, but the NIntegrate function seems cannot contain a variable a in it.

What can I do to solve the a?

Update: I can show the example of f[x] and g[x] as follow.

f[abratio_] := 
  Integrate[(\[Zeta]1[\[Theta]] \[Zeta]2[\[Theta]] Cos[\[Theta]]^4)/(
   DD[\[Theta]] (abratio^2 Cos[\[Theta]]^2 + Sin[\[Theta]]^2)^(3/
       2)), {\[Theta], 0, 2 Pi}];
g[abratio_] := 
  Integrate[(\[Zeta]1[\[Theta]] \[Zeta]2[\[Theta]] Cos[\[Theta]]^2 \
Sin[\[Theta]]^2)/(
   DD[\[Theta]] (abratio^2 Cos[\[Theta]]^2 + Sin[\[Theta]]^2)^(3/
       2)), {\[Theta], 0, 2 Pi}];

or

$$f(a)=\int^{2\pi}_0 \frac{\zeta_1(\theta)\zeta_2(\theta)\cos^4(\theta)}{DD(\theta)[a^2 \cos^2(\theta)+\sin^2(\theta)]^{3/2}}d\theta $$ $$g(a)=\int^{2\pi}_0 \frac{\zeta_1(\theta)\zeta_2(\theta)\cos^2(\theta) \sin^2(\theta)}{DD(\theta)[a^2 \cos^2(\theta)+\sin^2(\theta)]^{3/2}}d\theta $$

where $\zeta$ and DD are other functions about $\theta$.

$\endgroup$
  • $\begingroup$ What reason do you have to believe there is an unique solution for a? (For example, suppose f=a+Sin and g=a+Cos, etc.) $\endgroup$ – Alan Nov 4 '16 at 13:07
  • $\begingroup$ @Alan Yes it's a equation in a paper that I was reading. It is right and the author gave out numerical solution to the problem. $\endgroup$ – bushiwo Nov 4 '16 at 13:57
  • 1
    $\begingroup$ See 1 2 3 etc. $\endgroup$ – Daniel Lichtblau Nov 4 '16 at 14:26
  • 1
    $\begingroup$ I should add that a simple search of MSE using "numerical integration parameter" (without quotes) gives multiple hits for how to do this sort of thing e.g. using _?NumericQ restrictions on variables. $\endgroup$ – Daniel Lichtblau Nov 4 '16 at 14:30
  • $\begingroup$ @DanielLichtblau Yes it works,thanks. $\endgroup$ – bushiwo Nov 4 '16 at 15:06
0
$\begingroup$

If you define the functions f[a] and g[a] to be only defined for numerical input, like:

f[abratio_?NumericQ] := 
  Integrate[(\[Zeta]1[\[Theta]] \[Zeta]2[\[Theta]] Cos[\[Theta]]^4)/(
   DD[\[Theta]] (abratio^2 Cos[\[Theta]]^2 + Sin[\[Theta]]^2)^(3/
       2)), {\[Theta], 0, 2 Pi}];
g[abratio_?NumericQ] := 
  Integrate[(\[Zeta]1[\[Theta]] \[Zeta]2[\[Theta]] Cos[\[Theta]]^2 \
Sin[\[Theta]]^2)/(
   DD[\[Theta]] (abratio^2 Cos[\[Theta]]^2 + Sin[\[Theta]]^2)^(3/
       2)), {\[Theta], 0, 2 Pi}];

Then you can numerical solve for a using FindRoot:

FindRoot[f[a]==g[a], {a,a0}]

where a0 is an initial numerical guess for a.

$\endgroup$

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