MathGroup Archive 2000

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

Search the Archive

Re: With[{software=Mathematica}, Frustration]

  • To: mathgroup at
  • Subject: [mg24385] Re: [mg24308] With[{software=Mathematica}, Frustration]
  • From: AES <siegman at>
  • Date: Wed, 12 Jul 2000 23:13:25 -0400 (EDT)
  • Organization: Stanford University
  • References: <vfca5.325$>
  • Sender: owner-wri-mathgroup at

In article <vfca5.325$f6.112205 at>, Wolf Hartmut 
<hwolf at> wrote:

> In[2]:= With[{a = 2, b = 3}, Evaluate[c]]
> Out[2]= 6
> will do what you want! Why? What was meant saying by the quotations 
> is that With gives a *textual* substitution for the given variables 
> occuring in the *unevaluated* body.

Thanks for this reply, and others.  But, there is still frustration.

What I really want is as follows.  I'm entering a bunch of functional 
relations like c = a b, using direct assignments (=, not :=) and being 
careful not to give values to the independent variables like a and b as 
I go along

At various points I'd like to print out numerical test values or  check 
values of these functions, like for example

   With[ {a=2, b=3}, 
           Print["a = ",a,",  b = ",",  c =",c,",  Sin[c] = ",Sin[c] ] ]

just to check what some typical values might be, or to check that the 
results are reasonable.


1) Try wrapping the "Print" statement, or the "c" value, or the 
"Sin[c]", or various combinations of these, within Evaluate[]'s -- **and 
then try predicting in advance, based on your knowledge of Mathematica, what 
these different combinations will do**.

2)  Find *any* combination of With, Print and Evaluate that will 
accomplish the elementary "print a trial result" task that's wanted 
above.  (I haven't found one yet.).

3)  Finally, reconsider your explanation of *textual* substitution.  
With[ ] will "textually substitute" within the Evaluated form of c -- 
but not in the "a =" strings -- which are expressions -- and hence 
should be "variables" in a sense..  Try, for example

   With[{a=2}, Evaluate[{"a = ",a}]

What gets "textually substituted"? -- what's Mathematica "code"? (see 
the Book) -- in this case, and what isn't?

  • Prev by Date: Re: How to use BestFitParameters?
  • Next by Date: Modifying illumination shades
  • Previous by thread: Re: With[{software=Mathematica}, Frustration]
  • Next by thread: Re: With[{software=Mathematica}, Frustration]