HP Forums
apply in the program [Solved] - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: apply in the program [Solved] (/thread-5391.html)



apply in the program [Solved] - jrozsas - 12-22-2015 05:03 PM

The function apply(x-> x ^ 3, [1,2,3]) works when writing alone.
[Image: Bi88k.jpg] [Image: 2s8ew.jpg]
In a program can not display the result. Can you help me?
[Image: XeH4R.jpg]
EXPORT meusymp2()
BEGIN
LOCAL x,B,V,G,L;
INPUT(B,"DIGITE B");
INPUT(V,"DIGITE X");
INPUT(G,"DIGITE G");
L:=CAS.apply(x(x*3),[[B],[V],[G]]);
RECT;
TEXTOUT_P(L,120,30,2,#000000h,190,#99FF00h);
FREEZE;
END;



RE: apply in the program - DrD - 12-22-2015 06:04 PM

Here is a (simplified) structure that may be of some help(?)

Code:

EXPORT meusymp2()
BEGIN
  LOCAL x;                                         //  avoiding reserved variable issues
  RECT;

  M0:=[1,2,3];                                     //  Default values
  M1:=CAS.apply("x->x^3",M0);                      //  Uses matrix reserved variables
  
  TEXTOUT_P(M1,120,30,2,#000000h,190,#99FF00h);
  wait;                                            //  replaces FREEZE;

END;



RE: apply in the program - jrozsas - 12-22-2015 06:17 PM

(12-22-2015 06:04 PM)DrD Wrote:  Here is a (simplified) structure that may be of some help(?)

Code:

EXPORT meusymp2()
BEGIN
  LOCAL x;                                         //  avoiding reserved variable issues
  RECT;

  M0:=[1,2,3];                                     //  Default values
  M1:=CAS.apply("x->x^3",M0);                      //  Uses matrix reserved variables
  
  TEXTOUT_P(M1,120,30,2,#000000h,190,#99FF00h);
  wait;                                            //  replaces FREEZE;

END;

Thanks DrD!
see :
EXPORT meusymp2()
BEGIN
LOCAL x,B,V,G,L;
INPUT(B,"DIGITE B");
INPUT(V,"DIGITE V");
INPUT(G,"DIGITE G");
M0:=[B,V,G];
M1:=CAS.apply("x->x^3",M0);
RECT;
TEXTOUT_P(M1,120,30,2,#000000h,190,#99FF00h);
WAIT;
END;
[Image: kEduk.jpg]