From: Andrzej Kozlowski on
I am somewhat puzzled by the following behaviour of DiscretePlot

fff = Compile[{x}, x^2];

This works fine:

DiscretePlot[fff[x], {x, 1, 10, 0.1}, Joined -> True]

This also works, but produces an error message:

DiscretePlot[{fff[x]},{x,1,10,0.1},Joined->True]
CompiledFunction::cfsa: Argument x at position 1 should be a machine-size real number. >>

This becomes a (slight) problem when plotting several functions. Using ListLinePlot avoids it:

ListLinePlot[{Table[fff[x], {x, 1, 10, 0.1}]}, Joined -> True,
Filling -> Bottom]

Andrzej Kozlowski=

From: Ingolf Dahl on
I was about to answer in the following way, as I have done before:

"Is there any serious Mathematica user in this forum, which has not stumbled
on this problem one or several times, when DiscretePlot, or some other
function, tries to evaluate a numeric function symbolically first, before
inserting the numbers? Sometimes it would be nice to have an option,
SymbolicEvaluation->False, which could be set for DiscretePlot in these
cases.
It is not always so convenient to have to define an extra function just to
take care of this. I think there is a whole group of commands acting
similarly to DiscretePlot."

But then I tested with all the suggested commands in Mathematica 7.0.1.0
(Windows 7, 64 bit), and I did not obtain any error messages at all.

Ingolf Dahl
Sweden


> -----Original Message-----
> From: Andrzej Kozlowski [mailto:akoz(a)mimuw.edu.pl]
> Sent: den 15 juni 2010 08:27
> To: mathgroup(a)smc.vnet.net
> Subject: DiscretePlot
>
> I am somewhat puzzled by the following behaviour of DiscretePlot
>
> fff = Compile[{x}, x^2];
>
> This works fine:
>
> DiscretePlot[fff[x], {x, 1, 10, 0.1}, Joined -> True]
>
> This also works, but produces an error message:
>
> DiscretePlot[{fff[x]},{x,1,10,0.1},Joined->True]
> CompiledFunction::cfsa: Argument x at position 1 should be a machine-
> size real number. >>
>
> This becomes a (slight) problem when plotting several functions. Using
> ListLinePlot avoids it:
>
> ListLinePlot[{Table[fff[x], {x, 1, 10, 0.1}]}, Joined -> True,
> Filling -> Bottom]
>
> Andrzej Kozlowski=


From: Bill Rowe on
On 6/15/10 at 2:27 AM, akoz(a)mimuw.edu.pl (Andrzej Kozlowski) wrote:

>I am somewhat puzzled by the following behaviour of DiscretePlot

>fff = Compile[{x}, x^2];

>This works fine:

>DiscretePlot[fff[x], {x, 1, 10, 0.1}, Joined -> True]

>This also works, but produces an error message:

I get no error message when pasting the above into a fresh
session using

In[3]:= $Version

Out[3]= 7.0 for Mac OS X x86 (64-bit) (February 19, 2009)


From: Patrick Scheibe on
Hi Andrzej,

sorry, no such behavoir here. Works fine without any message.

7.0 for Linux x86 (64-bit) (February 18, 2009)

Cheers
Patrick


On Tue, 2010-06-15 at 02:27 -0400, Andrzej Kozlowski wrote:
> I am somewhat puzzled by the following behaviour of DiscretePlot
>
> fff = Compile[{x}, x^2];
>
> This works fine:
>
> DiscretePlot[fff[x], {x, 1, 10, 0.1}, Joined -> True]
>
> This also works, but produces an error message:
>
> DiscretePlot[{fff[x]},{x,1,10,0.1},Joined->True]
> CompiledFunction::cfsa: Argument x at position 1 should be a machine-size real number. >>
>
> This becomes a (slight) problem when plotting several functions. Using ListLinePlot avoids it:
>
> ListLinePlot[{Table[fff[x], {x, 1, 10, 0.1}]}, Joined -> True,
> Filling -> Bottom]
>
> Andrzej Kozlowski=
>


From: Andrzej Kozlowski on
On 15 Jun 2010, at 16:52, Ingolf Dahl wrote:

> But then I tested with all the suggested commands in Mathematica 7.0.1.0
> (Windows 7, 64 bit), and I did not obtain any error messages at all.

Thanks. In fact I was using the development version (and forgot about it) and can now report this as a bug.

Andrzej