Being a Mathematica beginner I struggle to find a solution to a fairly
simple problem. I have a function (superposition of several weighted
sinc functions) which in principle has infinitely many roots.
However I am interested only in lets say roots that are to be found
within the limited interval between 0 and 5.
I tried to define a system of inequalities of the type
Solve[f[t] && t>0 && t<5, t] but no success.
I played around with the function Reduce but did not have any success
and I am also not sure if this is the right way forward.
So the question: Is it possible to define an interval in Mathematica
in which I am looking for the roots?
Thank you for your time.
Regards,
Viktor
--------^^^
This doesn't make sense unless f[t] is a logical statement. && means
"and", so this is like saying "4 and 3 < 5". Perhaps you meant
Reduce[f[t] == 0 && t > 0 && t < 5, t, Reals]
? If this doesn't work, then most probably Mathematica cannot solve the
equation symbolically, and you need to resort to numerical methods.
FindRoot[f[t] == 0, {t, 1, 0, 5}]
will give you a single solution between 0 and 5. Tweak the starting
value 1 to get different solutions.
> I played around with the function Reduce but did not have any success
> and I am also not sure if this is the right way forward.
Yes, Reduce is the command for solving inequalities or equations with
conditions, but next time please show the exact command you used,
otherwise it is impossible to guess what went wrong.
Andrzej Kozlowski
On 19 Mar 2008, at 11:28, viktor...@gmail.com wrote:
> Dear all,
>
> Being a Mathematica beginner I struggle to find a solution to a fairly
> simple problem. I have a function (superposition of several weighted
> sinc functions) which in principle has infinitely many roots.
>
> However I am interested only in lets say roots that are to be found
> within the limited interval between 0 and 5.
>
> I tried to define a system of inequalities of the type
>
> Solve[f[t] && t>0 && t<5, t] but no success.
> I played around with the function Reduce but did not have any success
> and I am also not sure if this is the right way forward.
>
post-process the results of Solve[]
??
and select the ones you like ???
Regards
Jens
Hi Victor,
Solve does not take inequalities, but Reduce does. E.g.:
Reduce[Sin[x]/x==0&&0<x<10,x]
hope this helps, Daniel
Ted Ersek has a very nice package called RootSearch that you can obtain from
MathSource.
http://library.wolfram.com/infocenter/MathSource/4482/
Although the Mathematica FindRoot function is more general, RootSearch is by
far better and more convenient for cases of searching for a root of a single
real function within an interval. These are probably 95% of root finding
cases and why WRI doesn't make this a standard part of Mathematica is beyond
me. Here is an example. All you have to do is give the equation and the
interval in which you want the roots and Ted's routine will find all the
roots in the interval in order.
Needs["Ersek`RootSearch`"]
f[x_] := 1/2 Sinc[x] - 2 Sinc[3 x]
xroots = x /. RootSearch[f[x] == 0, {x, 0, 5}]
{0.848062,2.29353,3.14159,3.98965}
Using the Presentations package, the following plots the function, the roots
as small filled circles and marks the root values along the x-axis along
with faint vertical grid lines marking the root locations. In Presentations,
one can make believe one is plotting in the complex plane and give point
locations as simple complex numbers.
Needs["Presentations`Master`"]
With[
{xticks = CustomTicks[Identity, databased[xroots]]},
Draw2D[
{Draw[f[x], {x, 0, 5}],
{Gray, ComplexLine[{0, 5}]},
ComplexCirclePoint[#, 3, Black, White] & /@ xroots},
Frame -> True,
FrameTicks -> {xticks, Automatic, xticks // NoTickLabels,
Automatic},
GridLines -> {CustomGridLines[Identity,
databased@xroots, {LightGray}], None},
PlotLabel -> Row[{"Roots of ", f[x]}],
BaseStyle -> {FontSize -> 12},
ImageSize -> 400]
]
--
David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/
<viktor...@gmail.com> wrote in message news:frqpvr$5be$1...@smc.vnet.net...