INPUT in cas/end program
04-10-2015, 07:45 PM (This post was last modified: 04-10-2015 08:08 PM by salvomic.)
Post: #1
 salvomic Senior Member Posts: 1,394 Joined: Jan 2015
INPUT in cas/end program
hi all,
sorry if I repost a question:
I'm trying to upgrade my program to calculate the Fourier's Coefficient, it's a #cas/#end program, with a function (ChooseInterval()) to choose value for integral's interval.
At the moment it has two options ([0, 2PI] - [-PI, PI]), now I'm adding another option to enclose the case "Other", to calculate any interval.
But now (for case 3) I need to input two values for inf and sup values of interval.
I'm trying:
Code:
 INPUT({low,hi}, "Interval",{"lower limit", "upper limit"}, {"input lower limit", "input upper limit"}, {0,2});
It works with a "Home" program, but not here: I get "Error: Invalid input"...

Any help?

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
04-10-2015, 08:55 PM
Post: #2
 Han Senior Member Posts: 1,882 Joined: Dec 2013
RE: INPUT in cas/end program
(04-10-2015 07:45 PM)salvomic Wrote:  hi all,
sorry if I repost a question:
I'm trying to upgrade my program to calculate the Fourier's Coefficient, it's a #cas/#end program, with a function (ChooseInterval()) to choose value for integral's interval.
At the moment it has two options ([0, 2PI] - [-PI, PI]), now I'm adding another option to enclose the case "Other", to calculate any interval.
But now (for case 3) I need to input two values for inf and sup values of interval.
I'm trying:
Code:
 INPUT({low,hi}, "Interval",{"lower limit", "upper limit"}, {"input lower limit", "input upper limit"}, {0,2});
It works with a "Home" program, but not here: I get "Error: Invalid input"...

Any help?

Salvo

Non-CAS programs can make use of "interface" commands such as CHOOSE() and INPUT() whereas CAS programs are generally not interactive. A workaround is to use the EXPR() command to call these commands indirectly. EXPR() works like CAS() in that both take input strings.

Graph 3D | QPI | SolveSys
04-10-2015, 09:08 PM (This post was last modified: 04-10-2015 09:08 PM by salvomic.)
Post: #3
 salvomic Senior Member Posts: 1,394 Joined: Jan 2015
RE: INPUT in cas/end program
(04-10-2015 08:55 PM)Han Wrote:  Non-CAS programs can make use of "interface" commands such as CHOOSE() and INPUT() whereas CAS programs are generally not interactive. A workaround is to use the EXPR() command to call these commands indirectly. EXPR() works like CAS() in that both take input strings.

do you mean something like this?
Code:
 EXPR(INPUT(T, "Period","period T", "input period T", 2));

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
04-10-2015, 09:10 PM (This post was last modified: 04-10-2015 09:10 PM by Han.)
Post: #4
 Han Senior Member Posts: 1,882 Joined: Dec 2013
RE: INPUT in cas/end program
(04-10-2015 09:08 PM)salvomic Wrote:
(04-10-2015 08:55 PM)Han Wrote:  Non-CAS programs can make use of "interface" commands such as CHOOSE() and INPUT() whereas CAS programs are generally not interactive. A workaround is to use the EXPR() command to call these commands indirectly. EXPR() works like CAS() in that both take input strings.

do you mean something like this?
Code:
 EXPR(INPUT(T, "Period","period T", "input period T", 2));

The argument for EXPR() must be a string such that, when parsed, is equivalent to the command you wish to issue.

Graph 3D | QPI | SolveSys
04-11-2015, 07:59 AM
Post: #5
 salvomic Senior Member Posts: 1,394 Joined: Jan 2015
RE: INPUT in cas/end program
(04-10-2015 09:10 PM)Han Wrote:  The argument for EXPR() must be a string such that, when parsed, is equivalent to the command you wish to issue.

ok, thank you!
I solved so:

Code:
 inputT() // input routine for choice 3 BEGIN INPUT(T, "Interval", "Period T",  "Input T for [-T/2, T/2]", 2); RETURN T; END; #cas fourcoeff(args):= // Coefficienti di Fourier... BEGIN // ... CHOSE // ... IF scelta=3 THEN  EXPR("FourCoeff.inputT()"); // input T for interval [-T/2, T/2] es. 2pi -> [-pi, pi], 2 -> [-1,1] ... END; DEFAULT RETURN("Choose periodicity interval"); END; // case END; #end

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)