Re: One thing in two ways, with different result.
- To: mathgroup at smc.vnet.net
- Subject: [mg90110] Re: [mg90099] One thing in two ways, with different result.
- From: DrMajorBob <drmajorbob at att.net>
- Date: Sun, 29 Jun 2008 05:35:49 -0400 (EDT)
- References: <27378735.1214649276216.JavaMail.root@m08>
- Reply-to: drmajorbob at longhorns.com
Compare with Plot[f[x], {x, -2, 3}, Exclusions -> None] and I think you'll see what's happening. Plot can "see" the discontinuity in Piecewise, but not in the other function. Bobby On Sat, 28 Jun 2008 04:55:50 -0500, damayi <damayi at gmail.com> wrote: > Dear all, > Today I encountered a confused question, and I hope you can help me. > I defined a function g[x] in the following and Plot it. > g[x_] := x^3 /; x <= 0 > g[x_] := x /; 0 < x <= 1 > g[x_] := Sin[x] /; x > 1 > > Then I defined another function f[x] that is the same as g[x] in my > opinion, and Plot it. > f[x_] := Piecewise[{{x^3, x <= 0}, {x, 0 < x <= 1}, {Sin[x], x > 1}}] > > You will find that Plot[g[x],{x,-2,3}] is different with Plot[f[x], > {x,-2,3] when x is 1.0 > > Since g[x] and f[x] are identify, why are these plot different ? > By the way, my Mathematica is 6.0.2. > > Best Regards > mayi > 2008-6-27 > > -- DrMajorBob at longhorns.com