RE: A92: quirks


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

RE: A92: quirks



You said there is no problem if you Define f(x)=x^2, and then type f(x). It 
does return x^2, but try typing f(x+2). It then gives a circular definition 
error, where f(y+2) returns the correct answer, (y+2)^2. This is the reason it 
is recommended to use uncommon names for arguments when defining a function.
________________

Jeff Tyrrill
http://tyrrill-ticalc.home.ml.org/
http://ti-files.home.ml.org/


-----Original Message-----
From:	owner-assembly-92@lists.ticalc.org  On Behalf Of Andrew Sieber
Sent:	Saturday, July 26, 1997 9:50 PM
To:	assembly-92@lists.ticalc.org
Subject:	Re: A92: quirks

A few hours ago, I wrote:
> (2i)^2 yields "-4", as expected.  However, solve(x^2=-4,x) yields
> "false", whereas the correct result (I think) is "2i or -2i".
> Similarly, solve(x=sqrt(-4),x) yields "false", whereas I believe it
> should be "2i".  Why?
Now that I've read some more of the manual (like I should have done to
begin with), I realize that csolve() will find the complex roots I'm
looking for.  Now I've got another question:  what's the point of having
a separate function for complex roots?  Why not have solve() also find
complex roots (depending on the complex mode setting of the calculator),
and thus eliminate the need for csolve()?

Jeff Tyrrill wrote:
> The answer to your question about calling functions and argument names:
> The manual (or for some users, an addendum to the manual that came in the
> package; apparently even TI made the mistake when writing the manual) says
> that you can't use as an argument the same variable that contains the 
argument
> in the function. So if you wrote a function, and in the program editor, it
> looks like "testfunc(x,y,z)", you could execute it with arguments like
> testfunc(1,2,a) but not testfunc(x,y,z). I think the reason is because the
> variables have the same name, so they conflict. The TI-92, internally, tries
> to store x to the variable x so it can evaluate the function, but that 
causes
> a circular definition error.
If I define f(x)=x^2 then f(5) yields "25" and f(x) yields "x^2", as
expected.  If I then define x=12 then f(5) still yields "25" and f(x)
yields "144", as expected.  There doesn't seem to be any problem.  Why
then does the manual warn against doing this?

My other questions from my previous posting still stand.

--Andrew
asieber@usa.net


Follow-Ups: