MathGroup Archive 2005

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

Search the Archive

Re: Sundry Questions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61162] Re: Sundry Questions
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Tue, 11 Oct 2005 06:19:10 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <diabu7$ikb$1@smc.vnet.net><did2le$qco$1@smc.vnet.net> <difrbj$fes$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

snip-snapp
| Your response (a):  I was amazed at first that 
this worked, but after
|  I assume that if
| ParametricPlot had the 'HoldFirst' attribute, 
then I would have used
| the Evaluate method as well, and in fact, any 
function that has the
| 'HoldAll' or 'HoldFirst' attribute set, I should 
use Evaluate if I am
| passing in something created by Table or Map?
|

a) you should use evaluate when the function has 
the
   HoldFirst/HoldAll attribute and the function 
act different
   on a _List than on an other expression

| As regards your response (b), I guess I wasn't 
clear.  I know that I
| can set attributes for a pure function when I 
use the Function[] syntax
| explicitly, but what if I wanted to set 
attributes for a pure function
| such as #^2 & ?

b) #^2 & is the short form, you can't use the 
short form when
   your function has attributes. Mathematica will 
convert #^2 &
   in Function[#^2] anyway the short form is for 
the quick input
   and not designed to fit all cases. That is just 
the same as with
   Map[], the short form /@ does not allow to set 
the level explicit
   as in Map[#^2 &,matrix,{2}]

|
|
| For (f), I apologize for the lack of clarity.

f)
Subscript[x, 1][t] /. severalSols[[1]]

work as expected, x_ in your input is a pattern 
and the the ReplaceAll[] function don't replace 
patterns with patterns.  You have to use Cases[] 
when you need a pattern, i.e.,

Cases[severalSols, Subscript[x, _][_], Infinity] 
/. severalSols[[1]]

| Finally, as regards your answer (g)-2, if Print 
returns 'Null', and I
| successfully evaluated the same code without the 
'False' at the end of
| the sample, I still don't understand what use 
the 'False' at the end
| is?


g) the manual say

   "lhs :> rhs /; test represents a rule which 
applies only if the evaluation   of test yields 
True. lhs := rhs /; test is a definition to be 
used only if test yields True."

   Null is *not* True, the most simple expression 
that is Not[True] ist
   False, and Michael try to present example
   that agree with the manual. It would confuse 
the reader mutch more
   when he had used
rule = part_ :> (Null /; (Print["Trying : 
",InputForm[part]]; Fluffy^3))

  because Fluffy^3 is also not True and the test 
would also fail every time.


Regards

  Jens



  • Prev by Date: Using MathLink to create a GUI
  • Next by Date: Re: Argument checking while allowing specific assignments
  • Previous by thread: Re: Sundry Questions
  • Next by thread: simplifying rational expressions