Question about CAS and Graphing
11-24-2014, 06:33 AM
Post: #21
 Angus Member Posts: 212 Joined: Feb 2014
RE: Question about CAS and Graphing
"This is unnecessary. In CAS, simply type:
F1:=f('X');
which evaluates f at the symbolic value 'X' and properly provides a formula for F1."

Does that work for you guys?
Type F1:=f('X') as advised. But when switching to function app I see a Syntax Error displayed for F1(X).
Checking the function gives 'x(X)^2'/2...

Trying Function.F2:=f('X'). Again there is a syntax error for F2(X) in the function app and the formula displayed when tapping that error id 'x(0)^2'/2.

Can someone point out what is wrong?
11-24-2014, 08:14 AM
Post: #22
 Gerald H Senior Member Posts: 1,438 Joined: May 2014
RE: Question about CAS and Graphing
(11-23-2014 08:41 PM)Han Wrote:
(11-23-2014 03:15 PM)Gerald H Wrote:  It may be a pleasure to bounce around between Mathematica & Maple in a world where both are freely available, unfortunately on my planet you have to pay cash for them.

I don't see why cost is at all relevant to the initial discussion. If anything, the cost speaks favorably for the HP Prime (and its free CAS). At any rate, the target demographics for the Prime includes college students. At many universities, software packages such as Mathematica, Maple, Mathcad, etc. are all available to students. You can even get them at student pricing (if you want your own license) for $75. Quote:I pity the poor creatures having to use both M & M to solve their problems - do you imagine these beings will have the discipline to remember the system they're working in & come up with the right syntax everytime? Are you suggesting that we pity folks who choose to do research for which applications such as Mathematica and Maple are simultaneously useful? I wouldn't pity them for the same reason I wouldn't pity folks who strive to learn two languages and struggle to understand those who natively speak the two languages in a mixed fashion (I know plenty of folks who speak half a sentence in one language, and finish the second half in another). If anything, I think it's commendable that people make an effort to learn more than one language, CAS, operating system, what-have-you... Perhaps you meant we should pity the "creatures" who are given homework assignments that require multiple software applications to solve problems. While most typical class assignments will not require several CAS to solve, that doesn't mean that there aren't situations where the use of multiple software packages are necessary. I am sure you can find numerous engineers who not only have to program their own solutions, they probably even do it via multiple languages and/or CAS to check their work. In fact, I know a graduate student in engineering who was doing that just that this week -- and it was for a single homework assignment. Even among undergraduate students there will come times when they may rely on many different applications to solve a problem. For example, many undergraduates compete in the mathematical competition in modeling; the problems are often open-ended questions. As for whether they remember the syntax -- they try stuff out on their own, ask for help, and/or read the documentation and that seems to work out just fine. If you don't like the Mathematica and Maple analogy, then just look at any recent version of Maple itself. They have both "worksheets" and "documents" and you can even use a combination of both inside a single session. I cannot count the number of times I have had to explain to students the pitfalls mixing 2D and 1D math and when what they type is math input vs. plain text. Anyway, I hated the fact that the Prime had two environments when I first got one because the familiarity with the HP48G through HP50G calculators had been so deeply ingrained. Now, it doesn't bother me as much because I have gotten more familiar with how each work. Despite my love for the HP48GX, it just doesn't hold a candle to the power available on the Prime. Merely "commendable" that people learn more than one language? Now, if HOME were in German, CAS in French, Spreadsheet in Chinese.... you'd always know which environment you were in & surely never make mistakes in vocab & syntax? Too daft ... language is for communication & better we all speak one ... I'm willing to compromise on English or Chinese... but we could keep Latin for special environments, eg religion? 11-24-2014, 10:29 AM Post: #23  Gerald H Senior Member Posts: 1,438 Joined: May 2014 RE: Question about CAS and Graphing (11-23-2014 08:41 PM)Han Wrote: (11-23-2014 03:15 PM)Gerald H Wrote: It may be a pleasure to bounce around between Mathematica & Maple in a world where both are freely available, unfortunately on my planet you have to pay cash for them. I don't see why cost is at all relevant to the initial discussion. If anything, the cost speaks favorably for the HP Prime (and its free CAS). At any rate, the target demographics for the Prime includes college students. At many universities, software packages such as Mathematica, Maple, Mathcad, etc. are all available to students. You can even get them at student pricing (if you want your own license) for$75.

Quote:I pity the poor creatures having to use both M & M to solve their problems - do you imagine these beings will have the discipline to remember the system they're working in & come up with the right syntax everytime?

Are you suggesting that we pity folks who choose to do research for which applications such as Mathematica and Maple are simultaneously useful? I wouldn't pity them for the same reason I wouldn't pity folks who strive to learn two languages and struggle to understand those who natively speak the two languages in a mixed fashion (I know plenty of folks who speak half a sentence in one language, and finish the second half in another). If anything, I think it's commendable that people make an effort to learn more than one language, CAS, operating system, what-have-you...

Perhaps you meant we should pity the "creatures" who are given homework assignments that require multiple software applications to solve problems. While most typical class assignments will not require several CAS to solve, that doesn't mean that there aren't situations where the use of multiple software packages are necessary. I am sure you can find numerous engineers who not only have to program their own solutions, they probably even do it via multiple languages and/or CAS to check their work. In fact, I know a graduate student in engineering who was doing that just that this week -- and it was for a single homework assignment. Even among undergraduate students there will come times when they may rely on many different applications to solve a problem. For example, many undergraduates compete in the mathematical competition in modeling; the problems are often open-ended questions. As for whether they remember the syntax -- they try stuff out on their own, ask for help, and/or read the documentation and that seems to work out just fine.

If you don't like the Mathematica and Maple analogy, then just look at any recent version of Maple itself. They have both "worksheets" and "documents" and you can even use a combination of both inside a single session. I cannot count the number of times I have had to explain to students the pitfalls mixing 2D and 1D math and when what they type is math input vs. plain text.

Anyway, I hated the fact that the Prime had two environments when I first got one because the familiarity with the HP48G through HP50G calculators had been so deeply ingrained. Now, it doesn't bother me as much because I have gotten more familiar with how each work. Despite my love for the HP48GX, it just doesn't hold a candle to the power available on the Prime.

"I can't count the number of times..." indicates:

1. Students are idiots;

2. Students are intelligent & require uniform input output methods to facilitate their use of available tools.

11-24-2014, 11:47 AM
Post: #24
 Han Senior Member Posts: 1,812 Joined: Dec 2013
RE: Question about CAS and Graphing
(11-24-2014 10:29 AM)Gerald H Wrote:  "I can't count the number of times..." indicates:

1. Students are idiots;

2. Students are intelligent & require uniform input output methods to facilitate their use of available tools.

Or, it could mean something else. When you teach many classes of different students on the same subject, there will be issues that come up time and time again. It does not mean that the issues necessarily happen repeatedly within a single group of students and/or in a single class. It is simply a matter of a lack experience which they gain through class and practice.

The idea of two different environments in the same system, each with their own set of rules is not unique to the Prime -- even among HP calculators. The HP50G is a recent example. Some prefer algebraic input, others prefer RPN. We can create a program in one environment and run it in the other. Of course, we have to be careful with providing sufficient arguments when, say, running an RPN program in algebraic mode.

Graph 3D | QPI | SolveSys
11-24-2014, 01:00 PM
Post: #25
 Gerald H Senior Member Posts: 1,438 Joined: May 2014
RE: Question about CAS and Graphing
(11-24-2014 11:47 AM)Han Wrote:
(11-24-2014 10:29 AM)Gerald H Wrote:  "I can't count the number of times..." indicates:

1. Students are idiots;

2. Students are intelligent & require uniform input output methods to facilitate their use of available tools.

Or, it could mean something else. When you teach many classes of different students on the same subject, there will be issues that come up time and time again. It does not mean that the issues necessarily happen repeatedly within a single group of students and/or in a single class. It is simply a matter of a lack experience which they gain through class and practice.

The idea of two different environments in the same system, each with their own set of rules is not unique to the Prime -- even among HP calculators. The HP50G is a recent example. Some prefer algebraic input, others prefer RPN. We can create a program in one environment and run it in the other. Of course, we have to be careful with providing sufficient arguments when, say, running an RPN program in algebraic mode.

I wonder about the encouragement of mathematical ability & problem solving - Should we train our students to behave like trick dogs & jump through the hoops of the difficult software terrain or - just possibly worth consideration - mitigate their problems by learning from them to remove the difficulties which the experienced teacher has come to terms with during the sad course of his professionalization.
11-24-2014, 01:29 PM (This post was last modified: 11-24-2014 02:01 PM by Han.)
Post: #26
 Han Senior Member Posts: 1,812 Joined: Dec 2013
