0
$\begingroup$

I am getting the final integrate value with x range, I need to find the only one real parametera,but I receive an error:

This is the code after José:

Solve[NIntegrate[1-1/(1+a Cos[\[Pi] (x-14.625)/150]^2),{x,0,126}]==0.5,a]

error:

NIntegrate: The integrand 1-1/(1+a Cos[Times[<<3>>]]^2) has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,126}}.

General:Further output of NIntegrate::inumr will be suppressed during this calculation.

Solve: Solve was unable to solve the system with inexact coefficients or the system obtained by direct rationalization of inexact numbers present in the system. Since many of the methods used by Solve require exact input, providing Solve with an exact version of the system may help.

Out: Solve[NIntegrate[1-1/(1+a Cos[1/150 \[Pi] (x-14.625)]^2),{x,0,126}]==0.5,a]

Or try this: Solve[Integrate[1-1/(1+a Cos[\[Pi] (x-14.625)/150]^2),{x,0,126}]==0.5,a]

error:

Solve: Solve was unable to solve the system with inexact coefficients or the system obtained by direct rationalization of inexact numbers present in the system. Since many of the methods used by Solve require exact input, providing Solve with an exact version of the system may help.

out: Solve[126+1/Sqrt[(0.338738 -0.940881 I)+(0.338738 -0.940881 I) a] ((-27.4545-39.0638 I) ArcTanh[((1.8303*10^6+2.60425*10^6 I) (-2.-0.18185 a))/Sqrt[(0.338738 -0.940881 I)+(0.338738 -0.940881 I) a]]-(27.4545 +39.0638 I) ArcTanh[((2.69162*10^6+3.82978*10^6 I) (-2.-0.18185 a))/Sqrt[(0.338738 -0.940881 I)+(0.338738 -0.940881 I) a]]+(27.4545 +39.0638 I) ArcTanh[((0.328084 +0.466817 I) (-0.963507+0.416274 a))/Sqrt[(0.338738 -0.940881 I)+(0.338738 -0.940881 I) a]]-(27.4545 +39.0638 I) ArcTanh[((0.165316 +0.23522 I) a)/Sqrt[(0.338738 -0.940881 I)+(0.338738 -0.940881 I) a]])==0.5,a]

Is this possible or other way around to work it out?

$\endgroup$
3
  • $\begingroup$ Is there any restriction about a? Real ? a>0? $\endgroup$ Nov 24 '17 at 13:09
  • 2
    $\begingroup$ In addition your code has a lot of syntax errors: Solve[NIntegrate[1 - 1/(1 + a Cos[\[Pi] (x - 14.625)/150]^2), {x, 0, 126}]==0.5,a], $\endgroup$ Nov 24 '17 at 13:39
  • $\begingroup$ I fixed the syntax errors in your code. Please make the effort to copy/paste your code correctly. $\endgroup$ Nov 25 '17 at 11:20
1
$\begingroup$
f[a_?NumericQ] := 
 NIntegrate[1 - 1/(1 + a Cos[π (x - 14625/1000)/150]^2), {x, 0, 126}]

Using NSolve

soln1 = NSolve[f[a] == 1/2, a][[1]]

(* NSolve::ifun: Inverse functions are being used by NSolve, so some solutions 
    may not be found; use Reduce for complete solution information.

{a -> 0.00868611} *)

Using FindRoot

soln2 = FindRoot[f[a] == 1/2, {a, 1}]

(* {a -> 0.00868611} *)

Verifying

f[a] == 1/2 /. {soln1, soln2}

(* {True, True} *)
$\endgroup$
1
  • $\begingroup$ Thanks,Bob,this works! :) $\endgroup$
    – zhezhe
    Nov 25 '17 at 16:55

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.