CAS Vars and integrals
|
08-24-2021, 05:37 AM
Post: #1
|
|||
|
|||
CAS Vars and integrals
Hello everyone. I have a problem to raise. I wrote a small #cas-program (see below) which performs a definite integral. Each time I launch the program, the integration variable (for example “t”) is stored in “CAS Vars”. Is there any way to avoid storing the variable in “CAS Vars”?
Also, sometimes not only the integration variable is stored in “CAS Vars”, but other things like question marks or whatever. How do I avoid this. Best regards, Roberto. Code: #cas |
|||
08-24-2021, 06:09 PM
(This post was last modified: 08-24-2021 06:28 PM by C.Ret.)
Post: #2
|
|||
|
|||
RE: CAS Vars and integrals
Hello,
If you want the 't' variable to be local to your program, you have to declare it in the LOCAL statement. Otherwise, your code is using a global CAS variable named 't', that make it appears in the VAR CAS sub menu. Try this : #cas Beta_r(z,a,b):= BEGIN LOCAL funz,t; funz:=(t)→(t^(a-1)*(1-t)^(b-1)); RETURN int(funz(t),t,0,z); END; #end |
|||
08-24-2021, 08:56 PM
Post: #3
|
|||
|
|||
RE: CAS Vars and integrals
Hi, robmio
I did try OP code. Global t is not affected. CAS> purge(t) → "No such variable t" CAS> Beta_r(1,2,3) → 1/12 CAS> t → t CAS> t := 99 CAS> Beta_r(1,2,3) → 1/12 CAS> ∫(t^3, t = 0 .. 1) → 1/4 CAS> t → 99 Definite integral variable (and function arguments) are supposed to be local. Requiring LOCAL for these is a bug, and should be fixed. In the meantime, a hard reset should do the trick. see https://www.hpmuseum.org/forum/thread-16...#pid148129 |
|||
08-24-2021, 11:56 PM
Post: #4
|
|||
|
|||
RE: CAS Vars and integrals
If you (either, both) believe it's a bug (and it seems so) you should report it to Tim and Cyrille; you can contact them via PM here. It's a sure bet to get attention sooner if they're notified than hoping they notice and read each and every thread, looking for possible conclusions that it is indeed a bug. Many threads with innocuous titles like this one may simply be a user asking a question, confused, etc. and not likely to grab their attention.
--Bob Prosperi |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)