RE: Question about CAS and Graphing
(11-24-2014 01:00 PM)Gerald H Wrote:  I wonder about the encouragement of mathematical ability & problem solving - Should we train our students to behave like trick dogs & jump through the hoops of the difficult software terrain or - just possibly worth consideration - mitigate their problems by learning from them to remove the difficulties which the experienced teacher has come to terms with during the sad course of his professionalization.

What are you going on about? We teach them the software because the real world doesn't typically give them hand-crafted problems that they can easily solve by hand. They start as early as calculus and continue to learn about the software in upper level courses such as applied mathematics or numerical analysis. Students are taught how to use Mathematica; they're taught how to use Maple, and Matlab, and several others (depending on their major). If they choose to use both, we also teach them how to do that. They're also taught how to use Maple's features such as 2D input. And they're also taught that Maple can handle 1D input as well. And should students choose to mix the two, we also teach them about the nuances of doing that as well. Should they choose (for themselves) to use multiple software applications, they will inevitably run into situations where the syntax from one gets accidentally used in the other (as a simple example). Are you suggesting we teach only one and not the other so as to avoid these issues that come up time and time again? Edit: here's one reason not to stick to a single CAS: http://www.ams.org/notices/201410/rnoti-p1249.pdf

As for the end of your post, surely you can do better to add to this discussion than to post innuendos.

Graph 3D | QPI | SolveSys
11-24-2014, 02:12 PM
Post: #27
 Han Senior Member Posts: 1,812 Joined: Dec 2013
RE: Question about CAS and Graphing
(11-24-2014 06:33 AM)Angus Wrote:  "This is unnecessary. In CAS, simply type:
F1:=f('X');
which evaluates f at the symbolic value 'X' and properly provides a formula for F1."

Does that work for you guys?
Type F1:=f('X') as advised. But when switching to function app I see a Syntax Error displayed for F1(X).
Checking the function gives 'x(X)^2'/2...

Trying Function.F2:=f('X'). Again there is a syntax error for F2(X) in the function app and the formula displayed when tapping that error id 'x(0)^2'/2.

Can someone point out what is wrong?

Did you previously define f as a function (example: f(x):=1/2*x^2) or did you merely define f as an expression (example: f:=1/2*x^2)?

Graph 3D | QPI | SolveSys
11-24-2014, 04:37 PM (This post was last modified: 11-24-2014 05:24 PM by CR Haeger.)
Post: #28
 CR Haeger Member Posts: 275 Joined: Dec 2013
RE: Question about CAS and Graphing
Back to the OP...

Normally, if I work in CAS and end up creating function(s) that I want to plot in Function APP, then I:

1. Save the function using say f(x):=x^2 etc... // creates a CAS program f()

2. Save f(x) into Function.F1 using Function.F1:=f //Note: can use F1:=f if you are already in Function App

3. Symb view in Function App should have F1(X): function with capital Xs.

If the functions being worked on in CAS are pretty long, I like to assign them to f(x), g(x) etc. early on as it is easier to type (or use Vars/CAS/Program to select).

This works in reverse as well. Say I have been plotting functions F1, F2 etc. and want to send to CAS. In CAS I can use f(x):=F1(x), which stores F1 into f using lower case x. I can also use F1(x) directly in CAS.

Finally, to make this even quicker and reduce keying errors, I setup a few USERKEYs to prefill the CAS command line. See attachment for an example program.

Best,
Carl

PS - Han and others have been great teachers for those of us learning how to use the Prime hard and software.
11-25-2014, 06:34 AM
Post: #29
 Gerald H Senior Member Posts: 1,438 Joined: May 2014
RE: Question about CAS and Graphing
(11-24-2014 04:37 PM)CR Haeger Wrote:  Back to the OP...

Normally, if I work in CAS and end up creating function(s) that I want to plot in Function APP, then I:

1. Save the function using say f(x):=x^2 etc... // creates a CAS program f()

2. Save f(x) into Function.F1 using Function.F1:=f //Note: can use F1:=f if you are already in Function App

3. Symb view in Function App should have F1(X): function with capital Xs.

If the functions being worked on in CAS are pretty long, I like to assign them to f(x), g(x) etc. early on as it is easier to type (or use Vars/CAS/Program to select).

This works in reverse as well. Say I have been plotting functions F1, F2 etc. and want to send to CAS. In CAS I can use f(x):=F1(x), which stores F1 into f using lower case x. I can also use F1(x) directly in CAS.

Finally, to make this even quicker and reduce keying errors, I setup a few USERKEYs to prefill the CAS command line. See attachment for an example program.

Best,
Carl

PS - Han and others have been great teachers for those of us learning how to use the Prime hard and software.

Great teachers spend time demonstrating how to use calculator with the best result that you are proficient in its use.

I would be impressed with the learners proficiency if some unexpected task could be well solved in a reasonable time.

So: as far as I know, no one has improved on the inbuilt integer factorization programme? Perhaps an adept could produce an elliptic curve method integer factorizing programme that betters & increases the range of factored numbers. Perhaps a lattice point counting programme at the same time?
11-26-2014, 06:02 AM
Post: #30
 jte Member Posts: 69 Joined: Feb 2014
RE: Question about CAS and Graphing
(11-23-2014 08:42 PM)Han Wrote:
(11-23-2014 06:31 PM)jte Wrote:  After trying a handful of examples I've also experienced some crashes when going to a Function plot view (crashes that didn't occur with F1 defined as f(X) in the Function Symbolic view — but only when f contained CAS operations).

Could you provide some examples?

