2
$\begingroup$

I have a two part question,

I am trying to solve what should be a very straightforward equation, but I keep getting messages. Here is the equation

a = -0.0154213 Sin[Pi/4 + Pi/8*x]

Here is the code I am using

Solve[a == 0, x]

When I use this code, Mathematica tells me I should use Reduce for a complete solution. When I use Reduce instead of Solve, I get "unable to solve the system with inexact coefficients".

Also, I want to solve the same equation for values between -2 and 2, How do I explicitly define that range? I tried using the following code to no avail.

Solve[a == 0, t, {-2, 2}]  

Any help would be appreciated.

FWIW, when i use Solve it does give me one of the three solutions I should be getting.

$\endgroup$
  • $\begingroup$ try Solve[{a==0, -2<=t<=2},t] $\endgroup$ – kglr Sep 13 '18 at 17:08
  • $\begingroup$ @kglr, you are awesome! thank you! Now, I got all 3 solutions I needed but they came with the same, "unable to solve the system with inexact coefficient" error. Should I be worried about this error message? is it because its a periodic function? $\endgroup$ – Isaac Ayele Sep 13 '18 at 17:16
3
$\begingroup$

Replace 0.0154213 with the exact number 154213/10000000:

a = -154213 /10000000 Sin[Pi/4 + Pi/8*x];

Solve[a == 0, x] 

{{x -> ConditionalExpression[-((2 (π - 8 π C[1]))/π), C[1] ∈ Integers]},
{x -> ConditionalExpression[-(( 2 (π - 4 (π + 2 π C[1])))/π), C[1] ∈ Integers]}}

Solve[a == 0, x] /. C[1] -> 0

{{x -> -2}, {x -> 6}}

Reduce[a == 0, x] /. C[1] -> 0

x == -2 || x == 6

To constrain x to the interval $[-2,2]$:

Solve[{a == 0, -2 <= x <= 2}, x]

{{x -> -2}}

$\endgroup$
1
$\begingroup$

Its a issues with your syntax, you need to make a a function.

a[x_] := -0.0154213 Sin[Pi/4 + Pi/8*x]
Solve[a[x] == 0, x]
(*{{x -> -2.}}

Now if you plot the function you see it has three zeroes you can use FindRoot and a plot to get exact values.

enter image description here

FindRoot[a[x], {x, 0}]
FindRoot[a[x], {x, -10}]
FindRoot[a[x], {x, 5}]
 (*{x -> -2.}
   {x -> -10.}
   {x -> 6.}*)
$\endgroup$

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