MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Problem with HoldForm & Unevaluated

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94495] RE: [mg94468] Problem with HoldForm & Unevaluated
  • From: "David Park" <djmpark at comcast.net>
  • Date: Mon, 15 Dec 2008 07:42:30 -0500 (EST)
  • References: <29509549.1229261132483.JavaMail.root@m02>

Syd,

You could give an Attribute to printf.

ClearAll[printf];
Attributes[printf] = HoldFirst;
printf[fn_] := Print[HoldForm[fn], " = ", fn]

printf[Rationalize /@ {-1.7, 1.39646, -0.37188}]
SequenceForm[
HoldForm[
Map[Rationalize, {-1.7, 1.39646, -0.37188}]], " = ", {
Rational[-17, 10], 
Rational[69823, 50000], 
Rational[-9297, 25000]}]

Or, since you have Presentations, you could use:

Needs["Presentations`Master`"]

command[Rationalize /@ {-1.7, 1.39646, -0.37188}]

and the result appears with a tooltip that displays the input statement.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  





From: Syd Geraghty [mailto:sydgeraghty at me.com] 

Hi all,

A seemingly simple function has me baffled and I would appreciate a  
solution.

I am trying to define a personal print function that prints  
"Unevaluated function string" = Evaluated function!

I have tried many examples in guide/EvaluationControl documentation  
without getting what I want.

A simple example;

printf[fn_] := Print[HoldForm[fn], " = ", fn];

printf[Rationalize /@ {-1.7, 1.39646, -0.37188}]

Print[HoldForm[Rationalize /@ {-1.7, 1.39646, -0.37188}], " = ",
  Rationalize /@ {-1.7, 1.39646, -0.37188}]

gives the LHS evaluated:

{-(17/10),69823/50000,-(9297/25000)} = {-(17/10),69823/50000,- 
(9297/25000)}

Instead of the hoped for output:

Rationalize/@{-1.7,1.39646,-0.37188} = {-(17/10),69823/50000,- 
(9297/25000)}

Using Unevaluated seemed to me should fix it but does not.

Thanks in advance for your help.

Cheers ... Syd

PS I've tried Mathematica 5.2 as well as 7.0



Syd Geraghty B.Sc, M.Sc.

sydgeraghty at mac.com

Mathematica 7.0.0 for Mac OS X x86 (64 - bit) (21st November, 2008)
MacOS X V 10.5.4
MacBook Pro 2.33 Ghz Intel Core 2 Duo  2GB RAM













  • Prev by Date: Re: Re: Optimized structure of an equation
  • Next by Date: Re: Small question about Filling between two functions in a
  • Previous by thread: Re: Problem with HoldForm & Unevaluated
  • Next by thread: Re: Problem with HoldForm & Unevaluated