Post Reply 
CAS versus HOME confusion.
01-23-2014, 10:48 AM
Post: #1
CAS versus HOME confusion.
A quick question regarding the CAS on prime. I generally keep the calculator in CAS mode when working. If I type MAKELIST(x,x,1,5,1) in CAS mode I get an empty list, [], whereas in HOME mode i get [1, 2, 3, 4, 5] as expected. What is happening here? Thanks for the reply.
Find all posts by this user
Quote this message in a reply
01-23-2014, 01:30 PM
Post: #2
RE: CAS versus HOME confusion.
Works for me on emulator.
Find all posts by this user
Quote this message in a reply
01-23-2014, 02:24 PM
Post: #3
RE: CAS versus HOME confusion.
I get the same behavior on my emulator as on my calculator.
(Software version 2013 11 25 (5447); CAS version 1.1.0-27)
Find all posts by this user
Quote this message in a reply
01-23-2014, 02:37 PM
Post: #4
RE: CAS versus HOME confusion.
(01-23-2014 02:24 PM)cdecastro Wrote:  I get the same behavior on my emulator as on my calculator.
(Software version 2013 11 25 (5447); CAS version 1.1.0-27)

There are some conditions with the lowercase variables in the non cas view (I don't exactly remember them: check the manual for reserved vars)

Try with uppercase X

My website: erwin.ried.cl
Visit this user's website Find all posts by this user
Quote this message in a reply
01-23-2014, 02:55 PM
Post: #5
RE: CAS versus HOME confusion.
I don't attempt to variables out of context, i.e. I only use x in CAS mode and X in Home mode. Yet, MAKELIST(x,x,1,5,1) in CAS MODE, and
MAKELIST(X,X,1,5,1) in Home mode yield [ ] and [ 1, 2, 3, 4, 5 ] respectively. This same thing happens when I try the emulator. I appreciate the responses.
Find all posts by this user
Quote this message in a reply
01-23-2014, 03:42 PM
Post: #6
RE: CAS versus HOME confusion.
In that case, I have no idea. Works for me in the emulator. http://cl.ly/TWAb http://cl.ly/TWFA

My website: erwin.ried.cl
Visit this user's website Find all posts by this user
Quote this message in a reply
01-23-2014, 04:07 PM
Post: #7
RE: CAS versus HOME confusion.
(01-23-2014 10:48 AM)cdecastro Wrote:  A quick question regarding the CAS on prime. I generally keep the calculator in CAS mode when working. If I type MAKELIST(x,x,1,5,1) in CAS mode I get an empty list, [], whereas in HOME mode i get [1, 2, 3, 4, 5] as expected. What is happening here? Thanks for the reply.

In CAS you can use sequence to generated any list including symbolic list for example:
seq(2^j,j=1..5)-->[2 4 8 16 32]
seq(j,j=1..5) -->[1 2 3 4 5]
seq(a^j,j=1..3)-->[a,a^2,a^3]
If you want step other then 1:
seq(j,j=1..5,2)-->[1,3,5] etc.
Find all posts by this user
Quote this message in a reply
01-23-2014, 04:22 PM
Post: #8
RE: CAS versus HOME confusion.
How do you type in MAKELIST? If you do it in CAS view from the Tool Catalog, it doesn't work. If you type it in manually (MAKELIST), or if you grab it from the home view screen, where it should have run previously with success (but now, in CAS view, converting the upper case X to lower case x), it works fine.
Find all posts by this user
Quote this message in a reply
01-23-2014, 04:28 PM
Post: #9
RE: CAS versus HOME confusion.
I did choose it from the tools menu; Why should that matter?
Find all posts by this user
Quote this message in a reply
01-23-2014, 04:51 PM (This post was last modified: 01-23-2014 05:12 PM by Han.)
Post: #10
RE: CAS versus HOME confusion.
The CAS has its own makelist() -- in lowercase -- command. There _is_ a bug, here, though. The toolbox produces lowercase makelist() but the display shows MAKELIST() -- which is a different command. This should only happen when the CAS command is the same as the Home command internally (i.e. there is really only one command).

The arguments are essentially the same.

HOME VIEW: MAKELIST(formula, var, start, stop, step)
CAS VIEW: makelist(formula, start, stop, step)

However, the "formula" for the CAS command must be a mathematical function. For example, you can make a function f(x):=x^2. Then do makelist(f,1,2,.1). You can also alternately use the internal format of a function: makelist(x->x^2,1,2,.1).

Please note that a "list" in the CAS is not the same as a "list" in Home.

In general, the toolbox will convert all commands to lowercase if you are in CAS. What you need to watch out for is whether there are two commands of the same name: MAKELIST() for non-CAS, and makelist() for CAS. Another example is STRING() and string(), TYPE() and type().

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
01-23-2014, 07:29 PM
Post: #11
RE: CAS versus HOME confusion.
(01-23-2014 04:51 PM)Han Wrote:  The CAS has its own makelist() -- in lowercase -- command. There _is_ a bug, here, though. The toolbox produces lowercase makelist() but the display shows MAKELIST() -- which is a different command. This should only happen when the CAS command is the same as the Home command internally (i.e. there is really only one command).

The arguments are essentially the same.

HOME VIEW: MAKELIST(formula, var, start, stop, step)
CAS VIEW: makelist(formula, start, stop, step)

However, the "formula" for the CAS command must be a mathematical function. For example, you can make a function f(x):=x^2. Then do makelist(f,1,2,.1). You can also alternately use the internal format of a function: makelist(x->x^2,1,2,.1).

Please note that a "list" in the CAS is not the same as a "list" in Home.

In general, the toolbox will convert all commands to lowercase if you are in CAS. What you need to watch out for is whether there are two commands of the same name: MAKELIST() for non-CAS, and makelist() for CAS. Another example is STRING() and string(), TYPE() and type().

Wow. CAS is just one chapter long in the HP Prime manual. I downloaded the Xcas reference manual from Parisse's site here. It is a must read to avoid confusion on these "nuances" between CAS and Home.

Thanks Han. I am always amazed of the knowledge that you have on the Prime.

Regards,

Miguel.
Find all posts by this user
Quote this message in a reply
01-24-2014, 06:31 PM (This post was last modified: 01-24-2014 06:32 PM by Eddie W. Shore.)
Post: #12
RE: CAS versus HOME confusion.
I can't get MAKELIST to work in CAS mode. However, seq(function, variable, begin, end, [step]) works.
Visit this user's website Find all posts by this user
Quote this message in a reply
01-24-2014, 07:08 PM (This post was last modified: 01-24-2014 07:20 PM by Han.)
Post: #13
RE: CAS versus HOME confusion.
(01-24-2014 06:31 PM)Eddie W. Shore Wrote:  I can't get MAKELIST to work in CAS mode. However, seq(function, variable, begin, end, [step]) works.

MAKELIST(2*x-1,x,2,5) works just fine for me; it produces { 3, 5, 7, 9 }. How are you placing the MAKELIST() command into the command prompt? (It makes a difference; see my earlier post)

MAKELIST() and makelist() are two distinct commands that unfortunately share the same name.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
01-24-2014, 08:45 PM
Post: #14
RE: CAS versus HOME confusion.
(01-24-2014 07:08 PM)Han Wrote:  
(01-24-2014 06:31 PM)Eddie W. Shore Wrote:  I can't get MAKELIST to work in CAS mode. However, seq(function, variable, begin, end, [step]) works.

MAKELIST(2*x-1,x,2,5) works just fine for me; it produces { 3, 5, 7, 9 }. How are you placing the MAKELIST() command into the command prompt? (It makes a difference; see my earlier post)

MAKELIST() and makelist() are two distinct commands that unfortunately share the same name.

What I've noticed when using 'makelist' in CAS is:
When you use MAKELIST from the catalog and use for ex. 2*x-1,x,2,5 as arguments CAS automatically converts the name of the function to uppercase and it does not work but when you use, as you wrote before the, internal format of a function, and put the arguments as x->2*x-1,2,5 it stays in lowercase and it works.
What interest me is how to make the 'makelist' work in CAS in program.
Find all posts by this user
Quote this message in a reply
01-24-2014, 10:22 PM (This post was last modified: 01-24-2014 10:24 PM by Han.)
Post: #15
RE: CAS versus HOME confusion.
(01-24-2014 08:45 PM)John P Wrote:  What interest me is how to make the 'makelist' work in CAS in program.

You can create a string-equivalent of what you would normally use in the command line in CAS view, and use CAS(). For example: my list:=CAS("makelist(x->x^2,x,1,5)"); would work just fine. If you want something a bit more dynamic, build the string separately as a string variable, and evaluate CAS() on the string variable. For example:

Code:

LOCAL stringcmd;
LOCAL formula:="x->x^2";
LOCAL var:="x";
stringcmd:="makelist(" + formula + "," + var + ", A, B)";
LOCAL mylist;

// at this point, stringcmd = "makelist(x->x^2,x,A,B)"
// A and B are the global variables.
mylist:=CAS(stringcmd);

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
01-24-2014, 10:37 PM
Post: #16
RE: CAS versus HOME confusion.
(01-24-2014 10:22 PM)Han Wrote:  
(01-24-2014 08:45 PM)John P Wrote:  What interest me is how to make the 'makelist' work in CAS in program.

You can create a string-equivalent of what you would normally use in the command line in CAS view, and use CAS(). For example: my list:=CAS("makelist(x->x^2,x,1,5)"); would work just fine. If you want something a bit more dynamic, build the string separately as a string variable, and evaluate CAS() on the string variable. For example:

Code:

LOCAL stringcmd;
LOCAL formula:="x->x^2";
LOCAL var:="x";
stringcmd:="makelist(" + formula + "," + var + ", A, B)";
LOCAL mylist;

// at this point, stringcmd = "makelist(x->x^2,x,A,B)"
// A and B are the global variables.
mylist:=CAS(stringcmd);

Thank you.
Find all posts by this user
Quote this message in a reply
02-13-2014, 09:12 AM
Post: #17
RE: CAS versus HOME confusion.
I'm new to the prime.
So bare with me - there is a lot of beginner's confusion in my questions. However I do use hp calculators since the early 90s. Maybe that is what makes playing with the prime a VERY frustrating experience for me. Recently I read a quote that says it is designed for school audience and from a teacher's point of view. Since I'm an engineer that might be the cause of my problems. I'm stuck in old thinking and I don't have too much time to spend for the unknown.


My question here is: Why would one distinguish between makelist in CAS view and MAKELIST in homeview? The result I expect is the same so why the hell do I need to consider what mode I'm in? Same goes with the variable naming but that is something different.
You offer workarounds on how to use something in a different calculator mode. Could be a command or a symbolic expression or whatever... I don't feel comfortable with needing workarounds i.e. strcat or helper programs for achieving something that SHOULD work from scratch in my intuition.... :-(

Does anyone know a comprehensive, yet pratctical usage in mind introduction for usage of the hp prime?? Most of the sources I found where app-centric, plain advertisings or such. In depth tricks or structured explanation are found very rarely.
Did hp kill the mes??? That helped me more than once. rpn needed! Flickering screen? wtf.

Please, community, help me love the latest hp product!

Second you say a list in cas is something completely different than a list in home mode - could you be more specific on that, please?
Find all posts by this user
Quote this message in a reply
02-13-2014, 09:13 PM (This post was last modified: 02-13-2014 09:17 PM by Dominik Holenstein.)
Post: #18
RE: CAS versus HOME confusion.
Here are my two cents regarding MAKELIST() or makelist().

Used example: makelist(x,x,1,5,1)

Case 1:
HP Prime, CAS mode, x is not defined
1. Choosing MAKELIST from either the Math menu or the Catalogue
2. Entry in the command line: makelist(x,x,1,5,1)
3. Result: []
4. The entry looks now like this: MAKELIST(x,x,1,5,1)
--> expected as x is not defined

Case 2:
Like Case 1 but x has been defined now (x:=0)
1. Choosing MAKELIST from either the Math menu or the Catalogue
2. Entry in the command line: makelist(x,x,1,5,1)
3. Result: [0]
4. The entry looks now like this: MAKELIST(x,x,1,5,1)
--> The HP Prime seems to evaluate something here as x := 0

Case 3:
Like Case 2
1. Choosing MAKELIST from either the Math menu or the Catalogue
2. Entry in the command line: makelist(x->x,1,5,1)
3. Result: [1 2 3 4 5]
4. The entry looks now like this: MAKELIST(x->,x,1,5,1)
--> This method delivers the expected result (Han, many thanks for your hint!).

The HP Prime always capitalises the makelist function. This is not the case with other functions like seq() for example.

Whe I go through the cases 1 - 3 on the HP Virtual Prime (emulator) with the same steps then the makelist() function is not capitalised.

We definitely need a in-depth and detailed HP Prime CAS manual. I will now go through the xCAS reference manual as Miguel (many thanks!) has suggested here.

Regards,
Dominik
Find all posts by this user
Quote this message in a reply
02-14-2014, 08:21 AM
Post: #19
RE: CAS versus HOME confusion.
To avoid confusion, I would recommend using seq (at least inside the CAS)
seq(x,x,1,5)
seq(k/5,k,-6,6,2)
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)