Entering partial derivatives?
11-06-2014, 01:46 PM
Post: #1
 DrD Senior Member Posts: 1,095 Joined: Feb 2014
Entering partial derivatives?
User Interface question: $$f(x,y):=x^2y+xy^2$$
How best to enter this second mixed partial derivative into the entry line(?):

$$\frac{∂^2f(x,y)}{∂x∂y}$$

-Dale-
11-06-2014, 03:11 PM
Post: #2
 Han Senior Member Posts: 1,811 Joined: Dec 2013
RE: Entering partial derivatives?
One way is:

f(x,y):=x^2*y+x*y^2;
diff(f(x,y),x,y);

For higher order derivatives, you simply add more commas and variables. For the $$\frac{\partial}{\partial x^2}$$ you can use the shortcut:

diff(f(x,y),x$2); You can also mix and match the two, such as: diff(f(x,y),y$2,x);

Graph 3D | QPI | SolveSys
11-06-2014, 10:06 PM
Post: #3
 DrD Senior Member Posts: 1,095 Joined: Feb 2014
RE: Entering partial derivatives?
Is there a short way to test a point (1,2) on the partial with respect to x?

diff((f(x,y),x)|x=1,y=2 doesn't work.
diff((f(x,y),x|x=1,y=2) doesn't work.
diff(f(x,y),x)|assume(x = 1,y = 2) doesn't work.
(diff(f(x,y),x)|(assume(x = 1,y = 2))) doesn't work.
(f(x,y),x)'|x=1,y=2) doesn't work.
11-06-2014, 11:36 PM (This post was last modified: 11-07-2014 01:59 PM by Han.)
Post: #4
 Han Senior Member Posts: 1,811 Joined: Dec 2013
RE: Entering partial derivatives?
None of those work because your syntax is ambiguous. There is no way (from a software point of view) to tell if the substitution should be applied prior to executing the command diff() or after. While we all understand your intended meaning, such is the nature of the where function.

As for syntax, it is usually:

expression|x=value

or

expression|{x=value,y=value,…}

It appears that the where function gives precedence to substitution over evaluation of functions. On the other hand, subst() has reverse precedence.

Edit:

diff(x^2*y,x)|{x=r,y=s} produces 2*r*s

subst(diff(x^2*y),{x=1,y=2}) produces 4

Graph 3D | QPI | SolveSys
11-07-2014, 09:04 AM
Post: #5
 ww63 Junior Member Posts: 43 Joined: Sep 2014
RE: Entering partial derivatives?
Your last commant will result in an error message, because one bracket ')' is missing! ;-)
11-07-2014, 11:32 AM
Post: #6
 DrD Senior Member Posts: 1,095 Joined: Feb 2014
RE: Entering partial derivatives?
Thank you for your very informative response, Han!

(Original example): $$f(x,y):=x^2y+xy^2$$

I seem to have omitted in the group of things I did try, that didn't work, was: diff(f(x,y),x)|{x = 1,y = 2}, which is THE form I expected WOULD work.

The subst() function does work, but somewhat misses the ideal: subst(diff(f(x,y),x),{x = 1,y = 2}) returning 8. Whether that is a "shorthand" means of getting the result, stretches the definition of shorthand a bit.

I'd like to suggest that the authors consider extending the utility value of the "|" where command to include applications like: diff(f(x,y),x)|{x = 1,y = 2}. The context is for the substitution to be applied AFTER the differentiation, as would probably be obvious on inspection in handwritten form.

Again, thanks, I learn a great deal from these responses, and hopefully can share accordingly, as time goes on.

-Dale-
11-07-2014, 11:46 AM
Post: #7
 parisse Senior Member Posts: 1,027 Joined: Dec 2013
RE: Entering partial derivatives?
This is not possible, because sometimes you want to eval the argument first (like here) and sometimes you want to eval it after the substitution/assumption is done (for example solve(x^2=4)|x>1). That's precisely why you have 2 instructions for subtitution.
If you want to use |, you must compute the derivative first, for example
fx:=diff(f(x,y),x);
fx|[x=1,y=2]
11-07-2014, 12:14 PM
Post: #8
 DrD Senior Member Posts: 1,095 Joined: Feb 2014
RE: Entering partial derivatives?
I don't want to beat a dead horse, but could the use of an appended flag on the end of the 'where' command resolve the matter? example: "|{x=1,y=2},0" would indicate "eval before" or "|{x=1,y=2},1" "eval after?"
11-07-2014, 02:00 PM
Post: #9
 Han Senior Member Posts: 1,811 Joined: Dec 2013
RE: Entering partial derivatives?
(11-07-2014 09:04 AM)ww63 Wrote:  Your last commant will result in an error message, because one bracket ')' is missing! ;-)

