Re: functions
- To: mathgroup at smc.vnet.net
- Subject: [mg45525] Re: [mg45481] functions
- From: Selwyn Hollis <sh2.7183 at misspelled.erthlink.net>
- Date: Mon, 12 Jan 2004 02:15:35 -0500 (EST)
- References: <200401100500.AAA02409@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
This is a pretty wild idea, but how about the following as a criterion for deeming a single-precision floating-point number between 0 and 1 to be "irrational": It's irrational if its base-10 form contains all 10 digits, more precisely, if IrrationalQ[x_] := Length[Union[IntegerDigits[Round[10^16*x]]]] == 10 returns True. Then grph = Plot[If[IrrationalQ[x], x, 0], {x, 0, 1}, PlotPoints -> 100] draws a graph that, with a little imagination, suggests what the graph of If[x is irrational, x, 0] could look like. Still better is Show[Graphics[{AbsolutePointSize[1.5], Point[#]} & /@ (grph/.Graphics[{{Line[z_]}}, ___] -> z)]] This is all nonsense, of course, but fun nonetheless. Experiments show that IrrationalQ[Random[]] returns True with probability roughly 0.07. (Anybody have a clue why?) ----- Selwyn Hollis http://www.math.armstrong.edu/faculty/hollis (edit reply-to to reply) On Jan 10, 2004, at 12:00 AM, lorenzo.keegan at handbag.com wrote: > Hello, > > Can you help me? > > How do write expressions in Mathematica for functions and sequences > such as the following: > > f(x) = {1/x, x is irrational > {x^2, x rational > and > > f(n) = 1/n, n odd > n^2, n even > > I am a new user and find the manual rather daunting. > > Best wishes > Laurence Keegan > > > > >
- Follow-Ups:
- Re: Re: functions
- From: Daniel Lichtblau <danl@wolfram.com>
- Re: Re: functions
- References:
- functions
- From: lorenzo.keegan@handbag.com
- functions