# HP Forums

You're currently viewing a stripped down version of our content. View the full version with proper formatting.
[EDIT] The solution was provided by Tim here: http://www.hpmuseum.org/forum/thread-6095.html

Hi,

I would like first to thank the whole team for this great work update.

It does not bother me to have to change the line of code if the current or future change brings simplifications ...

For exemple : Here is a program that no longer work...

Based on function app. The complete code is at the end of this post. It is a Bode plot program...

In the symb view place a transfert function in term of X for exemple 1/(1+X) and then press plot view key... The Bode gain plot works as before but the phase and step response fail...

I try to debug these function:

Code:
``` export calcule_phases() BEGIN local k,j,r,retard; local f, a,num,denomi,cnum,cdenom,phi;   for k from 1 to length(liste_fonctions) do      if ISCHECK(k MOD 10) AND recalc_phase(k) then        f:=replace(string(liste_fonctions(k)),"X","x");        r:=instring(f,"e");        if r then                 retard:=right(f,size(f)-1-r);                 f:=left(f,r-2);        end;               a:=CAS.froot(f,"x");        num:=string(CAS.numer(f));        denomi:=string(CAS.denom(f));        cnum:=CAS.lcoeff(num,"x");        cdenom:=CAS.lcoeff(denomi,"x");        phi:=string(ARG(cnum/cdenom));         FOR j FROM 1 TO length(a) STEP 2 DO            IF RE(a(j))<>0 THEN                  phi:=phi+"+"+a(j+1)+"*ATAN(("+IM(a(j))+"-X)/("+RE(a(j))+"))";            ELSE IF a(j)==0 THEN                     phi:=phi+"+"+a(j+1)+"*90";                 ELSE phi:=phi+"+"+a(j+1)+"*90*SIGN(X-"+IM(a(j))+")";                 END;               END; //fin IF        END; //fin FOR j      if r then phi:=phi+"+"+replace(retard,"x","X") end;      phi:="'"+replace(phi,"X","ALOG(X)")+"'";     liste_phases(k):=EXPR(phi);     recalc_phase(k):=0;    end; //fin if ischek  end; //fin for k END;```

After these line
Code:
``` f:=replace(string(liste_fonctions(k)),"X","x");```
f var contain the string "1/(1+x)"

The following lines do not work anymore..

Code:
``` a:=CAS.froot(f,"x");        num:=string(CAS.numer(f));        denomi:=string(CAS.denom(f));        cnum:=CAS.lcoeff(num,"x");        cdenom:=CAS.lcoeff(denomi,"x");```

In the HOME view i make some tests:

denom("1/(1+x)") => 1+x OK (no more CAS. prefixe when called from the catalog ?)

but if I first create a var with the same string f:="1/(1+x)"
then

denom(f) => 1 (wrong)...

May I have some help ?

I must say that these code pass the check test in the program editor when the digital grouping is set to the default dot but failled with the coma as digital grouping setting... What about the pragma on these new firmware ?

Thank's a lot for your help.

Didier

Here is the complete code of my Bode program

