Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7217

Variables within With statement

From "Harvey P. Dale" <hpd1@nyu.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Variables within With statement
Date 2011-12-15 09:53 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jccg39$mb4$1@smc.vnet.net> (permalink)

Show all headers | View raw


	Is there any easy way to have one variable within a With
statement take its value from a prior variable in the same With
statement?  For example, if I evaluate With[{a = 5, b = 10 a}, a + b], I
get 5 + 10a, and what I want is 55.  I can get there like this: With[{a
= 5}, With[{b = 10 a}, a + b]] -- which does produce 55 -- but it would
be nicer if I could use a single With statement and get b, within it, to
take its value from a.

	Thanks.

	Harvey

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Variables within With statement "Harvey P. Dale" <hpd1@nyu.edu> - 2011-12-15 09:53 +0000
  Re: Variables within With statement Simon <simonjtyler@gmail.com> - 2011-12-16 11:07 +0000
  Re: Variables within With statement markholtuk <markholtuk@googlemail.com> - 2011-12-17 07:39 +0000
    Re: Variables within With statement Szabolcs <szhorvat@gmail.com> - 2011-12-20 08:09 +0000
      Re: Variables within With statement markholtuk <markholtuk@googlemail.com> - 2011-12-22 09:26 +0000
  Re: Variables within With statement "Alexander Elkins" <alexander_elkins@hotmail.com> - 2011-12-17 07:49 +0000

csiph-web