IIRC, the examples I tried that crashed when going to a Plot view all showed "Error: Syntax Error" as the F1 definition in the Function Symbolic View. When that occurs, it may be apropos to treat that as a warning and save your work / not enter a Plot view (or, at least, uncheck the function(s) whose definitions come up as syntax errors — even though I wouldn't describe a crash in this situation as being expected).

When I try the following in the CAS screen of a virtual calculator (just after resetting it) I get a window reporting that "the application has crashed and will be restarted":
f(z):=proot([1,z])
f(3)
g(z):=f(z)(1)
g(3)
F1:=g
F1:=g('X')

I included the penultimate step as it demonstrates "Error: Syntax Error" showing up as a definition in the Function Symbolic View. (I didn't observe a crash when I tried going to a Function plot view.)

I do get the plot I expect if I define F1 as g(X) in the Function Symbolic View.

I rarely use the CAS, so there likely are better ways to use it than those that I know of.

PS: I just tried the above example again after setting "Simplify:" to None in the CAS Settings screen. After this change in settings I didn't observe a crash with this example.
11-26-2014, 10:15 AM (This post was last modified: 11-26-2014 10:56 AM by Angus.)
Post: #31
 Angus Member Posts: 212 Joined: Feb 2014
RE: Question about CAS and Graphing
hello CR Haeger,

on http://forum.hp-prime.de/discussion/94/u...ift#Item_8 (forum in german) we came up with the idea of improving the usability of the user keyboard.
Based on that I added a rudimentary softmenu that can be triggered with the view key prior an other key.

I added your functions to view+D for quick access without wasting many user keys. Maybe that concept can be helpful for you, too.
Keep us informed on your activities! I really like your blog. In a way it is didactically better that HPs originals and personally I can feel your passion for the topic.

I apologize for mixing up languages in the comments. It was not intended to be shown and atm I have so little time to work on the code. (I should, yes, if only to learn using the prime and maybe to reach a point were base conversions satisfies me)

//User keys

KEY KS_Comma()
BEGIN
LOCAL n:=0, s:={"subst("+CAS.Ans+",)","solve("+CAS.Ans+"=0)","solve("+CAS.Ans+")","cSolve()","nSolve()"};

IF CHOOSE(n,"Lösen",s) THEN
RETURN s(n);
RETURN (30);
ELSE
RETURN "eval()";
END;
END;

KEY KS_Xttn()
BEGIN
RETURN ":=";
END;

///////////////////////////////////////////////////////////////////////////////////////////
//view starts my-user menu
///////////////////////////////////////////////////////////////////////////////////////////

KEY K_View()
BEGIN
LOCAL shift:=0, alpha:=0, code;
SUBGROB_P(G0, 0, 0, 39, 9, G1);

//VISUALISIEREN [a][shif]CUSTOM USER
WHILE(1) DO //Bis !shift||!alpha
BLIT(G1); //alte linke obere Ecke malen

IF shift THEN
TEXTOUT_P("s",1,0,1,#00FFFFh);
END;
IF alpha THEN
TEXTOUT_P("α",6*shift+1,0,1,#FFCC00h);
END;

TEXTOUT_P("USR",6*shift+7*alpha+1,0,1,#FFFF00h);
code:=WAIT;
CASE
IF code=41 THEN shift:=1-shift; END;
IF code=36 THEN alpha:=1-alpha; END;
DEFAULT BREAK;
END;
END;

//CUSTOM USER AUSFÜHREN
CASE
IF code=13 THEN //MENU
END;

IF code=45 THEN //'3', also Basis
END;

IF code=17 THEN //define
END;

IF code=9 THEN //bei VIEW Fehler auslösen damit VIEW kommt
KILL;
END;

DEFAULT code; //Alle anderen Tasten einfach ausführen
END;
END;

///////////////////////////////////////////////////////////////////////////////////////////
//MY User Menu Handler
///////////////////////////////////////////////////////////////////////////////////////////

BEGIN
DRAWMENU("hex","dec","bin","","2Real","#"); // Softmenü zeichnen
LOCAL inp:=WAIT(-1); // Benutzereingabe abwarten
IF TYPE(inp)≠6 THEN RETURN inp; END; // Tastaturdrucke einfach durchleiten
IF inp(1)≠#0d AND
inp(1)≠#3d AND
inp(1)≠#7d THEN RETURN ""; END; // Touchgesten (außer Klicks) ignorieren
IF inp(3)<#220d THEN RETURN ""; END; // Klick außerhalb des Menüs ignorieren
LOCAL btn:=IP(inp(2)*6/320); // Welcher Button gedrückt (0..5)?

CASE
IF btn=0 THEN RETURN " 32 4 R→B(3)"; END;
IF btn=1 THEN RETURN " 32 3 R→B(3)"; END;
IF btn=2 THEN RETURN " 32 1 R→B(3)"; END;
IF btn=3 THEN ""; END;
IF btn=4 THEN RETURN "B→R()"; END;
IF btn=5 THEN "#"; END;
DEFAULT ""; // Mehr Softbuttons haben wir erstmal nicht.
END;

END;

BEGIN
DRAWMENU("factor","fact","expand","expd","partfrac","partf"); // Softmenü zeichnen
LOCAL inp:=WAIT(-1); // Benutzereingabe abwarten
IF TYPE(inp)≠6 THEN RETURN inp; END; // Tastaturdrucke einfach durchleiten
IF inp(1)≠#0d AND
inp(1)≠#3d AND
inp(1)≠#7d THEN RETURN ""; END; // Touchgesten (außer Klicks) ignorieren
IF inp(3)<#220d THEN RETURN ""; END; // Klick außerhalb des Menüs ignorieren
LOCAL btn:=IP(inp(2)*6/320); // Welcher Button gedrückt (0..5)?

CASE
IF btn=0 THEN STRING(factor(Ans)); END;
IF btn=1 THEN "factor("+CAS.Ans+")"; END;
IF btn=2 THEN STRING(expand(Ans)); END;
IF btn=3 THEN "expand("+CAS.Ans+")"; END;
IF btn=4 THEN STRING(partfrac(Ans)); END;
IF btn=5 THEN "partfrac("+CAS.Ans+")"; END;
DEFAULT ""; // Mehr Softbuttons haben wir erstmal nicht.
END;
END;

//CR Haeger
BEGIN
LOCAL inp:=WAIT(-1); // Benutzereingabe abwarten
IF TYPE(inp)≠6 THEN RETURN inp; END; // Tastaturdrucke einfach durchleiten
IF inp(1)≠#0d AND
inp(1)≠#3d AND
inp(1)≠#7d THEN RETURN ""; END; // Touchgesten (außer Klicks) ignorieren
IF inp(3)<#220d THEN RETURN ""; END; // Klick außerhalb des Menüs ignorieren
LOCAL btn:=IP(inp(2)*6/320); // Welcher Button gedrückt (0..5)?

CASE
IF btn=0 THEN "f(x):=" END;
IF btn=1 THEN "Function.F1:=f" END;
IF btn=2 THEN "f(x):=Function.F1(x)" END;
IF btn=3 THEN "f(x):="+CAS.Ans END;
DEFAULT ""; // Mehr Softbuttons haben wir erstmal nicht.
END;

END;
 « Next Oldest | Next Newest »

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