HP PRIME - Crash with "REPLACE" cmd ?



#2

Hi,

These code sometime crash the emulator sometime not...

If in the input saisie() I place : "1/((1+X)*(1+10*X))"

The REPLACE command in saisie():

REPLACE("1/((1+X)*(1+10*X))","X","(i*X)") works great !

but at the next stage in bode() :

REPLACE("1/((1+(i*X))*(1+10*(i*X)))","X","ALOG(X)")

The emulator crash !

If I place a basic transfert function on input promp "1/(1+X)" every thing go well...

Who have an idea ?

Another question if someone can help... This program can be run from any APP but in the end we are left either in black or bode APP.

Will he has a way of storing what is the active applet at launch ? In order to activate this app at the end.

Assumes that applets "Bode" and "Black" were created derived from function app for Bode and parametric app for Black. Here is my actuel code... The manipulation of symbolic expressions inside a program is very confusing for me.

saisie();
bode();
black();
EXPORT FT;

// main program which ask first for transfer function and then for type of plots
EXPORT SLDI()

BEGIN
LOCAL choix;

FT:="";
saisie();
RECT();
CHOOSE(choix,"Quel tracé ?", "BODE", "BLACK");
CASE
IF choix==1 THEN bode(); END;
IF choix==2 THEN black(); END;
END;
END;

// Ask for a transfert function but in a string form ! double quotes !
saisie()
BEGIN
input(FT,"Entrez la fonction de transfert","FT(X)=","Utilisation des guillemets ! ");
FT:=REPLACE(FT,"X","(i*X)");
END;

// Creation of module and agr functions then start "Bode" APP
bode()
BEGIN
LOCAL fc:=0, FF:="";
FF:=REPLACE(FT,"X","ALOG(X)");
Bode.F1:="20*LOG(ABS(" + FF + "))";
Bode.F2:="ARG("+ FF + ")";
STARTAPP("Bode");
UNCHECK(0);
UNCHECK(2);
CHECK(1);
//Look for 3dB drop pulsation and look around
fc:=ROOT(ABS(Bode.F1(-1000)-Bode.F1(X))-3,0);
Bode.Xmin:=fc-1.5;
Bode.Xmax:=fc+1.5;
STARTVIEW(10);
END;

black()
BEGIN
LOCAL fc:=0, FF:="";
FF:=REPLACE(FT,"X","T");
Black.X1:="ARG("+FF+")";
Black.Y1:="20*LOG(ABS(" + FF + "))";
STARTAPP("Black");
CHECK(1);
//looking for 3dB drop pulsation
fc:=ROOT(ABS(Black.Y1(0)-Black.Y1(X))-3,1);
Black.Tmin:=0;
Black.Tmax:=10*fc;
STARTVIEW(10);
END;

Edited: 22 Oct 2013, 6:36 a.m.


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP Prime... NOT meant to replace HP48,49,50 ? Chris Pem10 21 1,951 11-18-2013, 03:30 PM
Last Post: Chris Smith
  Another Prime crash Stefan Dröge (Germany) 2 465 11-06-2013, 01:48 PM
Last Post: Stefan Dröge (Germany)
  HP Prime Crash bluesun08 5 712 11-04-2013, 05:16 PM
Last Post: Michael de Estrada
  HPprime CRASH and mysterious clepsydra indicator fabrice48 3 613 10-30-2013, 03:17 PM
Last Post: cyrille de Brébisson
  What is the best way to replace an older wp34s overlay with a new one? Michael O. Tjebben 3 564 07-11-2012, 09:56 AM
Last Post: Michael O. Tjebben
  34s builds 1249 and 1250 crash on real hardware Gene Wright 16 1,372 07-19-2011, 07:28 AM
Last Post: Marcus von Cube, Germany
  New Crash Recovery Function for NoV-64. Diego Diaz 6 719 03-02-2011, 12:43 PM
Last Post: Diego Diaz
  Replace HP-67 head kubla 9 851 05-12-2010, 04:10 PM
Last Post: kubla
  HP41 faster after crash and reset? Timo 2 456 03-15-2010, 01:40 PM
Last Post: Timo
  OT-- for Diego Diaz. Madrid - Las Palmas plane crash JoseL 3 479 08-25-2008, 03:19 AM
Last Post: JoseL

Forum Jump: