Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12308 > unrolled thread

Re: piecewise and if

Started byBob Hanlon <hanlonr357@gmail.com>
First post2012-11-11 06:27 +0000
Last post2012-11-11 06:27 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: piecewise and if Bob Hanlon <hanlonr357@gmail.com> - 2012-11-11 06:27 +0000

#12308 — Re: piecewise and if

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-11-11 06:27 +0000
SubjectRe: piecewise and if
Message-ID<k7nggp$8h1$1@smc.vnet.net>
Or perhaps more straightforwardly, set exclusions to none:

Plot3D[g[x, y], {x, -1, 1}, {y, -1, 1}, Exclusions -> None]


Bob Hanlon


On Sat, Nov 10, 2012 at 11:30 AM, Bob Hanlon <hanlonr357@gmail.com> wrote:
> You can use ExclusionsStyle
>
> f[x_, y_] := Exp[-1/(x^2 + y^2)];
>
> g[x_, y_] := Piecewise[{{0, x == 0 && y == 0}}, f[x, y]];
>
> Plot3D[g[x, y], {x, -1, 1}, {y, -1, 1},
>  ExclusionsStyle -> Lighter[Gray, .5]]
>
>
> Bob Hanlon
>
>
> On Sat, Nov 10, 2012 at 2:08 AM, Jon Joseph <josco.jon@gmail.com> wrote:
>> I think these two functions should be the same but their plots show a clear difference:
>>
>> f[x_, y_] := Exp[-1/(x^2 + y^2)] (* this function undefined at (0,0) *)
>>
>> g[x_, y_] := Piecewise[{{0, x == 0 && y == 0}}, f[x, y]]  (* Redefine so the hole is plugged *)
>>
>> h[x_, y_] := If[x == 0 && y == 0, 0, f[x, y]]  (* Another, I think, equivalent way to redefine f[x, y] *)
>>
>> On my machine,   "8.0 for Mac OS X x86 (64-bit) (October 5, 2011)"
>>
>> when I
>>
>> Plot3D[g[x, y], {x, -1,1}, {y, -1,1}]
>>
>> Plot3D[h[x, y], {x, -1,1}, {y, -1,1}]
>>
>> I see clear gaps along y=0 and x=0 for the g[x, y] plot and h[x, y] works properly.  Am I misusing Piecewise?
>>
>> Thanks, Jon.
>>
>>
>>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web