Fixed! -- Thank you!

Graph 3D | QPI | SolveSys
11-07-2014, 05:32 PM
Post: #10
 parisse Senior Member Posts: 1,027 Joined: Dec 2013
RE: Entering partial derivatives?
(11-07-2014 12:14 PM)DrD Wrote:  I don't want to beat a dead horse, but could the use of an appended flag on the end of the 'where' command resolve the matter? example: "|{x=1,y=2},0" would indicate "eval before" or "|{x=1,y=2},1" "eval after?"
It's not very pretty and you would have to explain how evaluation is performed anyway, I prefer to stay with subst and |, with appropriate help (and links to | from subst help and conversly).
11-07-2014, 06:19 PM
Post: #11
 Han Senior Member Posts: 1,811 Joined: Dec 2013
RE: Entering partial derivatives?
You can always create an "alias" program file that shortens built-in commands to shorter commands.

For example:

EXPORT SS(a,b):=
BEGIN
return subst(a,b);
END;

Place all your "macros" in the same file, and they will also appear in the Toobox (under User, next to the Catalog) so you can get there with just a few screen taps.

Now, you can just type:

SS(diff(x^2*y+x*y^2,x),{x=1,y=2});

Graph 3D | QPI | SolveSys
11-08-2014, 11:28 AM
Post: #12
 DrD Senior Member Posts: 1,095 Joined: Feb 2014
RE: Entering partial derivatives?
Backing away from the subject matter to reflect on the intended product purpose, and handheld calculating devices for the classroom market; can it be said that requiring a student to learn machine-dependent mathematics, meets the educational goal of learning subject mathematics? I don't think so in this case.

In a class setting, math topics move forward quite quickly. During lecture, little time is given for a diversion of how "this or that" machine interface must be tweaked to accomplish the subject theme. During recitation, interposing the human machine interface (HMI) demands, adds a layer of confusion to the central goal of learning the topic. Finally, during exam time, trying to recall which of the various machine dependencies is most likely to reach the expectations of examination problems, makes for greater overall difficulty and time demands.

Earlier, the " | where " statement was discussed regarding it's limitations: "that's the way it is" must be accommodated by users of the Prime. Accordingly, many examples exist which don't work using that facility. Yet in a blackboard class setting, that is precisely the form used to pass constraints back to the parent expression. Subst()'s syntax is not part of the lecturer's normal math lexicon.

This discussion emphasizes that hand held technology doesn't cross connect with the classroom, easily. HMI, lecture, recitation, and exam, would be ever so much the better if objectives being taught were, in the same way, met by the tools being marketed for them.

Personally, I feel the Prime fails educators, students, and others, in this important particular scenario, and needs more work.

-Dale-
11-08-2014, 02:16 PM
Post: #13
 Gilles Member Posts: 162 Joined: Oct 2014
RE: Entering partial derivatives?
Hi, why don't use the 'template" wich is in my opinion the fastest way ?

returns 8
11-08-2014, 03:48 PM
Post: #14
 DrD Senior Member Posts: 1,095 Joined: Feb 2014
RE: Entering partial derivatives?
Isn't that interesting? In the beginning of my work with this subject, I did use the template key for this.

In the first post, I was trying to find a way to enter second mixed partials: $$\Large\frac{∂^2f(x,y)}{∂x∂y}$$

After that, I wanted to find ways to evaluate the expression at a point with respect to x, (or y), and we moved away from the template feature. It migrated to the generic entry line forms because (in other cases) the template resulted in the entry line form, anyway: (f(x,y),x)'|{x=1,y=2}, or diff(f(x,y),x)|{x=1,y=2}

This generated the responses up to now. So, armed with "such is the limitation of the where command," "your syntax is ambiguous," because of not knowing when to apply (before/after) expression evaluation for a given point, etc., has resulted in my, mostly irrelevant, opinion of the status quo.

Ironically, I guess I hadn't put the last expression into the template, as you did, and it DOES the evaluation (as you discovered), in the manner in which, -I would think-, it should!

You just never know,( or try to remember), what you're going to get when the same expression entered in various ways, produces various results.

