program gives different answer in Home and CAS
|
12-05-2021, 10:27 AM
(This post was last modified: 12-05-2021 11:14 AM by C.Ret.)
Post: #5
|
|||
|
|||
RE: program gives different answer in Home and CAS
(12-04-2021 06:19 PM)roadrunner Wrote: Can anyone tell me what is wrong? The main reason of the two different environnements on the HP Prime is due to the way that expression are interpreted and variable are evaluated. Since the last fimware update, a subtile variation has appear on the way that global HOME variables are interpretated into the CAS mode. This subtitle varaition in the evaluation process made your code unappropriate for the rigourus CAS mode interpretaion. Especially, the way you define the intermédiate and local f function is valid on in HOME evaluation process since any reference to global X variable is consider (in differentiations by diff instruction only). In the CAS mode, a more rigourus interpratation is made, no special shortcut exist for a specific variable and the way you have define f, appears in CAS mode to be a constant function. Any differentiation of constant lead irremediately to zero. Try this modifed version of your code: EXPORT TANGENT() BEGIN "X^2-2*X+3"▶F1; RETURN diff(F1(X),X,1); END; In this version, the argument to be use for the differentiation is explicit into the arguments of the diff instruction as exactly the same object is given in function definition and indication of the control variable. In your version of the code, the control word indicated in the local 'f' variable unmatched the control variable. Only the HOME mode interpretation hallow a vague reference to an X as the default variable for function evaluation, plotting, integrating or differentiating... In CAS mode, ince the object you indicate doesn't appears in the function definition, it is assume that the function doesn't depend of this variable; differentiation over an independent variable is equivalent to differentiate a constant function. That why this code will run as well : EXPORT TANGENT() BEGIN "X^2-2*X+3"▶F1; // X is mandatory to insert the correct definition in the F1 slot of the graph Function Application RETURN diff(F1(Y),Y,1); // Explicit indication of the control variable in function definition and arguments of the CAS.diff command. Exact match mandatory. END; |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
program gives different answer in Home and CAS - roadrunner - 12-04-2021, 06:19 PM
RE: program gives different answer in Home and CAS - rprosperi - 12-05-2021, 02:02 AM
RE: program gives different answer in Home and CAS - Liamtoh Resu - 12-05-2021, 04:55 AM
RE: program gives different answer in Home and CAS - SammysHP - 12-05-2021, 07:51 AM
RE: program gives different answer in Home and CAS - C.Ret - 12-05-2021 10:27 AM
RE: program gives different answer in Home and CAS - roadrunner - 12-05-2021, 12:25 PM
|
User(s) browsing this thread: 1 Guest(s)