Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Division by zero, despite strong hint

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96576] Re: [mg96542] Division by zero, despite strong hint
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Mon, 16 Feb 2009 16:38:58 -0500 (EST)
  • Reply-to: hanlonr at cox.net

You left a comma out

g3[x_] := Piecewise[{{Sin[1/x], x != 0}, {0, x == 0}}]

Plot[g3[x], {x, 0, 1}, PlotStyle -> Red]

However, the second condition is unnecessary since the default is zero

g3[x_] := Piecewise[{{Sin[1/x], x != 0}}]

Plot[g3[x], {x, 0, 1}, PlotStyle -> Red]


Bob Hanlon

---- dch888 <dch888 at googlemail.com> wrote: 

=============
Hi,

I'm trying to plot the Sin[1/x] curve with the curve being defined as
0 at 0 like this:

g3[x_] := Piecewise[{{Sin[1/x], x != 0} {0, x == 0}}]

Invoking Plot produced a flat graph; puzzled I asked for g3[0] and
got:

Power::infy Infinite expression 1/0 encountered >>

{
 {Indeterminate, False True},
 {0, \!\(\*
    TagBox["True",
     "PiecewiseDefault",
     AutoDelete->False,
     DeletionWarning->True]\)}
}

Hmmm...  what's the trick here to stop Mathematica evaluating all the branches
of the piecewise fn? There's nothing in the documentation that I can
see to stop this in Piecewise... perhaps I need to use a different Mathematica 
function?

Thanks,
David.



  • Prev by Date: Re: Division by zero, despite strong hint
  • Next by Date: Re: Re: Log[]//TraditionalForm
  • Previous by thread: Re: Division by zero, despite strong hint
  • Next by thread: Re: Division by zero, despite strong hint