One thing in two ways, with different result.
- To: mathgroup at smc.vnet.net
- Subject: [mg90099] One thing in two ways, with different result.
- From: damayi <damayi at gmail.com>
- Date: Sat, 28 Jun 2008 05:55:50 -0400 (EDT)
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