Reading one or two arguments
|
03-14-2021, 11:54 AM
(This post was last modified: 03-14-2021 03:11 PM by essen.)
Post: #6
|
|||
|
|||
RE: Reading one or two arguments
(03-13-2021 04:18 PM)HillyBoy Wrote: Hi, I read your objective as you wants to read the args standing on the calculator window from your program. This is possible with the Ans(N). Both in calculator settings - either in RPL or Algebraic mode. It is the CAS mode, it doesn't function. But you can not have them as arguments to your program. That is: ThisPrg(Ans(1),Ans(2)) //This is not allowed BEGIN ... END; Above not allowed But you can do: ThisPrg() BEGIN LOCAL a1,a2; a1:=Ans(1); a2:=Ans(2); //now do operations on a1 and a2 and return the result to the window. END; Try below with your calculator in Algebraic mode setting and in HOME mode: Put this on the window in same order as here. You will get arg and modulus displayed in the window ( polar coor): 5.7735026919 10.0 and run MyPrg() from the command line: MyPrg() BEGIN LOCAL a1,a2, r1,ang1,plar; a1:=Ans(1); a2:=Ans(2); r1:=(a1^2+a2^2)^0.5; Z1:=(a1,a2); //the complex ang1:=ARG(Z1); plar:=polar_coordinates(Z1); //RETURN(plar); RETURN(EXPR("["+r1+,","+ang1+"]")); //calc. by you own END; Of course, you can have args in MyPrg(), but just not Ans(N), but inside as shown is OK. I have an addition. You should be aware of this: When using the ARG() function with the calculator in CAS mode (in this case you don't, as Ans() does not function in this mode). But in other programs in possibly CAS mode running, the angles will always come out in radians, even the angle mode are set to degrees in both HOME and CAS. Therefore, if you calculates angles in CAS modes and want the result out in degrees, then use the angle() function. See the help how that one function.: It uses 3 points angle((a1,b1),(a2,b2),(a3,b3)). It measure both the angle and its direction as well as the quadrant its laying in. Measuring an angle in a normal right angled (x,y) coordinate-system, the first 2 points should always be set the same as (0,1, ...), because, 0 stands for the coordinate-systems origon (0,0), and the second point 1 stands for the point laying on the x-axes (1,0). Shorthand notations for these 2 first points are being accepted. The angle are measured like this - You're standing on the x-axes in point (1,0), then you go to the origon point (0,0), and then to point (a3,b3). Your traces and its directions define the angle. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Reading one or two arguments - HillyBoy - 03-13-2021, 04:18 PM
RE: Reading one or two arguments - essen - 03-13-2021, 08:40 PM
RE: Reading one or two arguments - HillyBoy - 03-14-2021, 10:54 AM
RE: Reading one or two arguments - Han - 03-14-2021, 05:20 AM
RE: Reading one or two arguments - HillyBoy - 03-14-2021, 10:57 AM
RE: Reading one or two arguments - essen - 03-14-2021 11:54 AM
RE: Reading one or two arguments - essen - 03-14-2021, 10:08 PM
RE: Reading one or two arguments - HillyBoy - 03-15-2021, 05:06 AM
RE: Reading one or two arguments - essen - 03-15-2021, 12:27 PM
RE: Reading one or two arguments - HillyBoy - 03-16-2021, 11:57 AM
RE: Reading one or two arguments - essen - 03-16-2021, 09:00 PM
RE: Reading one or two arguments - Gene - 03-17-2021, 08:55 PM
|
User(s) browsing this thread: 1 Guest(s)