Re: Plotting a function -

*To*: mathgroup at smc.vnet.net*Subject*: [mg71654] Re: Plotting a function -*From*: "mumat" <csarami at gmail.com>*Date*: Sun, 26 Nov 2006 03:48:35 -0500 (EST)*References*: <ek990u$k88$1@smc.vnet.net>

what do you mean by having a "3" in them? Do you mean 3 be a digit in the decimal representation of x? Maybe this one work!! f[x_] := Boole[MemberQ[IntegerDigits[x, 10], 3]]; g[x_] := Sum[f[i], {i, 1, x}]/x; Plot[ g[x] , {x, 1, 100}] The graph looks like a graph of a piece-wise defined function. chekad On Nov 25, 6:22 am, Craig Reed <tharkun... at publicspam.com> wrote: > Hi - > > I'm trying to get Mathematica 5.2 to graph a function which is the ratio of > integers which have a '3' in them. Done in Exce3l, the graph of the first > 32,000 data points has a fractal look to it, especially when done with a > log scale. > > What I've tried is the following > > f[x_] := Boole[DigitCount[x, 10, 3]] > g[x_] := Sum[f, {i, x}]/x > Plot[g, {x, 1, 100}] > > I get 3 errors of "g is not a michine-size real number at" followed by 3 > real numbers: > 1.000004125 > 5.016125..... > 9.39607..... > > What am I doing wrong? or perhaps what I should ask is, "Is there a better > way?"