| Author |
Message |
dreamspy
Joined: 25 Jan 2010 Posts: 5
|
Posted: January 25, 2010 8:46 AM Post subject: Defining a variable as an integer |
|
|
I'm wondering if it's possible to define a variable as an integer? F.x. something similar to:
solve(x^2 = 1,x) | x>1
but it might look more like:
int(x*sin(n*x),x,-pi,pi) | n=integer
or something like that.
Anyone? |
|
| Back to top |
|
 |
BlainUSM
Joined: 24 Oct 2009 Posts: 30 Location: New England
|
Posted: January 26, 2010 8:19 PM Post subject: |
|
|
I'm not sure that I understand your post, so I may very well miss the mark. Are you asking if there is a datatype analogous to "int" in Java/C++ for the TI-89?
If so, here's my response:
Often, datatypes don't need to be declared for variables on the TI-89. In fact, I don't believe datatypes can be explicitly declared for types int, float, and double on the TI-89. However, this difference shouldn't cause problems for most programs.
For example, if you want to store 1 in x, type the following:
1->x
If you'd like to now check if the variable x is an integer, type the following:
iPart(x) = x
Your output should be
true
If the variable x is empty, your output should be
iPart(x) = x
If you enter
DelVar x
the contents of the variable x should be cleared. |
|
| Back to top |
|
 |
dreamspy
Joined: 25 Jan 2010 Posts: 5
|
Posted: January 27, 2010 2:45 AM Post subject: |
|
|
I think your misunderstanding me
Let me try to rephrase the question.
Let's say that I want to find the solution to :
int(sin(2*n*x),x,0,pi)
where n is an integer (n = ...,-1,0,1,...)
I know that if n is an integer then the answer is 0, but if it's not then the answer is somewhat more complicated.
Now I'm only interested in answers where n is an integer, so I'm wondering if it's possible to define n as an integer, so that my Ti-89 will only give me those solutions?
It might look something like:
int(sin(2*n*x),x,0,pi) | n=integer
Are you following me? |
|
| Back to top |
|
 |
BlainUSM
Joined: 24 Oct 2009 Posts: 30 Location: New England
|
Posted: January 28, 2010 8:19 PM Post subject: |
|
|
I think I understand what you were asking: can the TI-89 be used to integrate certain functions that contain a variable restricted to the integers?
Surprisingly, the following input produces the correct answer for the problem you proposed.
int(sin(2*n*x),x,0,pi)|n = @n1
Note:
“int” is the sign for integration (accessed by pushing “2nd” and then “7”)
“@” is the sign for indicating an arbitrary integer (accessed by pushing the green key and then “STO”). |
|
| Back to top |
|
 |
BlainUSM
Joined: 24 Oct 2009 Posts: 30 Location: New England
|
Posted: January 28, 2010 8:23 PM Post subject: |
|
|
The above approach may not always work. In general, there are two cases to consider
Case 1: The integral assumes infinitely many distinct values over the integers.
Case 2: The integral assumes only finitely many distinct values over the integers.
It’s possible to write code for the TI-89 that will help to handle each of the two cases more elegantly. However, I won’t discuss that further, unless you’re interested. For more complex integration problems, I recommend using other integration software. For example, in Mathematica, the following input will produce the desired result:
Integrate[ Sin[2nx], {x,0,π}, Assumptions→{n∈Integers} ] |
|
| Back to top |
|
 |
dreamspy
Joined: 25 Jan 2010 Posts: 5
|
Posted: January 30, 2010 8:20 AM Post subject: |
|
|
I had actually thought of this, but didn't know how to type the @ sign. Thanks
| BlainUSM wrote: | I think I understand what you were asking: can the TI-89 be used to integrate certain functions that contain a variable restricted to the integers?
Surprisingly, the following input produces the correct answer for the problem you proposed.
int(sin(2*n*x),x,0,pi)|n = @n1
Note:
“int” is the sign for integration (accessed by pushing “2nd” and then “7”)
“@” is the sign for indicating an arbitrary integer (accessed by pushing the green key and then “STO”). |
|
|
| Back to top |
|
 |
dreamspy
Joined: 25 Jan 2010 Posts: 5
|
Posted: January 30, 2010 8:31 AM Post subject: |
|
|
Writing a code for Ti-89 is maybe to advaced for me I think. Although I know a bit of C++ programming. So if it isn't to complicated I would be interested to hear. Actually I haven't tryed out the programming capabilities of the Ti-89 so it might be a good reason to start.
Also I'm wondering about another thing.
When I type this:
cos(n*pi) | n = @n1
I get this output:
sin(@n1*pi)
But it would be nice to get something like (-1)^n
Can Texas handle this?
| BlainUSM wrote: | The above approach may not always work. In general, there are two cases to consider
Case 1: The integral assumes infinitely many distinct values over the integers.
Case 2: The integral assumes only finitely many distinct values over the integers.
It’s possible to write code for the TI-89 that will help to handle each of the two cases more elegantly. However, I won’t discuss that further, unless you’re interested. For more complex integration problems, I recommend using other integration software. For example, in Mathematica, the following input will produce the desired result:
Integrate[ Sin[2nx], {x,0,π}, Assumptions→{n∈Integers} ] |
|
|
| Back to top |
|
 |
BlainUSM
Joined: 24 Oct 2009 Posts: 30 Location: New England
|
Posted: January 30, 2010 3:18 PM Post subject: |
|
|
Well, if you're really interested in programming options, I would have to charge you, probably $150.00 or so, since writing the program I have in mind would take up about an hour of my time. We could work out payment options (via PayPal) if you're really interested. For now, I'll assume that you have only a budding interest.
To answer your second question: Yes, Texas can handle that. Try
expand(cos(n*pi)) | n=@n1
Your output should be
(-1)^@n1
If the input is cos(n*pi) | n = @n1, the TI-89 will treat @n1 as an arbitrary variable instead of an arbitrary integer because the cos function doesn't invoke the calculator's simplification routine. |
|
| Back to top |
|
 |
dreamspy
Joined: 25 Jan 2010 Posts: 5
|
Posted: January 30, 2010 7:27 PM Post subject: |
|
|
That works beautifully, thanks
Regarding the programming then it's not that big of a deal. I'm just interested because I might like to learn it. But maybe you could point me to some good sources of programming information for the Ti-89?
regards
Frímann
| BlainUSM wrote: | Well, if you're really interested in programming options, I would have to charge you, probably $150.00 or so, since writing the program I have in mind would take up about an hour of my time. We could work out payment options (via PayPal) if you're really interested. For now, I'll assume that you have only a budding interest.
To answer your second question: Yes, Texas can handle that. Try
expand(cos(n*pi)) | n=@n1
Your output should be
(-1)^@n1
If the input is cos(n*pi) | n = @n1, the TI-89 will treat @n1 as an arbitrary variable instead of an arbitrary integer because the cos function doesn't invoke the calculator's simplification routine. |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
Saphic 1.5 // Theme created by Sopel
|
|