MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Solving periodic functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74961] Re: Solving periodic functions
  • From: "dimitris" <dimmechan at yahoo.com>
  • Date: Fri, 13 Apr 2007 01:57:07 -0400 (EDT)
  • References: <evkroh$o0k$1@smc.vnet.net>

It depends.
Symbolically or numerically?

Here I cover both approaches.

First you do a plot of your function in order to get an idea of it.

In[46]:=
f[x_] := 6*Cos[x] - 5*Cos[x]

In[51]:=
Plot[f[x], {x, -2*Pi, 2*Pi}, Frame -> {True, True, False, False}, Axes
-> {True, False},
  FrameTicks -> {Range[-2*Pi, 2*Pi, Pi/2], Range[-1, 1, 0.5]}]


Numerically:

In[55]:=
<< "NumericalMath`IntervalRoots`" (*load a relevant package*)

In[57]:=
IntervalBisection[f[x], x, Interval[{-2*Pi, 2*Pi}], 0.05, MaxRecursion
-> 10]
List @@ %
(FindRoot[f[x], {x, #1[[1]], #1[[2]]}, WorkingPrecision -> 40] & ) /@
%

Out[57]=
Interval[{-4.761476365597028, -4.663301595172351},
{-1.619883712007237, -1.5217089415825569},
  {1.5217089415825569, 1.619883712007237}, {4.663301595172351,
4=2E761476365597028}]

Out[58]=
{{-4.761476365597028, -4.663301595172351}, {-1.619883712007237,
-1.5217089415825569}, {1.5217089415825569, 1.619883712007237},
  {4.663301595172351, 4.761476365597028}}

Out[59]=
{{x ->
-4.71238898038468985769396507491925432629575409906265835072`40.},
  {x ->
-1.570796326794896619231321691639751442098584699687552896386`40.},
  {x ->
1=2E570796326794896619231321691639751442098584699687552896386`40.},
  {x ->
4=2E71238898038468985769396507491925432629575409906265835072`40.}}


In[60]:=
Information["IntervalBisection", LongForm -> False]

IntervalBisection[f, x, int, eps] uses the interval bisection method
to find \
subintervals of the given interval int of length less than eps
(possibly) \
containing roots of the expression f.


Symbolically:

In[72]:=
Reduce[f[x] == 0 && -2*Pi <= x <= 2*Pi, x, Reals]
N[%, 40]

Out[72]=
x == -((3*Pi)/2) || x == -(Pi/2) || x == Pi/2 || x == (3*Pi=
)/2

Out[73]=
x == -4.712388980384689857693965074919254326295754099062658731462`40.
||
  x ==
-1.570796326794896619231321691639751442098584699687552910487`40. ||
  x == 1.570796326794896619231321691639751442098584699687552910487`40.
||
  x == 4.712388980384689857693965074919254326295754099062658731462`40.


Regards
Dimitris






=CF/=C7 David Rees =DD=E3=F1=E1=F8=E5:
> This is probably totally elementary, but I'm stumped nonetheless.
>
> Anyway, in Mathematica, how do I solve an equation with multiple periodic
> functions within a given function domain bound?
>
> i.e. How would I find all values of x given 6Cos[x]-5Cos[x] = 0 where
> 0<x<=2Pi ?
>
> thanks



  • Prev by Date: Re: Re: Simplification with Integers assumption
  • Next by Date: Re: Variable containing code
  • Previous by thread: Re: Solving periodic functions
  • Next by thread: Re: Solving periodic functions