Re: defining functions with the values of variables (not the


[Prev][Next][Index][Thread]

Re: defining functions with the values of variables (not the actualvariables)



Instead of entering the command   Define xt3(t)=hh+rad*cos(t)
directly into your program, try entering
expr("Define xt3(t)="&string(hh)&"+"&string(rad)&"*cos(t)")
This should give you what you want.

Hope this is not what you refer to as an "ugly kludge" -- I think using
the expr() command is a much-overlooked capability of the TI-89/92.
You could, of course, make this more visually appealing by creating
hh and rad as string variables in the first place.

RWW Taylor
National Technical Institute for the Deaf
Rochester Institute of Technology
Rochester NY 14623

>>>>  Always remember that you are unique,  <<<<
>>>>     just like everyone else.           <<<<

"the $al-Man" wrote:

  hi all.
  i'm writing a program for my ti89 that takes an expression, tries to find out
if
  it's an equation in x and y for a conic section. If so, it identifies it,
  calculates and displays various parameters (eccentricity, foci, etc.),
displays
  equations in cartesian and parametric form, and stores parametric equations
in
  xt3(t) and yt3(t), so that after the program exits, i can just press
[diamond] +
  F3 to see the conic plotted (much neater than trying to get an implicit
plot).

  now, the problem is this:
  suppose that i've been given the equation for a circle, and i determine that
the
  circle's center is at (1,1), and that its radius is 4.
  While calculating this, i store the radius in a variable called rad, and the
  center coordinates in the variables hh and kk.

  The parametric equations should be:
  xt3(t)=1+4*cos(t)
  and
  yt3(t)=1+4*sin(t)

  However, when i store the equations using
  Define xt3(t)=hh+rad*cos(t)
   and
  Define yt3(t)=kk+rad*sin(t)

  The equations in the Y= editor are stored as exactly that (i.e. hh+rad*cos(t))
  instead of the equations with the actual values of hh, kk, and rad (which
would
  make the equation x expression 1+4*cos(t)).

  This is ok, so long as  the variables are not local. But it makes it harder
to
  follow the equations, and it leads to a lot of silly little variables
littering
  up the ti (since i can't make them local).

  Is there any way to define these parametric functions such that they contain
the
  _values_ stored in hh, kk, and rad? I guess i could whip up some ugly string
  conversion-concatenation-conversion kludge, but i'm hoping there's some
easier
  way...

  thanks...:)

  ===== ===  ==   =    = ====  = = = == = = =  = = ==   = = =

******************************************************************
* To UNSUBSCRIBE, send an email TO: listserv@lists.ppp.ti.com
* with a message (not the subject) that reads SIGNOFF CALC-TI
*
* Archives at http://peach.ease.lsoft.com/archives/calc-ti.html
******************************************************************