Post Reply 
Program help needed
11-23-2014, 12:50 AM (This post was last modified: 11-23-2014 01:01 AM by Han.)
Post: #8
RE: Program help needed
(11-22-2014 11:29 PM)DrD Wrote:  Well, that's part of the problem ... There is a space where a comma would (more clearly) separate the TWO parts of the vector. However, 'Textbook Display' checked, resulted in the gradient function producing a vector with a space. Not only can I not clearly see the components in this example, mat2list() may not be able to discern it either.

Is this a bug, perhaps?

I'm not disagreeing with you about the usefulness of having an actual comma be visible in all modes of entry and display. However, I personally don't think there is any bug. On the other hand, I do suspect that there is still a lack of clarity in my explanation as to why what you're experiencing is not a bug.

1. Any algebraic expression may have as much white space as we would like to insert, and it is treated as a single expression--unless the expression is invalid. For example:

2*x -9

is valid despite the spaces (the symbol in front of the 9 is the symbol from the minus key, above the addition key). On the other hand,

2*x -9

is invalid if the symbol in front of the 9 is the negative sign (from the +/- key). This has to do with the fact that the negative sign is a unary operator whereas the subtraction sign is binary (hence one errors whereas the other does not). Regardless of the input/display mode, the calculator generally does not recognize using spaces to separate entries in a vector (or matrix... or for most things). You must always use commas, regardless of whether they actually get displayed (both in the entry and in the output). Textbook entry happens to not display the comma but instead places a space in between entries, and inserts a tiny "input" box that must be filled in.

Note also that in the programming environment, there is no distinction between the negation symbol and the subtraction symbol. However, your post suggests you did this in the CAS view, so I'll just leave it at that.

2. I suspect that when you typed: mat2list( [-3*y^3+2*x -9*x*y^2] ) you used the subtraction key and not the negation key. Otherwise, the calculator would have prevented you from executing this command due to a syntax error. That it did not strongly suggests you used the subtraction key after the space, and preceding the 9. Therefore, the object you created was a valid, single-element vector (regardless of whether you were using algebraic or textbook entry). So mat2list() was not misbehaving at all. No commas were inserted because there is only a single algebraic entry in the vector (now a list). If you had followed up with size() and copied the resulting list into the size() command, I would be surprised if the result was anything different from 1.

So that leads me to a question, the answer to which I am most curious:

Did you create the vector [-3*y^3+2*x -9*x*y^2] in Textbook Entry mode? And if so, did you use the comma button to create the space or did you use the space key?

If you can answer yes to the first question using the comma button, then you indeed have found a bug (though one which I am unable to duplicate). Otherwise, points #1 and #2 should sufficiently explain (I hope) why you are seeing the behavior that you are reporting. I honestly don't think mat2list() has any trouble deciphering vectors (though I've been wrong plenty of times before).

As I wrote earlier, if you want to see Textbook Display, and have commas in your vectors, then mat2list() will do what you want. If you are having trouble discerning whether your input is correct (see point #1 above), then I would recommend to use the Algebraic entry mode instead of Textbook entry mode (different from the Textbook Display) and leave Textbook Display on (unless you find that not so useful).

Whatever you choose, a comma will always be required during input (even if said comma does not show up as a result of input-mode settings).

Edit: What I wrote above applies to the CAS view only.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Program help needed - DrD - 11-22-2014, 01:36 PM
RE: Program help needed - Han - 11-22-2014, 01:44 PM
RE: Program help needed - DrD - 11-22-2014, 03:53 PM
RE: Program help needed - Han - 11-22-2014, 06:04 PM
RE: Program help needed - DrD - 11-22-2014, 08:34 PM
RE: Program help needed - Han - 11-22-2014, 09:02 PM
RE: Program help needed - DrD - 11-22-2014, 11:29 PM
RE: Program help needed - Han - 11-23-2014 12:50 AM
RE: Program help needed - DrD - 11-23-2014, 03:25 PM
RE: Program help needed - Han - 11-23-2014, 05:32 PM
RE: Program help needed - DrD - 11-24-2014, 12:07 PM
RE: Program help needed - Han - 11-24-2014, 01:43 PM



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