
Discussion BoardsOpen MenuDiscussion Boards Open Menu

BlogsOpen Menu

Beware of fake HP SupportOpen MenuBeware of fake HP Support Open MenuBe alert for scammers who may be posing as HP representatives and only call numbers from people who have a label next to their screen name. If you think you have received a fake HP Support message, please report it to us by clicking on the blue “Report Inappropriate Content” button above the message. Thank you!
 HP Support Forum Home
 >
 Tablets
 >
 Calculators
 >
 Re: Storing to Geometry App variables (HP Prime)
HP Support Forums
Join in the conversation.
 Subscribe
 Mark Topic as New
 Mark Topic as Read
 Float this Topic to the Top
 Bookmark
 Subscribe
 Printer Friendly Page
Storing to Geometry App variables (HP Prime)
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Highlight
 Email to a Friend
 Report Inappropriate Content
12052013 06:25 AM
I am trying to write a little program to make a plot of a vector field. I want to create the vectors in the Geometry App variables (GA, GB, ...)
I tried around a little bit, but it seems that I can't store anything to these variables. For example if I do the following in the CAS view the variable GA remains unchanged in the Geometry symbolic view:
GA:=vector(1+i)
I also tried to assign the variable from within program code in the Geometry App program. This does not work either.
Any ideas?
 Stefan
Re: Storing to Geometry App variables (HP Prime)
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Highlight
 Email to a Friend
 Report Inappropriate Content
12062013 12:04 AM
Hello,
The short answer is that you can not....
The geometry variables are more like program locals, not variables like the others.
Basicaly, what happends is that the geometry app maintains and saves a list of instructions of the form:
GA:= graphic instr 1
GB:= graphic instr 2
...
GZ:= graphic instr 26
and then 'executes' the program to create CAS objects that descibes the drawing of each elements.
the G?:= is nessecary to allow later reuse of the resulting object
Each time something changes, the whole program is reexecuted and all the variables will be overriden...
so, to do what you wanted, you would need to change the geometry program. Unfortunately, there is no variable that represents it at this point in time.
sorry.
cyrille
Re: Storing to Geometry App variables (HP Prime)
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Highlight
 Email to a Friend
 Report Inappropriate Content
12072013 10:17 AM
That is sad.
Now I am working my way around it. I wrote a litte program to draw vectors:
LOCAL drw_vect(XY,LOC) //XY is a complex number giving the compponents of the vector. LOC is a complex number, giving the location on the screen where the tail of the vector starts. BEGIN LOCAL X, Y, LOCX, LOCY, TLS, TWS; LOCAL T1X, T1Y, T2X, T2Y; // Points to draw the arrow tip. TLS:=0.85; // Tip length scaling factor. TWS:=0.05; // Tip width scaling factor X:=RE(XY); // X component of the vector Y:=IM(XY); // Y component of the vector LOCX:=RE(LOC); // Location X component LOCY:=IM(LOC); // Location Y component // calculate coordinates for arrow tip T1X:=LOCX+TLS*XTWS*Y; T1Y:=LOCY+TLS*Y+TWS*X; T2X:=LOCX+TLS*X+TWS*Y; T2Y:=LOCY+TLS*YTWS*X; LINE(LOCX,LOCY,LOCX+X,LOCY+Y,1); //Draw body of the arrow TRIANGLE(T1X, T1Y, T2X, T2Y,LOCX+X, LOCY+Y,0); // draw tip pf the arrow END;
Stefan
Re: Storing to Geometry App variables (HP Prime)
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Highlight
 Email to a Friend
 Report Inappropriate Content
12072013 07:31 PM
Hi, StefanD !
Try the plotfield command.
or
Re: Storing to Geometry App variables (HP Prime)
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Highlight
 Email to a Friend
 Report Inappropriate Content
12072013 11:14 PM
Yes, this is probably the best way to accomplish what you are wanting at the moment.
However, the CAS variables are not going to follow along with your geometry app copy, so that might be problematic for the moment.
TW
Although I work for the HP calculator group, the views and opinions I post here are my own.
Re: Storing to Geometry App variables (HP Prime)
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Highlight
 Email to a Friend
 Report Inappropriate Content
12092013 10:29 AM
I think the plotfield command is not quite what I want. I would like to enter a R^2 > R^2 function. In other words a function that depends on x and y and gives a 2D vector as output.
That is what I hacked together so far. It is still all hard coded, no fancy menus to enter the function or the limits in which the function is evaluated. I also have some hard coded scaling factors in the code because I don't know how I can adjust the zoom level. But I think you get the idea:
LOCAL drw_vect(XY,LOC) //XY is a complex number giving the compponents of the vector. LOC is a complex number, giving the location on the screen where the tail of the vector starts. BEGIN LOCAL X, Y, LOCX, LOCY, TLS, TWS; LOCAL T1X, T1Y, T2X, T2Y; // Points to draw the arrow tip. TLS:=0.8; // Tip length scaling factor. TWS:=0.05; // Tip width scaling factor X:=RE(XY); // X component of the vector Y:=IM(XY); // Y component of the vector LOCX:=RE(LOC); // Location X component LOCY:=IM(LOC); // Location Y component // calculate coordinates for arrow tip T1X:=LOCX+TLS*XTWS*Y; T1Y:=LOCY+TLS*Y+TWS*X; T2X:=LOCX+TLS*X+TWS*Y; T2Y:=LOCY+TLS*YTWS*X; LINE(LOCX,LOCY,LOCX+X,LOCY+Y,1); //Draw body of the arrow TRIANGLE(T1X, T1Y, T2X, T2Y,LOCX+X, LOCY+Y,0); // draw tip pf the arrow //LINE(T1X,T1Y,LOCX+X,LOCY+Y,1); END; LOCAL mygrid(XMIN, XMAX, YMIN, YMAX, grid) BEGIN LOCAL IX, IY; FOR IX FROM XMIN TO XMAX STEP grid DO FOR IY FROM YMIN TO YMAX STEP grid DO ARC(IX,IY,1); END; END; ARC(0,0,1,#0000FF); END; LOCAL myfunc(x,y) BEGIN RETURN sin(pi/2*y)i*sin(pi/2*x); END; EXPORT draw1() BEGIN LOCAL JX, JY, DX, DY, grid; DX:=25; DY:=25; grid := 2; RECT(); T:=TICKS; FOR JX FROM DX TO DX STEP grid DO FOR JY FROM DY TO DY STEP grid DO drw_vect(10*myfunc(JX/50,JY/50),JX+i*JY); END; END; FREEZE; T:=TICKST; END;
The output:
Can I somehow make use of an Apps plot view to zoom in the plot? I already noticed that my program uses the zoom factor of the "Function" app which is running. I would like to draw into the Plot view of the Function app. But my attempts to just create copy of the "Function" App and add a VIEW "Plot", Plot() line in the code did not work. I guess I can not overwrite the built in App functions. Or I did it wrong.
I don't want to reinvent the wheel and write code to provide interactive zooming and so on if this is already available in an App. Hence I am grateful for some hints.
Re: Storing to Geometry App variables (HP Prime)
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Highlight
 Email to a Friend
 Report Inappropriate Content
12092013 07:12 PM
Hi!
:)
The output:
Re: Storing to Geometry App variables (HP Prime)
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Highlight
 Email to a Friend
 Report Inappropriate Content
12102013 08:31 AM
Ok, but this does not give you the information about the magnitude, but only the angle (and the angle is ambigous because there are now arrow tip indicators). Although it looks like there are different lengths of the slope indicators.
Additionally, for unknown reasons, this works for me only in the emulator but not on the hardware calculator. I already tried to fix it by resetting (Format C) the calculator and double checked all settings. The Firmware is v5447 (both, in emulator and hardware). But it did not help. See below a screenshot of the hardware calculator output:
Did you try your solution on a hardware calc or in the emulator?
Thank you!
Re: Storing to Geometry App variables (HP Prime)
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Highlight
 Email to a Friend
 Report Inappropriate Content
12102013 07:40 PM
Hi!
I did try my solution on a hardware calc and in the emulator with option 'normalize'.
plotfield(ex,[x = (Xmin .. Xmax),y = (Ymin .. Ymax)],'normalize')
StefanD wrote:Ok, but this does not give you the information about the magnitude, but only the angle (and the angle is ambigous because there are now arrow tip indicators). Although it looks like there are different lengths of the slope indicators.
Ok, try my version of the prog:
EXPORT vecfield_2(func)
BEGIN
func▶V1;
LOCAL A,B,X,Y,H,TWS;
TWS:=0.12;
RECT();
H:=(XmaxXmin)/11;
FOR Y FROM Ymin TO Ymax STEP H DO
FOR X FROM Xmin TO Xmax STEP H DO
A:=X+RE(V1(X,Y))*TWS;
B:=Y+IM(V1(X,Y))*TWS;
LINE(X,Y,A,B);
ARC(A,B,1);
END;
END;
FREEZE;
END;
Example. f(X,Y)=sin(π/2*Y)i*sin(π/2*X).
1) The Function app must be a current app (Xmin=Ymin=0.5; Xmax=Ymax=0.5).
2) Type vecfield_2('sin(π/2*Y)i*sin(π/2*X)') and press Enter.
The output:
Re: Making an App (was: Storing to Geometry App variables (HP Prime))
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Highlight
 Email to a Friend
 Report Inappropriate Content
12122013 09:11 AM
Ok, so we both managed to draw arrows. Now how to go on from here?
Since I don't see any possibility to modify the preinstalled Function or Geometry apps, I guess I have to write my own App. If I am wrong and somebody could tell me how to modify the preinstalled apps please tell me.
So a couple of questions have come up on my side:
1. What makes an App different from a Program?
2. How do I make a program that appears in the Apps overview (NOT starting with a copy of an existing App)
3. How do I make advanced input forms? Take for example the "Symb" input of the function app. How is that done with the existing commands? Did they draw this all by pixel on off commands? I can't imagine that
4. Are the preinstalled apps written in HPPL? or did they use native code?
Stefan