MathGroup Archive 2006

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

Search the Archive

Subscripted variables and function definitions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65192] Subscripted variables and function definitions
  • From: Geico Caveman <spam at spam.invalid>
  • Date: Fri, 17 Mar 2006 00:13:34 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi

I am trying to define a function (using the front end - I will be using
latex syntax in this post to make clear what I am doing) :

A[k_s_,r_t_,r_k_]:=...

Now after this, if I try to output A[1,1,1], it just throws A[1,1,1] back.
However, if I define :

A[ks_,rt_,rk_]:=...

it gives the right answer. Two questions :

1. Why aren't subscripted variable names treated the same as other variable
names in this context ?

2. Is there a way to coax Mathematica into doing what I am trying to do
above ?

Mathematica is a nice system, but it has these highly irritating quirks.


Another (unrelated) question :

I have a 4x4 matrix which is a function of some variables :

A:=... (function of r1,r2,r3, ...)

f:=... (function of the same variables)

X:=Inverse[A] . f

Now, I want to extract a ratio :

X[1]/(X[3]+X[4]) and assign it to a function :

g[r1_,r2_,r3_]:=X[1]/(X[3]+X[4])

A test evaluation of g[1,1,1] throws g[1,1,1] back. Makes no sense at all to
me. What am I missing, and why is Mathematica so unintuitive here ?


  • Prev by Date: Re: getting one random number
  • Next by Date: Re: Different font behavior between kernel and front-end
  • Previous by thread: Re: A Reap Sow question
  • Next by thread: Re: Subscripted variables and function definitions