Every now and then, diff(f(x,y),x)|{x=1,y=2} ---> [0 0].
Most other times it triggers ["Invalid | Error: Bad Argument Value"].

In short, I think this is an area in which the software could be improved. I leave it to those empowered to effect change. Fortunately, in my case, I have time to try lots of things, hopefully finding a workable solution.

I enjoy the Prime, and learn along the way! That's a long way to explain the, "why," but that's it. The template key is normally my first go to.

-Dale-
11-08-2014, 06:17 PM
Post: #15
 lrdheat Senior Member Posts: 490 Joined: Feb 2014
RE: Entering partial derivatives?
This is my feeling as well (and similar thoughts in the graphing environment). The capabilities of the Prime is amazing. Parisse is a genius with XCAS and it's implementation. Parrish is a genius period.

DrD's point about how precise one has to be in how an entry is made in Prime is hugely important. For this amazing platform to succeed in the educational market and professional markets, it is critical that the primary mathematically equivalent means of expression be recognized by the Prime in Home, CAS, and graphing modes. The Prime should not be about finding a specific syntax amongst a variety of mathematically correct and equivalent entries.

I hope that as the Prime matures, this problem will be given a high priority. I fear that the market place has this expectation as a starting point. This may make it difficult to get school systems and the professional market that may have rejected the Prime for these reasons to reconsider...
11-08-2014, 08:47 PM (This post was last modified: 11-08-2014 08:48 PM by Gilles.)
Post: #16
 Gilles Member Posts: 162 Joined: Oct 2014
RE: Entering partial derivatives?
I agree with lrdheat. The prime's CAS is far more powerfull than the HP50G CAS for example, but for now the HP50G seems more homogenous in my opinion despite the lacks of his CAS.
Here is how to do for this with the 50G in RPL :

Note that the equation writer is unable to display the formula 2 and 4 on the stack in 'text book' (despite the fact that this syntax is well documented) but the way of the 50G to handle the paranthesis is more logical.
11-09-2014, 11:14 AM
Post: #17
 parisse Senior Member Posts: 1,027 Joined: Dec 2013
RE: Entering partial derivatives?
The problem with | is an evaluation order problem and in addition a different meaning for the same variable name. At some point, when you are using a CAS, you have to understand that.
If you are using the HP50G in RPN mode, you have full control of evaluation, so it's easier to understand evaluation. But interaction is harder, especially doing again one computation with some modifications.
My point of view is that it's an error to expect students to use a math software without a minimum of explanations of the math teacher : you can sometimes hide difficulties but they are still there and they will bite later.
And it's not a loss of time to explain evaluation when using a CAS, to the contrary, it should be part of the math course!
11-09-2014, 07:43 PM
Post: #18
 lrdheat Senior Member Posts: 490 Joined: Feb 2014
RE: Entering partial derivatives?
I agree with Parrise...CAS principles and limitations should be taught in math classes where CAS will be encountered. Ideally, everyone would have to be on the same CAS system. However, I strongly feel that a CAS be designed to accept primary mathematically equivalent entries such as n root, surd, and ^ to be accepted by users, especially your target market. This must also work across the entire platform...home,CAS, graphing.

That said, I'm a huge fan of Prime and it's team!
11-09-2014, 10:14 PM
Post: #19
 DrD Senior Member Posts: 1,095 Joined: Feb 2014
RE: Entering partial derivatives?
I'm not too far removed from the point of view expressed by Parisse, except that I've found that no technology (CAS or otherwise) is academically universal.

I have taken math classes where no calcs were allowed, others where computer software Mathcad, Maple, Mathematica, etc. was the recitation support tool, and one trig class (long ago) where my hp48 was coveted by the professor, as he would always ask me for hp 48 solutions to classroom examples, comparing them with his lecture notes.

The most recent class I attended, linear algebra, the prof used only a few mathcad examples, throughout the course. The material covered, if well understood, didn't require hardware. Sometimes problem sets were a little more extensive, but for those, the process of the solution was paramount, with accuracy almost a secondary concern. However, it was always stressed that subject matter was what lecture time was about, unless it was a class with a technology perspective foremost.

In my vocational life, of course, it was accuracy above all, and hp calcs of various models were always near to hand my entire career. Beginning with hp-25, I still use the hp-50g even after retirement!

Lately, I have much more "fun" with the Prime, though! Thanks to Parisse, and Han, I have learned a great deal, possibly the most important being great respect for their efforts, regardless of how fitting the results may be!

-Dale-
 « Next Oldest | Next Newest »

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