Select element from list wo/CAS?
|
05-06-2023, 01:55 AM
Post: #1
|
|||
|
|||
Select element from list wo/CAS?
If I have a list of values on the Home side of the Prime, is there any convenient way to pull out one element from that list for further calculations? On the CAS side, I can do ListVar(index). But I don't see how to do that on the Home side. Keystrokes would be fine - I'm not necessarily looking for a programmatic solution.
Context... I'm just writing a simple quadratic solver program that returns a list with both solutions. I'd like to be able to pull a single solution from the return list. |
|||
05-06-2023, 02:34 AM
Post: #2
|
|||
|
|||
RE: Select element from list wo/CAS?
Many ways...for example
GET(L1,1) or SUB(L1,1,1) or POS(L1,3) or last element L1(0) or just L1(1) |
|||
05-06-2023, 02:38 AM
Post: #3
|
|||
|
|||
RE: Select element from list wo/CAS? | |||
05-06-2023, 02:57 AM
Post: #4
|
|||
|
|||
RE: Select element from list wo/CAS?
Ans(1) returns the first entry on the screen, that is not a list...
|
|||
05-06-2023, 03:06 AM
Post: #5
|
|||
|
|||
RE: Select element from list wo/CAS?
(05-06-2023 02:57 AM)gehakte_bits Wrote: Ans(1) returns the first entry on the screen, that is not a list...So - in Home mode - say I get a list for an answer. What's the easiest way to pull a single element from that list? It may be the case that Home mode simply isn't built for this kind of manipulation, since it's generally expecting single values as answers. Again, my context here is a simple quadratic solver. I usually work in Home mode since I'm generally looking for numeric results and not doing CAS stuff. But I'd like to whip out some quick solutions to quadratics without switching modes, and I'd like to be able to select one of the two solutions (if necessary) to use in further calculations. |
|||
05-06-2023, 03:19 AM
Post: #6
|
|||
|
|||
RE: Select element from list wo/CAS?
try
get(Ans(1),2) with a list on the first entry line |
|||
05-06-2023, 03:26 AM
Post: #7
|
|||
|
|||
RE: Select element from list wo/CAS?
(05-06-2023 03:19 AM)gehakte_bits Wrote: get(Ans(1),2)Yes, that works, even without the (1) argument on Ans. But it's hardly convenient. Is there no easier way? I may just need to accept running list-returning programs in CAS mode. As I said, I do understand why the Prime architecture tends that way. It would be great if I could just have a program return multiple values on separate lines so that they'd be easily copy-able in Home mode. But that doesn't appear to be possible. Thanks for the replies. |
|||
05-06-2023, 05:22 PM
Post: #8
|
|||
|
|||
RE: Select element from list wo/CAS?
(05-06-2023 01:55 AM)tppytel Wrote: Context... I'm just writing a simple quadratic solver program that returns a list with both solutions. I'd like to be able to pull a single solution from the return list. If you have a list, say {10,20,30}, you can Sto> it in L1 (or any list variable). Then each item in the list is accessible by its index. In this example L1(2) would return 20. And the list would stay easily accessible(even in CAS environment). Consequently let your program return the result as a named list, of which you then have full control. HTH, Günter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)