Code:
``` #pragma mode( separator(.,;) integer(h64) ) copie_les_fonctions(); replace_les_fonctions(); place_les_modules(); place_les_phases(); place_les_rep_temp(); calcule_modules(); calcule_phases(); calcule_rep_temp(); Symb(); export liste_fonctions:=MAKELIST(0,X,1,10); export liste_modules:={}; export liste_phases:={}; export liste_rep_temp:={}; recalc_module:=MAKELIST(1,X,1,10); recalc_phase:=MAKELIST(1,X,1,10); recalc_temp:=MAKELIST(1,X,1,10); modif:=0; export copie_les_fonctions() begin   local k;   for k from 1 to 10 do     if ISCHECK(k MOD 10) then       if EVAL(EXPR("F"+k MOD 10)≠liste_fonctions(k)) then         IFERR liste_fonctions(k):=EXPR("F"+k MOD 10) then MSGBOX("Erreur de copie sur F"+k MOD 10) end;         recalc_module(k):=1;         recalc_phase(k):=1;         recalc_temp(k):=1;        end;      end;   end;   modif:=0; end; export replace_les_fonctions() begin   local k;   for k from 1 to length(liste_fonctions) do     if ISCHECK(k MOD 10) then         expr("F"+k MOD 10+":=liste_fonctions("+k+")");     end;   end; end; export place_les_modules() begin   local k;   for k from 1 to length(liste_modules) do      if ISCHECK(k MOD 10) then         expr("F"+k MOD 10+":=liste_modules("+k+")");      end;   end; end; export place_les_phases() begin   local k;   for k from 1 to length(liste_phases) do      if ISCHECK(k MOD 10) then        expr("F"+k MOD 10+":=liste_phases("+k+")");      end;   end; end; export place_les_rep_temp() begin   local k;   for k from 1 to length(liste_rep_temp) do      if ISCHECK(k MOD 10) then        expr("F"+k MOD 10+":=liste_rep_temp("+k+")");      end;   end; end; export calcule_modules() begin   local k;     for k from 1 to length(liste_fonctions) do        if ISCHECK(k MOD 10) AND recalc_module(k) then          liste_modules(k):=20*LOG(ABS(subst(liste_fonctions(k),'X','i*ALOG(X)')));          recalc_module(k):=0;         end;     end; end; export calcule_phases() BEGIN local k,j,r,retard; local f, a,num,denomi,cnum,cdenom,phi;   for k from 1 to length(liste_fonctions) do      if ISCHECK(k MOD 10) AND recalc_phase(k) then        f:=replace(string(liste_fonctions(k)),"X","x");        r:=instring(f,"e");        if r then                 retard:=right(f,size(f)-1-r);                 f:=left(f,r-2);        end;               a:=CAS.froot(f,"x");        num:=string(CAS.numer(f));        denomi:=string(CAS.denom(f));        cnum:=CAS.lcoeff(num,"x");        cdenom:=CAS.lcoeff(denomi,"x");        phi:=string(ARG(cnum/cdenom));         FOR j FROM 1 TO length(a) STEP 2 DO            IF RE(a(j))<>0 THEN                  phi:=phi+"+"+a(j+1)+"*ATAN(("+IM(a(j))+"-X)/("+RE(a(j))+"))";            ELSE IF a(j)==0 THEN                     phi:=phi+"+"+a(j+1)+"*90";                 ELSE phi:=phi+"+"+a(j+1)+"*90*SIGN(X-"+IM(a(j))+")";                 END;               END; //fin IF        END; //fin FOR j      if r then phi:=phi+"+"+replace(retard,"x","X") end;      phi:="'"+replace(phi,"X","ALOG(X)")+"'";     liste_phases(k):=EXPR(phi);     recalc_phase(k):=0;    end; //fin if ischek  end; //fin for k END; export calcule_rep_temp() begin    local f, k;      for k from 1 to length(liste_fonctions) do         if ISCHECK(k MOD 10) AND recalc_temp(k) then           f:=REPLACE(STRING(liste_fonctions(k)),"X","x");           f:=f+"*1/x,x,x";           f:="'("+REPLACE(STRING(CAS.ilaplace(f)),"x","X")+")*PIECEWISE(X<0,0,X≥0,1)'";           IF instring(f,"ilaplace")              THEN MSGBOX("Problème avec F"+k MOD 10); CONTINUE;             ELSE liste_rep_temp(k):=EXPR(f);           END;           recalc_temp(k):=0;         end;      end; end; Symb() begin   modif:=1;   replace_les_fonctions;   STARTVIEW(0,1); end; Plot() begin   local choix;   if modif then copie_les_fonctions end;   CHOOSE(choix,"Choisissez un type de tracé",{"Module","phase","réponse indicielle"});   CASE    IF choix==1 THEN calcule_modules; place_les_modules;Ytick:=20 END;    IF choix==2 THEN calcule_phases; place_les_phases;Ytick:=45 END;    IF choix==3 THEN calcule_rep_temp; place_les_rep_temp; Xmin:=−0.2 END;    //DEFAULT   END;   STARTVIEW(1,1); end; START() begin  modif:=1;  replace_les_fonctions;  STARTVIEW(0,1); end;```
Another program doesn't work on new released firmware is the 3D graphing plotter... it doesn't plot any graph...
(04-21-2016 08:58 PM)Anderson Costa Wrote: [ -> ]Another program doesn't work on new released firmware is the 3D graphing plotter... it doesn't plot any graph...

Graph 3D by Han?
here it seems to works and plot graphs...
(04-21-2016 09:08 PM)salvomic Wrote: [ -> ]
(04-21-2016 08:58 PM)Anderson Costa Wrote: [ -> ]Another program doesn't work on new released firmware is the 3D graphing plotter... it doesn't plot any graph...

Graph 3D by Han?
here it seems to works and plot graphs...
Yes... I can't plot 3D graphs on my Virtual Calculator... I typed the function and pressed Plot, after plotting it give me an "Error: invalid Object" pop up. And the graph doesn't appear.
(04-21-2016 09:08 PM)salvomic Wrote: [ -> ]
(04-21-2016 08:58 PM)Anderson Costa Wrote: [ -> ]Another program doesn't work on new released firmware is the 3D graphing plotter... it doesn't plot any graph...

Graph 3D by Han?
here it seems to works and plot graphs...

3D Graph by Han works flawlessly for me too...
(04-21-2016 09:12 PM)Anderson Costa Wrote: [ -> ]Yes... I can't plot 3D graphs on my Virtual Calculator... I typed the function and pressed Plot, after plotting it give me an "Error: invalid Object" pop up. And the graph doesn't appear.

I'm trying something like
V3 X^2-Y^2 and it plots
In plot setup I have:
Min -10 Ymin -10 Zmin -10, Xmax 10 Ymax 10 Zmax 10
Tape surface Zoom 8.64
Trasparent, show grid show box on, others off

I think to have version 2.32
I cannot run Graph3D. It says "Invalid Objet".
(04-21-2016 09:14 PM)mandresve Wrote: [ -> ]
(04-21-2016 09:08 PM)salvomic Wrote: [ -> ]Graph 3D by Han?
here it seems to works and plot graphs...

3D Graph by Han works flawlessly for me too...

;-)
I still have the same error. I´ve just checked that last version is 2.422. What am I doing bad?
(04-21-2016 09:39 PM)akmon Wrote: [ -> ]I still have the same error. I´ve just checked that last version is 2.422. What am I doing bad?

also with 2.422 it runs well here.
The main thread is on http://www.hpmuseum.org/forum/thread-95.html if it could be useful to you...

Added: Han wrote: «First ensure that the app is properly installed. To check, press [Shift][Plot] to see if you can adjust the settings for Graph3D. If you do not see the proper settings then the application is likely not installed correctly. If you are in RPN mode, switch to algebraic mode. You may even want to test the installation on the virtual calculator. If it works on the emulator, then you can simply transfer the app from the emulator to the actual calculator.»

Salvo
There is an error with "Hmin" "Hmax" variables in a program with the new firmware
(04-22-2016 05:11 AM)Mic Wrote: [ -> ]There is an error with "Hmin" "Hmax" variables in a program with the new firmware

Explain?

Those are variables in stat1 and inference. If either of those are open you will (correctly) conflict.
There was an error because Hmin and Hmax were not created by default.

I have also a problem with my DELTA program. Apparently, name "DELTA" is not accepted for an unknown reason ?
(04-22-2016 10:55 AM)Mic Wrote: [ -> ]There was an error because Hmin and Hmax were not created by default.

I have also a problem with my DELTA program. Apparently, name "DELTA" is not accepted for an unknown reason ?

Hmin and Hmax were incorrectly flagged as "global" variables previously. They are actually plot setup values in the stat1var app, and inference app. They are no longer flagged as global and hence the error. You were actually storing and modifying the plot setup values in one of the apps.

DELTA is a command in the quadratic explorer. Do you have it open?
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :