This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
Fr0sty


Member


Joined: 27 Nov 2003
Posts: 202

Posted: 16 Apr 2004 08:11:40 pm    Post subject:

What's going on here?
I have a quadratic program that I had to add a subroutine into and now it's messing up my main program.
I had too many variables in use so before I put in my subroutine I put A->L1(1) B->L1(2) etc.
But after the subroutine is completed and it goes L1(1)->A L1(2)->B etc., it makes the variables A and B complex variables.
I look at the variables and their value seems to be whatever they were originally, but their status is "Complex" and not "Real". They're not like "3i" or "4+2i", they're like "3" and "-4". Why are they now complex and how can I fix this?
I can't work with them now that they're complex; I wanted to do a Text( command and it wouldn't work; I can't even do a D>0 command! Any way to fix this?
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 16 Apr 2004 09:42:13 pm    Post subject:

hmm, well, make sure your calc is in "Real" mode, it will give an error when it first starts parsing complex numbers, i think

also, im not sure if you are trying to use i as a var, bucause that would be your problem right there. post some code and maybe we can help.
Back to top
Fr0sty


Member


Joined: 27 Nov 2003
Posts: 202

Posted: 16 Apr 2004 09:53:25 pm    Post subject:

I set it to complex mode because it's a quadratic program. I suppose I can set it to real mode during that one specific routine, but I don't know if it'll help. Also, I'm not trying to set i as a varaible, I'm saying that i is NOT in the variable yet it still lists the variable as complex. I'll post the code later if I can't figure out what's wrong.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 17 Apr 2004 10:14:25 am    Post subject:

Insert the following in your code:

Code:
If not(imag(var
real(var -> var
where var is what's causing the problem.
Back to top
Fr0sty


Member


Joined: 27 Nov 2003
Posts: 202

Posted: 17 Apr 2004 01:59:46 pm    Post subject:

Is Imag( and Real( in the catalog?
Back to top
Brazucs
I have no idea what my avatar is.


Super Elite (Last Title)


Joined: 31 Mar 2004
Posts: 3349

Posted: 17 Apr 2004 02:47:20 pm    Post subject:

Fr0sty wrote:
Is Imag( and Real( in the catalog?

Yip
Back to top
sgm


Calc Guru


Joined: 04 Sep 2003
Posts: 1265

Posted: 17 Apr 2004 03:31:22 pm    Post subject:

They're also in the MATH / CPLX menu.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 17 Apr 2004 03:53:46 pm    Post subject:

Note there is no way to optimise that since 0+0i is not the same as 0.
Back to top
Fr0sty


Member


Joined: 27 Nov 2003
Posts: 202

Posted: 18 Apr 2004 11:44:48 am    Post subject:

I got it to work just doing it like: real(L1(1->A
Hopefully it works like it should, but at least there's no more errors Laughing
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 18 Apr 2004 11:52:09 am    Post subject:

But if the variable is supposed to be complex, like 1+i, that will change it to 1.
Back to top
Fr0sty


Member


Joined: 27 Nov 2003
Posts: 202

Posted: 19 Apr 2004 09:53:58 am    Post subject:

It never was supposed to be complex, it somehow changed it to complex when it went through the subroutine. It said A=-4 was a complex number. Because when I went through my memory looking at my variables A wasn't under real but complex but when I checked the value of it, it just said -4.
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement