From: annetts729 on
On Jul 21, 7:10 pm, "Alexey Popkov" <lehi...(a)gmail.com> wrote:
> Hello,
>
> I confirm this behavior on Windows XP SP3 with Mathematica 7.0.1. All the
> red lines get out of the region defined by RegionFunction.
>
> "ADL" <alberto.dilu...(a)tiscali.it> news:i23k1u$eqc$1(a)smc.vnet.net...
>
> > Following what Bob brilliantly suggested, I found a possible bug in
> > Mathematica 7.0.1 for Windows.
> > If you type the following, you will get a couple of red lines getting
> > out of their boundary:
>
> > f[x_] := Sin[x];
>
> > Plot[
> > {Table[(x - k)/3, {k, -3, 3, .10}], f[3x]},
> > {x, 0, 3},
> > PlotRange -> {0, 1},
> > RegionFunction -> Function[{x, y}, 0 < y <= f[3x]],
> > PlotStyle -> {
> > Directive[ AbsoluteThickness[4], Red],
> > Directive[ Thick, Blue]
> > }
> > ]
>
> > Does anybody else confirms this?
>
> > ADL

Yeah -- there are red lines.

But I'd suggest it's an artifact of plotting rather than a bug per se.

Look at

f[x_] := Sin[x];

Plot[{Table[(x - k)/3, {k, -3, 3, .10}], f[3 x]}, {x, 0, 3},
PlotRange -> {0, 1},
RegionFunction -> Function[{x, y}, 0 < y <= f[3 x]],
PlotStyle -> {Directive[AbsoluteThickness[4], Red],
Directive[Thick, Blue]},
PlotPoints -> #, ImageSize -> 500] & /@ {25, 50, 75, 100}

Regards,

Dave.

From: E. Martin-Serrano on
In my XP SP3 it the DPark's solution works perfect.

Beside, I tried several PlotPoints settings and see that below 150 points
the hatching starts to go uneven. With 100 points it becomes pretty
unusable.

And, I have had similar problems with *RegionFunction* when applied to some
rotated and translated functions plots. The corresponding
(rotated/translated) *RegionFunction* specification sometimes works and
sometimes does not when applied to the same (rotated/translated) functions.
I solved the problem by applying the corresponding 'rotation/translation' to
the original 'PlotRangle rectangle' and then plotting by hand only the
points of the shifted functions lying within the rotated/translated
PlotRangle rectangle.

My problem seems to be related with the computation of the intersections
with of the converted functions with the corresponding new *PlotRange*
limits.

The examples I have are too large, and perhaps tricky, to be posted here. I
will try to isolate some simpler example to post it.

E. Martin-Serrano

___________________________________________________


-----Original Message-----
From: Themis Matsoukas [mailto:tmatsoukas(a)me.com]
Sent: Thursday, July 22, 2010 11:43 AM
Subject: Re: Hatched shading?

I get an error. What am I missing?

Get::noopen: Cannot open Presentations`Master`. >>

Needs::nocont: Context Presentations`Master` was not created when Needs was
evaluated. >>

$Failed

Themis


From: Bill Rowe on
On 7/22/10 at 5:43 AM, tmatsoukas(a)me.com (Themis Matsoukas) wrote:

>I get an error. What am I missing?

>Get::noopen: Cannot open Presentations`Master`. >>

>Needs::nocont: Context Presentations`Master` was not created when
>Needs was evaluated. >>

>$Failed

Presentations is a package written by David Park available from
him for a fee. It is not a package distributed with Mathematica.
The message you got above is consistent with not having the
package installed. The other possibility is the package is
installed but installed incorrectly, i.e., not in one of the
directories returned by evaluating $Path


From: Murray Eisenberg on
You need to have David Park's Presentations application:

http://home.comcast.net/~djmpark/DrawGraphicsPage.html

On 7/22/2010 5:43 AM, Themis Matsoukas wrote:
> I get an error. What am I missing?
>
> Get::noopen: Cannot open Presentations`Master`.>>
>
> Needs::nocont: Context Presentations`Master` was not created when Needs was evaluated.>>
>
> $Failed
>
> Themis
>

--
Murray Eisenberg murray(a)math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305

From: David Park on
Here is a better method for hatching. The problem with using RegionFunction
is that Mathematica uses even spacing of points and then determines if they
are in the predicate region. This produces poor results unless we use brute
force with many PlotPoints and do extra trimming on the lines.

An alternative method is to define hatching lines so that the y value is
real within the region and imaginary outside the region. The Mathematica
algorithm then uses recursion near the boundary line to obtain better
defined lines. We no longer have to use brute force or trim the lines.

Needs["Presentations`Master`"]

f[x_] := Sin[x];
hatch[k_][x_] :=
If[0 < x < 3 \[And] 0 <= (x - k)/3 <= f[3 x], (x - k)/3, I];
Draw2D[
{(* Draw hatch lines first *)
Red, AbsoluteThickness[1],
Table[
ParametricDraw[{x, hatch[k][x]}, {x, 0, 3},
PlotPoints -> Automatic,
MaxRecursion -> Automatic],
{k, -3, 3.0, .1}],


(* Draw the curve without a fill *)
Blue, AbsoluteThickness[2],
Draw[f[3 x], {x, 0, 3}, PlotRange -> {0, 1}]
},

AspectRatio -> .6,
PlotRange -> {{0, 3}, {0, 1}},
PlotRangePadding -> {.1, .05},
Axes -> True,
ImageSize -> 400]


David Park
djmpark(a)comcast.net
http://home.comcast.net/~djmpark/



From: David Park [mailto:djmpark(a)comcast.net]

The problem with RegionFunction is how many points does Mathematica use,
especially with a straight line, and how does the algorithm determine where
the boundary should be. Suppose one point is well within the region and the
next point is well without. I'm sure that Mathematica doesn't calculate the
exact intersections with boundaries. So I think the only reliable method is
to use some brute force and trim the lines if they extend outside the
region. Again, here is a Presentations solution where it is convenient to
treat the hatching and the curve separately.

Needs["Presentations`Master`"]

f[x_] := Sin[x];
Draw2D[
{(* Draw hatch lines first *)
Table[
Draw[(x - k)/3, {x, -1.5, 3},
RegionFunction ->
Function[{x, y}, 0 < x < 3 \[And] 0 <= y <= f[3 x]],
PlotRange -> {{1, 3}, {0, 1}},
PlotPoints -> 200,
PlotStyle ->
Directive[AbsoluteThickness[2], Red]] /. {x_?NumberQ,
y_?NumberQ} :>
If[0 < x < 3 \[And] 0 <= y <= f[3 x], {x, y},
Unevaluated[Sequence[]]], {k, -3, 3, .1}],

(* Draw the curve without a fill *)
Blue, AbsoluteThickness[2],
Draw[f[3 x], {x, 0, 3}, PlotRange -> {0, 1}]
},

AspectRatio -> .6,
PlotRange -> {{0, 3}, {0, 1}},
PlotRangePadding -> {.1, .05},
Axes -> True,
ImageSize -> 400]

If you do the same graphic with say 25 points you will see that Mathematica
did not always use points very close to the boundary.


David Park
djmpark(a)comcast.net
http://home.comcast.net/~djmpark/





From: ADL [mailto:alberto.dilullo(a)tiscali.it]

Following what Bob brilliantly suggested, I found a possible bug in
Mathematica 7.0.1 for Windows.
If you type the following, you will get a couple of red lines getting
out of their boundary:

f[x_] := Sin[x];

Plot[
{Table[(x - k)/3, {k, -3, 3, .10}], f[3x]},
{x, 0, 3},
PlotRange -> {0, 1},
RegionFunction -> Function[{x, y}, 0 < y <= f[3x]],
PlotStyle -> {
Directive[ AbsoluteThickness[4], Red],
Directive[ Thick, Blue]
}
]

Does anybody else confirms this?

ADL



On 18 Lug, 07:06, Bob Hanlon <hanl...(a)cox.net> wrote:
> I forget to copy the definition of f[x] that I was using as an example
>
> f[x_] = Exp[-x]
>
> Bob Hanlon





First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4
Prev: MathLink error
Next: Integration by part