On Fri, 09 May 2008 at 11:25AM -0700, Marshall Hampton wrote:
> Somewhat relevant to this are the (IMHO) very nice substitutions,
> rules, and patterns in mathematica (although the syntax is pretty
> odd). As a very simple example, the command:
>
> In: {x, x*y} /. {{x -> 1, y -> 2}, {x -> 2, y ->
Marshall Hampton wrote:
> It occurred to me that maybe I should supply a more non-trivial
> example of rules/patterns/subs in mathematica. Here is just one: we
> replace exponents of polynomials with the famous 3x+1 sequence
> (Collatz, whatever) until they stabilize:
>
> In: {x^2, x^3 + x^200,
It occurred to me that maybe I should supply a more non-trivial
example of rules/patterns/subs in mathematica. Here is just one: we
replace exponents of polynomials with the famous 3x+1 sequence
(Collatz, whatever) until they stabilize:
In: {x^2, x^3 + x^200, x^4 + z^909} //. {y_^n_ /; Mod[n, 2
Well, the design is somewhat different to start with: in Sage, you
have to declare variables explicitly (i.e. with var('x,y') or
whatever), but then symbolic variables can automatically act like
functions (as in the usage/bug above). In mathematica, anything
undefined is _assumed_ to be a new sym
On Fri, May 9, 2008 at 10:03 AM, Marshall Hampton <[EMAIL PROTECTED]> wrote:
>
> Ah, ok. I am probably not the right person to weigh in on what
> symbolics should do. I'll be happy if I can do most of what I could
> do in mathematica - since I used it for 16 years, it defines what I
> expect, bu
Ah, ok. I am probably not the right person to weigh in on what
symbolics should do. I'll be happy if I can do most of what I could
do in mathematica - since I used it for 16 years, it defines what I
expect, but of course it won't always be the right design to follow
for Sage.
-M. Hampton
On Ma
On Fri, May 9, 2008 at 9:28 AM, Marshall Hampton <[EMAIL PROTECTED]> wrote:
>
> I'm not sure I agree that this is a bug. After using the name "var"
> in the loop, the value of var is y. y is a symbolic variable, and
> when evaluated at the string "x,y" it returns "x,y"; this seems like
> desirab
I'm not sure I agree that this is a bug. After using the name "var"
in the loop, the value of var is y. y is a symbolic variable, and
when evaluated at the string "x,y" it returns "x,y"; this seems like
desirable behavior (to have string-valued functions seems OK to me).
Or another way to put i