input issues
|
01-25-2021, 02:07 PM
(This post was last modified: 01-25-2021 02:12 PM by Amer7.)
Post: #1
|
|||
|
|||
input issues
Hi, I'm struggling with simple stuff
How do I actually ask for like: Input σ₁², and to store that number in like a1? I couldnt get to show symbols like σ₁², and when i ask to store it in a1 I have a syntax error ? I got it like this INPUT(A, "", "Input σ₁²"); INPUT(B, "", "Input σ₂²"); INPUT(C, "", "Input σ₁₂"); INPUT(F, "", "Input F(α,2,f)"); To work How do i make these display, one under other in input screen. |
|||
01-25-2021, 02:38 PM
(This post was last modified: 01-25-2021 02:42 PM by Didier Lachieze.)
Post: #2
|
|||
|
|||
RE: input issues
Here is a simple example:
Code: EXPORT Test() You can find σ in the Chars table (Shift Vars) under More>Greek and Coptic and the lower script 1 and upper script 2 in the same table under More>Subscript/Superscript For several variable inputs you can do: Code: EXPORT Test() Look in the HELP for more details about INPUT which has a lot of options to build complex input forms. You can access the HELP in several ways:
Note that these examples assume numeric inputs. If you want some inputs such as F(α,2,f) to be alphanumeric you need to specify the allowed types for each variable as described in the HELP. For example : Code: EXPORT Test() |
|||
01-25-2021, 03:13 PM
Post: #3
|
|||
|
|||
RE: input issues
(01-25-2021 02:38 PM)Didier Lachieze Wrote: Here is a simple example: I see I have to use LOCAL to to use variables like a1,b,c,d etc. What if i want to calculate like R = a+b+c and later PRINT ({R}); Do I have to define R in local or can i just go like this LOCAL a,b,c,d; INPUT({{a,[0]},{b,[0]},{c,[0]},{d,[2]}},"Input test", {"Input σ₁²","Input σ₂²","Input σ₁₂","Input F(α,2,f)"}); R= a+b+c; PRINT({R}); Will this work ? |
|||
01-25-2021, 03:47 PM
Post: #4
|
|||
|
|||
RE: input issues
(01-25-2021 03:13 PM)Amer7 Wrote: I see I have to use LOCAL to to use variables like a1,b,c,d etc. Try it??? --Bob Prosperi |
|||
01-25-2021, 03:53 PM
Post: #5
|
|||
|
|||
RE: input issues
(01-25-2021 03:47 PM)rprosperi Wrote:(01-25-2021 03:13 PM)Amer7 Wrote: I see I have to use LOCAL to to use variables like a1,b,c,d etc. It doesn't work, it seems that you have to define all of your variables at the start. This is not very practical. Is there a way that I can define new variables as I go. I'm not sure how many i will need. Now I see why most people decide for other brands of calculators that are even slower. You dont have to be a programmer to write a simple program. |
|||
01-25-2021, 04:03 PM
Post: #6
|
|||
|
|||
RE: input issues
(01-25-2021 03:53 PM)Amer7 Wrote: It doesn't work, it seems that you have to define all of your variables at the start. This is not very practical. Is there a way that I can define new variables as I go. I'm not sure how many i will need.It works if you write it: R:= a+b+c; The assignment syntax is := not = |
|||
01-25-2021, 04:38 PM
Post: #7
|
|||
|
|||
RE: input issues
Thanks it works, But if I write like Sx:= It throws an error. But okay.
How will make the program run the DMS command like if my Variable O= 0.12312412409321 to make it display in Degrees minutes seconds? |
|||
01-25-2021, 05:00 PM
Post: #8
|
|||
|
|||
RE: input issues
(01-25-2021 04:38 PM)Amer7 Wrote: Thanks it works, But if I write like Sx:= It throws an error. But okay.On the Prime only the variables A to Z are predefined global variables. Any other variable need to be defined before using it. (01-25-2021 04:38 PM)Amer7 Wrote: How will make the program run the DMS command like if my Variable O= 0.12312412409321The function for that on the Prime is →HMS, so you can do →HMS(O) |
|||
01-25-2021, 06:25 PM
(This post was last modified: 01-25-2021 06:31 PM by Amer7.)
Post: #9
|
|||
|
|||
RE: input issues
Can someone tell me why the program is returning a=0, b=0; when if we input
Input σ₁²: 2.45377 Input σ₂²: 0.000838 Input σ₁₂: −0.027712 Input F(α,2,f): 2.865 Code: EXPORT Elipsa1() This is a program for calculating Elliptical mistakes And can someone explain why when I try to add may variables to one LOCAL like LOCAL a,b,c,d,e,f,g,h,e,i2,r3,r2 I get a Syntax error ? And i have to like redistribute it to a new row? |
|||
01-25-2021, 07:13 PM
(This post was last modified: 01-25-2021 07:13 PM by C.Ret.)
Post: #10
|
|||
|
|||
RE: input issues
(01-25-2021 06:25 PM)Amer7 Wrote: And can someone explain why when I try to add many variables to one LOCAL like Put the cursor on LOCAL and press the [(?) Help] black button of your HP Prime and you will read that the number of local variable per LOCAL instruction is limited to height and no more. A 'Syntax Error' will point out this and stop after the 8th variable name in your code. |
|||
01-25-2021, 07:32 PM
(This post was last modified: 01-25-2021 07:33 PM by Didier Lachieze.)
Post: #11
|
|||
|
|||
RE: input issues
(01-25-2021 06:25 PM)Amer7 Wrote: Can someone tell me why the program is returning a=0, b=0; As I said previously assignments should be done with :=, not with =. So you should replace L=(, K=ABS... by L:=(, K:=ABS etc... When you write a=b the Prime is evaluating if a is equal to b, not assigning b to a. |
|||
01-25-2021, 07:36 PM
(This post was last modified: 01-25-2021 08:02 PM by C.Ret.)
Post: #12
|
|||
|
|||
RE: input issues
(01-25-2021 06:25 PM)Amer7 Wrote: Can someone tell me why the program is returning a=0, b=0; when if we input All the lines you entered in your code after LOCAL K,L; are erroneous. The equal sign you use is reserved for equation, to affect value to variables, the correct syntax is to use the affectation sign ':=' or the store sign '▶ ' For example: a:=2; 3▶b; An expression like a=3; is evaluated as an equation and the returned value of this evaluation is lost since there no affectation nor print or return order. That why you a and b variable stay at 0, they are never the subject to any affectation or storing. Here, as an example, is the way I would have compose your application: Code: EXPORT Elipsa1() Since no LOCAL instruction were used for K l P O U, values are store in the corresponding user real variable you can acces with [Vars]/HOME/Real/... |
|||
01-25-2021, 07:42 PM
Post: #13
|
|||
|
|||
RE: input issues
(01-25-2021 07:32 PM)Didier Lachieze Wrote:(01-25-2021 06:25 PM)Amer7 Wrote: Can someone tell me why the program is returning a=0, b=0; aaaaa, I understand now, i thought that local was the same like in java int a,b,c,d ; and when i say int a=0; it assigns 0 to a. Now I understand that I can say: Local a1,a2,a3, a1:=a2+a3; Thanks, it's getting better. |
|||
01-25-2021, 08:00 PM
(This post was last modified: 01-25-2021 08:15 PM by Amer7.)
Post: #14
|
|||
|
|||
RE: input issues
Now i'm facing another issue
Code: IF O<0 THEN but when I use +π // pi it doesn't want to add it to O Btw: Finished and working, thanks to all of your help. ( Program za racunanje Gresaka elipse HP prime) I hope it's not hard to make it launch like an App. |
|||
01-26-2021, 03:01 PM
(This post was last modified: 01-26-2021 04:29 PM by Amer7.)
Post: #15
|
|||
|
|||
RE: input issues
How can I make a Matrix like nxm size and then fill the places with my own variables, then to operations between 2 Matrices and print them out. I went with Help but when I try it like this;
Code: LOCAL A1,A2; /// A1=B, A2=Cl It throws an error in this field "→" Is there another symbol that i can use in notepad when writing programs? Will it function as a matrix if I write it like this: Code: LOCAL A1,A2; /// A1=B, A2=Cl It seems it works also you can print by row PRINT=(""+A1(1)); - Prints first row of matrice A1 EDIT: How will I extract value from matrix A2 that is a product of A2:=A1*A2 ? I need values of A2 [a11,a12], [a21,22] etc... |
|||
01-26-2021, 04:34 PM
(This post was last modified: 01-26-2021 04:35 PM by toml_12953.)
Post: #16
|
|||
|
|||
RE: input issues
(01-25-2021 07:42 PM)Amer7 Wrote:(01-25-2021 07:32 PM)Didier Lachieze Wrote: As I said previously assignments should be done with :=, not with =. You can also combine LOCAL with assignment LOCAL bx:=7, c:=12; Tom L Cui bono? |
|||
01-27-2021, 11:45 AM
(This post was last modified: 01-27-2021 01:13 PM by Amer7.)
Post: #17
|
|||
|
|||
RE: input issues
How do I enable an angle value in Deg, min, sec to be inputted into a program?
When I use ; Code: LOCAL a,d,sa,sd; Also I'm having an issue printing Matrices row by row for easier viewing. Lets supose my matrix is 2x2 = B PRINT (B(1)); - should print first row PRINT (B(2)); - should print second row but i get a Sytax eror. Code: EXPORT Direkcioni() |
|||
01-27-2021, 01:59 PM
(This post was last modified: 01-27-2021 02:01 PM by Didier Lachieze.)
Post: #18
|
|||
|
|||
RE: input issues
(01-27-2021 11:45 AM)Amer7 Wrote: How do I enable an angle value in Deg, min, sec to be inputted into a program? To enter an angle value in Deg, min, sec you need to press [Shift] [a b/c] after each value, for example to enter 25 deg 46 min 7 sec press: 25 [Shift][a b/c] 46 [Shift][a b/c] 7 [Shift][a b/c] and you'll get: 25°46′7″ (01-27-2021 11:45 AM)Amer7 Wrote: Also I'm having an issue printing Matrices row by row for easier viewing. You cannot use B or C as global matrix variables, these are defined as global real variables as you can check with Vars>Home>Reals. If you want a global matrix variable you can use M0...M9 (available in Vars>Home>Matrix), or you can use a local variable such as the Cx variable in your program. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)