You can subscribe to this list here.
2009 |
Jan
(2) |
Feb
(5) |
Mar
|
Apr
|
May
(2) |
Jun
(8) |
Jul
(4) |
Aug
|
Sep
|
Oct
(2) |
Nov
(6) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
(2) |
May
(2) |
Jun
(2) |
Jul
(18) |
Aug
(13) |
Sep
(7) |
Oct
|
Nov
|
Dec
(2) |
2011 |
Jan
|
Feb
(11) |
Mar
|
Apr
(4) |
May
|
Jun
(1) |
Jul
(18) |
Aug
(16) |
Sep
(12) |
Oct
(12) |
Nov
(19) |
Dec
(42) |
2012 |
Jan
(16) |
Feb
(3) |
Mar
(8) |
Apr
(14) |
May
(30) |
Jun
(5) |
Jul
(7) |
Aug
(3) |
Sep
(10) |
Oct
(4) |
Nov
(10) |
Dec
(1) |
2013 |
Jan
(14) |
Feb
(8) |
Mar
(5) |
Apr
(3) |
May
(9) |
Jun
(19) |
Jul
|
Aug
(27) |
Sep
(5) |
Oct
(18) |
Nov
(12) |
Dec
(8) |
2014 |
Jan
(5) |
Feb
(8) |
Mar
(20) |
Apr
(22) |
May
(28) |
Jun
(9) |
Jul
(6) |
Aug
(46) |
Sep
(40) |
Oct
(15) |
Nov
(8) |
Dec
(34) |
2015 |
Jan
(20) |
Feb
(15) |
Mar
(18) |
Apr
(20) |
May
(3) |
Jun
(13) |
Jul
(10) |
Aug
(19) |
Sep
(8) |
Oct
(31) |
Nov
(26) |
Dec
(13) |
2016 |
Jan
(13) |
Feb
(4) |
Mar
(14) |
Apr
(28) |
May
(19) |
Jun
(7) |
Jul
(1) |
Aug
|
Sep
(19) |
Oct
(5) |
Nov
(4) |
Dec
(9) |
2017 |
Jan
(4) |
Feb
(30) |
Mar
|
Apr
(5) |
May
(1) |
Jun
(1) |
Jul
(3) |
Aug
(2) |
Sep
(11) |
Oct
(3) |
Nov
(1) |
Dec
(6) |
2018 |
Jan
(5) |
Feb
(12) |
Mar
(5) |
Apr
(12) |
May
(22) |
Jun
(86) |
Jul
(7) |
Aug
(5) |
Sep
(6) |
Oct
(17) |
Nov
(1) |
Dec
(3) |
2019 |
Jan
(17) |
Feb
(4) |
Mar
(2) |
Apr
(7) |
May
(1) |
Jun
(2) |
Jul
(7) |
Aug
(9) |
Sep
|
Oct
(11) |
Nov
(20) |
Dec
(24) |
2020 |
Jan
(13) |
Feb
(1) |
Mar
(9) |
Apr
(2) |
May
(6) |
Jun
(6) |
Jul
(4) |
Aug
(2) |
Sep
(4) |
Oct
(1) |
Nov
(2) |
Dec
(6) |
2021 |
Jan
(10) |
Feb
(49) |
Mar
(26) |
Apr
(2) |
May
(1) |
Jun
|
Jul
(4) |
Aug
(6) |
Sep
|
Oct
(8) |
Nov
(5) |
Dec
(11) |
2022 |
Jan
|
Feb
|
Mar
(14) |
Apr
(19) |
May
(14) |
Jun
(4) |
Jul
|
Aug
|
Sep
(6) |
Oct
(4) |
Nov
|
Dec
(1) |
2023 |
Jan
|
Feb
(4) |
Mar
(6) |
Apr
|
May
|
Jun
(6) |
Jul
|
Aug
|
Sep
(13) |
Oct
(1) |
Nov
|
Dec
(16) |
2024 |
Jan
(66) |
Feb
(13) |
Mar
(5) |
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2025 |
Jan
|
Feb
|
Mar
(32) |
Apr
(3) |
May
(8) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Arthur N. <ac...@ca...> - 2024-01-04 09:48:28
|
The CSL version has a resource!-limit function available at the symbolic code4 level that can restrict time used, the amount of memory cycled through, the amount of output generated or the number of lisp-level errors noticed and recovered from. I put that in for when I was wanting to run some tests and profiling, and an example use is in csl/cslbase/buildreduce.lsp where you will find the sequence walltime := timeofday(); eval '(resettime1); rr := resource!-limit(list('in_list1, mkquote packge, t), cpulimit, % CPU time per test conslimit, % megaconses 10000,% allow ten megabytes of I/O -1); % Do not limit Lisp-level That was not put in for what I will describe as ordinary or casual users. And for "Reduce" as a whole things are generally made easy-user-visible and documented in the main manual if they are liable to be provided when the Reduce sources are built on any platform - and in our case that means CSL, PSL, [Common Lisp, emacs Lisp, a Java-based Lisp,...]. >From early on Reduce tended to value providing the same experience everywhere - even in relatively resource-poor locations - over having the glossiest possible interface. Each version of Reduce ough to do do what the manual documents, but each will have a significant number of extra capabilities inherited from the underlying Lisp implementation and visible through "symbolic mode". So resouce!-limit which evaluates a form subject to limits is in CSL, but PSL and Common-Lisp based veraions will equally have their own specialities that may prove really important to some users - typically to power users. To the extent that resource!-limit is documented the test in csl/cslbase/eval3.cpp (!!) says // (resource!-limit form time space io errors C_stack Lisp_stack) // Evaluate the given form and if it succeeds return a // list whose first item is its value. If it fails in the ordinary manner // then its failure (error/throw/restart etc) gets passed back through // here in a transparent manner. But if it runs out of resources this // function catches that fact and returns an atomic value. // Resource limits are not precise, and are specified by the // subsequent arguments here: // time: an integer giving a time allowance in seconds // space: an integer giving a measure of memory that may be used, // expressed in units of "megaconses". This may only be // checked for at garbage collection and so small values // will often be substantially overshot. This is space // allocated - the fact that memory gets recycled does not // get it discounted. // io: an integer limiting the number of kilobytes of IO that may // be performed. // errors:an integer limiting the number of times traditional // Lisp errors can occur. Note that if errorset is used // you could have very many errors raised. // C_stack:in integer limiting (in Kbytes) the max depth of C // stack that may be used. The cut-off may be imprecise. // Lisp_stack: an integer limiting (in Kbytes) the max depth of // the Lisp stack that may be used. // In each case specifying a negative limit means that that limit does // not apply. But at least one limit must be specified. // If calls to resource!-limit are nested the inner ones can only // reduce the resources available to their form. // // Note that code within CSL can call the C function resource_exceeded() to // note that resources have expired. Because this is not supported by PSL or other Lisps it is probable that we do not want to make it a trivial user-level command or feature. Arthur |
From: Nasser M. A. <nm...@12...> - 2024-01-04 01:59:47
|
I am new learning reduce. I need to record CPU time used by the integrate command. I see in the manual, at page 70, there is on time; and off time; "causes the system to print a message after each command giving the elapsed CPU time since the last command" Could someone please show me how the Reduce code will look like if one wants to _save_ the time time used in a variable? For example on time; int(sin(x),x); off time; Since it prints time used on the screen, this is not useful for me. I need to find the time used and save it to variable, so that eventually write the record to a file. I just do not know how to capture the output and convert it to a numerical value and save it to a variable. Thanks --Nasser |
From: Nasser M. A. <nm...@12...> - 2024-01-04 00:40:12
|
Is it possible in Reduce to set a time limit on an operation to complete? I checked the manual and could not find anything <https://reduce-algebra.sourceforge.io/manual/manual.pdf> I am only interested in the integrate command. For example, how to tell Reduce to set 30 seconds CPU time limit on the command int(sin(x),x); And returns an error if it times out? In Maple I do the following as an example, this sets 30 seconds time limit <https://www.maplesoft.com/support/help/maple/view.aspx?path=timelimit> try anti_derivative := timelimit(30, int(sin(x),x) ); print(" did not time out."); catch: print("opps, timed out., Failed"); end try; This way my script does not hang and it knows the command failed. Mathematica has similar command <https://reference.wolfram.com/language/ref/TimeConstrained.html> Does reduce has anything similar? I need a way to set time limit on int(), since I want to run integrate command in a script over thousands of integrals and I have to put a limit limit how long each takes, else the script can hang on some integrals and it is not practical for me to keep checking and restarting. Thanks --Nasser |
From: Arthur N. <ac...@ca...> - 2024-01-01 14:51:13
|
Thanks again and Happy New Year. I have gome "svn pdel svn:executable" on those on my working copy and at some stage when I check things in that fix should go through. I am not minded to do a checkin just for that. Arthur On Mon, 1 Jan 2024, Andrey Ignatenko wrote: > Yes, things are almost fine, thanks! But two files > csl/cslbase/fonts/cmuntt.pfb and csl/cslbase/redcsl.1 intended to be > installed on user's machine were overlooked. They still have wrong executable > permissions. By the way I found 'svn patch' and 'svn diff' commands > understand svn:executable properties while standard UNIX 'patch' and 'diff' > commands, unsurprisingly, does not. > > Regards, > Andrey Ignatenko > |
From: Arthur N. <ac...@ca...> - 2024-01-01 14:45:47
|
That sounds like a potentially huge calculation. Again I will explain some background for you but also for all the rest of our readers! Reduce obviously allocates memory as it goes and big calculations fill that up. However when it has completed one step and it abandons a load of data structures it does not return memory to the OS so "top" and friends will probably never see things shrinking. And the visible memory use there will represent the peak amount that Reduce has requested. Internally the system uses garbage collection, so when data is no longer needed it is merely abandoned and only when it starts to look as if memory is totally full does the system scan everything, identify what is still in use and recover for recycling the rest. If you go "lisp verbos t;" you should see messages each time garbage collection is triggered. For instance a CSL message from that might be for i := 1:5000 do q := (a+b+c+d+e)^10; +++ Garbage collection 1 (internal acons) after 10.70+0.00 seconds At gc end about 16.0 Mbytes of 16288.0 (0.1%) of heap is in use for i := 1:5000 do q := (a+b+c+d+e)^10; +++ Garbage collection 2 (internal cons) after 21.20+0.00 seconds At gc end about 16.0 Mbytes of 16288.0 (0.1%) of heap is in use This shows a situation where top knows abou the 16Gbytes that Reduce is sitting on but at the time the GC happens only 16Mbytes of that are in use. CSL-reduce tried to expand the amount of memory it grabs from the operating system as it goes up to a limit it hopes represents politeness, so most people do not need to specify "-k10G" or whatever to set its memory use at the start. There are places where Reduce tries to speed things up by keeping a cache of previously computed things and there may be cases where the cache preserves stuff that is not essential but that clogs memory up. My main view is that people doing calculations that fill up multiple gigabytes in general should not (and can not) assume that what they are doing will fit. Even if they have previously solved it using some other system so they know it is feasible, but even more so if they have not. It sounds as if you have 81x81 fairly indepoendent cases each of which generates a monomianl and potentially reports/saves nn and mm. If that is the case you can start by just kaing each a separate run of Reduce because that way we can all see it is impossible for clutter to build up! If that works in sensible memory but doing them all together clogs up I can ask that you produce for us a SMALL illustration of this (ie without anything remotely like 10496 terms od degree 6) that would be tidy and compact enogh for us to debug. But first please go "lisp verbos t;" and probably put in trace print statements so that you can see if the stage that things fail is eg when you first get to an especially large or challenging sub-case. Again I speak not fully understanding what you are doing, but from what you have described and if it was me I might pre-process the input files so that rather than using c(0), c(1)... they used c0, c1, ... which you can probably imagine are indeterminates that will be more compact in the internal calculation so may save a little time and space. I do not guarantee that that would make a significant difference! Arthur On Mon, 1 Jan 2024, Jarmo Hietarinta wrote: > Thanks Norman, > > I realize I was not specific enough so I try to give more details: > > First I input a file containing a set of 375 equations in the form mn(j):=(polynomial in c(0)..c(15),d(1)..d(15) ,,) > where mn(j) has 32 to 10496 terms of degree 6. > > Then I have 2 control files solvaic and solvaid , each containing 81 entries such as {c(12)=0,c(9)=0,c(6)=0,c(3)=0} and {d(6)=0,d(0)=0}. > These determine the sub-cases. > > The procedure prescan(nn,mm) takes control statements from the the solvai* files and does the following: > It goes through the 375 mn(j) polynomials and looks at mn(j) evaluated under the control entries (" mn(j) where part(solvaic,nn) where part(solvaid mm)") > and if the results is a monomial it is added to the list eqsl. This list eqsl turns out to be simple enough to be solved, > and if the solution satisfies some further conditions, the values nn,mm are saved as cases for further study. > > The above procedure is repeated for 81*81 times, but in reality I can do at most 7*81 cases until memory is exhausted and the program terminates. > I guess it happens due to repeated calls to mn(j) and their evaluation under "where" rules. > In principle after each call to prescan the memory should be cleaned to the situation before the call, but that does not seem happen. > Using "top" I can follow the growth of resident and virtual memory. I have 20GB memory available. > > regards, Jarmo |
From: Andrey I. <and...@ma...> - 2024-01-01 14:45:14
|
Yes, things are almost fine, thanks! But two files csl/cslbase/fonts/cmuntt.pfb and csl/cslbase/redcsl.1 intended to be installed on user's machine were overlooked. They still have wrong executable permissions. By the way I found 'svn patch' and 'svn diff' commands understand svn:executable properties while standard UNIX 'patch' and 'diff' commands, unsurprisingly, does not. Regards, Andrey Ignatenko Arthur Norman wrote: > Thank you - I hope that things are now as they should be! Arthur > > On Tue, 19 Dec 2023, Andrey Ignatenko via Reduce-algebra-developers wrote: > >> Hello all, >> >> Herewith this letter I suggest two simple SVN patches to rev. 6658. >> >> 1) install-man.patch >> Fix path to the man page file in install/uninstall targets in >> csl/cslbase/Makefile.am. Delete executable property for the man page >> file. >> >> 2) del-exec-properties.patch >> Delete unneeded executable property for a number of files in >> csl/reduce.doc and csl/cslbase/fonts directories. >> >> Regards, >> Andrey Ignatenko >> |
From: Jarmo H. <hie...@ut...> - 2024-01-01 14:11:23
|
Thanks Norman, I realize I was not specific enough so I try to give more details: First I input a file containing a set of 375 equations in the form mn(j):=(polynomial in c(0)..c(15),d(1)..d(15) ,,) where mn(j) has 32 to 10496 terms of degree 6. Then I have 2 control files solvaic and solvaid , each containing 81 entries such as {c(12)=0,c(9)=0,c(6)=0,c(3)=0} and {d(6)=0,d(0)=0}. These determine the sub-cases. The procedure prescan(nn,mm) takes control statements from the the solvai* files and does the following: It goes through the 375 mn(j) polynomials and looks at mn(j) evaluated under the control entries (" mn(j) where part(solvaic,nn) where part(solvaid mm)") and if the results is a monomial it is added to the list eqsl. This list eqsl turns out to be simple enough to be solved, and if the solution satisfies some further conditions, the values nn,mm are saved as cases for further study. The above procedure is repeated for 81*81 times, but in reality I can do at most 7*81 cases until memory is exhausted and the program terminates. I guess it happens due to repeated calls to mn(j) and their evaluation under "where" rules. In principle after each call to prescan the memory should be cleaned to the situation before the call, but that does not seem happen. Using "top" I can follow the growth of resident and virtual memory. I have 20GB memory available. regards, Jarmo |
From: Arthur N. <ac...@ca...> - 2024-01-01 11:40:50
|
On Mon, 1 Jan 2024, Jarmo Hietarinta wrote: > I have a procedure in which all internal variables are marked as scalar. > Then I have a loop in which this program is executed with various input values. > The problem is that despite the "scalar" definitions the computations fill > the available memory fast. (I use "rfpsl -m 22000") > > Is these some way to avoid this kind of wasteful memory buildup > while keeping intact some global variables. > > regards, > Jarmo > The word "scalar" in reduce indicates the converse of vector or matrix (somewhat). So an arbitrarily messy algebraic formula can be stored in a "scalar" variable. The variable being local does not do anythin much beyond arrange that the value stored in it is liable to be discarded when you exit the begin...end scope that encloses the scalar declaration. You do not tell us what your look does, but to understand what is going on I might suggest you observe the values that build up in these variables (eg by doimg something like begin scalar w := x + y; for i := 1:10 do << w := w*w; write i, " ", w; % see how we are doing! >>; write "done" end; It is VERY common that with algebraic calculations that expressions can expand explosively. Another hint perhaps when you hit oddities is to try comparisons with redcsl and redpsl since when eg resource limits are exceeded or other edge cases arise the messages you see might be different and one may help you more. In case of oddity I often use the linux/macos/cygwin utility "script" to keep a transcript of all I do so I can review it even if it has gone off the toip of my screen, and I then use the console mode in the CSL version via "redcsl -w". Or use "| tee logfile.log" to capture output so I can review it at leisure. "scalar" does not mean "just numeric". Actually it is possible toi use the word "integer" where you use "scalar" and when introduced that was intended to allow for optimisation with the code knowing it was working with integers not general expressions, but the keyword is a hang-over from an experiment MANY years ago and these days "integer" is just a synonym for "scalar" so that would not force numeric computation or moan when they was not what was asked for. If you are using say trig functions or whatever and are expecting floating point work you need "on rounded;" and in some cases you could go "precision 100;" if you needed silly accuracy and could accept the slowdown. Otherwise sin(1.0) will and exp(-1.0) will remain as algebraic expressions and potentially build up in spectacular manners. Arthur |
From: Jarmo H. <hie...@ut...> - 2024-01-01 09:57:05
|
I have a procedure in which all internal variables are marked as scalar. Then I have a loop in which this program is executed with various input values. The problem is that despite the "scalar" definitions the computations fill the available memory fast. (I use "rfpsl -m 22000") Is these some way to avoid this kind of wasteful memory buildup while keeping intact some global variables. regards, Jarmo |
From: Arthur N. <ac...@ca...> - 2024-01-01 09:18:16
|
I am somewhat tempted to ask why you need that, since in Reduce there is little for you to do with a string beyond merely print it out and you could have printed the original expression out. I am aware that you may view this as a distracting and unhelpful response, but I think that what you ask for here is something I have not previously seen a need for and since nobodyt else has put it into Reduce the other contributors have not either. For both PSL and CSL verszions of Reduce it would be feasible and nt even a great deal of code to use a "string output stream" at the symbolic level so that the ordinary printing mechanisms sent their output to what could end up as a string, but ensuring that that then worked with every possible build variant of Reduce would be messier since that uses facilties beyond the agreed core of functionality we have in the kernel. So how stroingly do you NEED this because if you can convince us that you NEED it and enought others would find it valuable we will put it on the queue of work items, or if you are willing to dive into the Reduce sources to implement it yourself we will try to be helpful! Arthur On Mon, 1 Jan 2024, Nasser M. Abbasi wrote: > This is another basic operation I am not able to find > from the book > > http://www.reduce-algebra.com/reduce38-docs/reduce.pdf > > How does one convert a symbolic expression to string? > > i.e. cos(x) to "cos(x)" ? > > in Maple, I do > > r:=sin(x); > s:=String(r); > > and this gives "sin(x)". The expression can be any valid Reduce > symbolic expression. I need to be able to convert the anti-derivative > result to a string. > > Thanks > --Nasser > > > > > _______________________________________________ > Reduce-algebra-developers mailing list > Red...@li... > https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers > |
From: Nasser M. A. <nm...@12...> - 2024-01-01 02:16:33
|
This is another basic operation I am not able to find from the book http://www.reduce-algebra.com/reduce38-docs/reduce.pdf How does one convert a symbolic expression to string? i.e. cos(x) to "cos(x)" ? in Maple, I do r:=sin(x); s:=String(r); and this gives "sin(x)". The expression can be any valid Reduce symbolic expression. I need to be able to convert the anti-derivative result to a string. Thanks --Nasser |
From: Nasser M. A. <nm...@12...> - 2024-01-01 01:52:58
|
On 12/31/2023 5:08 PM, Arthur Norman wrote: > The "invalid as an operator" may suggest thhat that time you had omitted > the semicolon after freeof(anti, int) so that it was being parsed as a > function to be used on whatever was on your next line. Obviously I can not > be 100% certain, but that is my best guess! > > True is denoted by t and false by nil - and nil does not print in > algebraic mode. So the sort of think I try is > > > redcsl -w > Reduce (CSL, rev 6652), 21-Nov-2023 ... > > 1: a := int(x^4*exp(1/x)/(x^3+2*x),x); > > 1/x 1/x > 1/x 2 1/x e e *x > e *x + e *x + 2*int(----------,x) - 3*int(--------,x) > 3 2 > x + 2*x x + 2 > a := ------------------------------------------------------------ > 2 > > 2: b := int(1/(x^2-1), x); > > log(x - 1) - log(x + 1) > b := ------------------------- > 2 > > 3: if freeof(a, int) then write "free"; > > 4: if freeof(b, int) then write "free"; > > free > > 5: > > > Unless you are trying to integrate things with square roots of polynomials > in loading algint is not liable to be useful for you. "algint" is for > algebraic-case integrals where in this techniocal context algebraic is > contasted with transcendentel (as in e^x, sin x etc). > See algint/algint.tst for examples of what it is about. > > Does this help? > > Arthur > > Thanks. yes it helped. I made it work. Example below. I find reduce syntax very confusing. But I've only been using it for few hrs. I have 125,000 integrals. They are of different types and mix. I thought algint is an "add on". So if it is needed it is used by the int command. If not, then no harm of adding it. Right? I can't decide when and where to use algint, since the program will run over these 125,000 integrals using same code. So I either not load it, or load it. I thought that by loading it, it will improve result of integration by Reduce. This is my current basic script. I open reduce and type in("file_1.txt") Where file_1.txt is the following ---------------------- load_package "algint"; off nat; on echo; COMMENT These are 4 integration problems to solve; matrix A; A:=mat( (sin(x),x ), ((x^6-x^5+x^4-x^3+1)*exp(x),x), ((-x^2+2)*exp(x/(x^2+2))/(x^3+2*x),x), ((2*x^4-x^3+3*x^2+2*x+2)*exp(x/(x^2+2))/(x^3+2*x),x)); nrows := part(length(A),1); COMMENT Matrix M will hold the result; matrix M(nrows,2); for counter :=1:nrows do << anti:=int( A(counter,1), A(counter,2) ); if freeof(anti, int) then M(counter,1):=1 else M(counter,1):=0; M(counter,2):=anti >>; COMMENT Go over result and print which passed and which failed; for counter:=1:nrows do << if M(counter,1)=1 then write "integral ", counter," passed. Result is ", M(counter,2) else write "integral ", counter," failed. Result is ", M(counter,2) >>; end; --------------------------------------------------- But I need to do many more operations, which I still do not know how to do in Reduce. I'll post separate question on this later. Thanks --Nasser |
From: Arthur N. <ac...@ca...> - 2023-12-31 23:09:16
|
The "invalid as an operator" may suggest thhat that time you had omitted the semicolon after freeof(anti, int) so that it was being parsed as a function to be used on whatever was on your next line. Obviously I can not be 100% certain, but that is my best guess! True is denoted by t and false by nil - and nil does not print in algebraic mode. So the sort of think I try is redcsl -w Reduce (CSL, rev 6652), 21-Nov-2023 ... 1: a := int(x^4*exp(1/x)/(x^3+2*x),x); 1/x 1/x 1/x 2 1/x e e *x e *x + e *x + 2*int(----------,x) - 3*int(--------,x) 3 2 x + 2*x x + 2 a := ------------------------------------------------------------ 2 2: b := int(1/(x^2-1), x); log(x - 1) - log(x + 1) b := ------------------------- 2 3: if freeof(a, int) then write "free"; 4: if freeof(b, int) then write "free"; free 5: Unless you are trying to integrate things with square roots of polynomials in loading algint is not liable to be useful for you. "algint" is for algebraic-case integrals where in this techniocal context algebraic is contasted with transcendentel (as in e^x, sin x etc). See algint/algint.tst for examples of what it is about. Does this help? Arthur On Sun, 31 Dec 2023, Nasser M. Abbasi wrote: > Given this in Reduce (CSL, rev 6339), 16-Jun-2022 . > > I wanted to check if the command int (i.e. integration) failed > or not. Normally this is done by checking if the result returned > contains "int" in it or not. I found that there is function called > > freeof(u,v) determines if the expression u does not contain the kernel > v anywhere in its structure; > > But when I tried it, this seems not to work. When I call it on result > that clearly contains int because Reduce could not integrate it, > the command freeof(u,v) did not return anything. I was expecting > it to reurn true on the screen. > > Here is the code I tried. Started reduce and typed > > ------------------------- > load_package "algint"; > off nat; > anti:=int(x^4*exp(1/x)/(x^3+2*x),x); > freeof(anti,int); > ------------------------- > > It gives > > **** (freeof anti int) invalid as operator > > I tried it again and it now gives empty line. > > What is the correct way to check if integration faild or not in Reduce > using code? is there a better command to check if result > contains int in it or not? > > Thanks > --Nasser > > > > > > _______________________________________________ > Reduce-algebra-developers mailing list > Red...@li... > https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers > |
From: Nasser M. A. <nm...@12...> - 2023-12-31 21:53:57
|
Given this in Reduce (CSL, rev 6339), 16-Jun-2022 . I wanted to check if the command int (i.e. integration) failed or not. Normally this is done by checking if the result returned contains "int" in it or not. I found that there is function called freeof(u,v) determines if the expression u does not contain the kernel v anywhere in its structure; But when I tried it, this seems not to work. When I call it on result that clearly contains int because Reduce could not integrate it, the command freeof(u,v) did not return anything. I was expecting it to reurn true on the screen. Here is the code I tried. Started reduce and typed ------------------------- load_package "algint"; off nat; anti:=int(x^4*exp(1/x)/(x^3+2*x),x); freeof(anti,int); ------------------------- It gives **** (freeof anti int) invalid as operator I tried it again and it now gives empty line. What is the correct way to check if integration faild or not in Reduce using code? is there a better command to check if result contains int in it or not? Thanks --Nasser |
From: Francis W. <f.j...@li...> - 2023-12-31 19:35:05
|
I don't think there is any straightforward way to do what you want. One solution would be to write your own special-purpose input parser using the low-level facilities provided by Standard Lisp, which can either read a single character or a complete Lisp expression. It would probably be slightly easier to use the facilities provided by one of the actual Lisp implementations on which REDUCE is built, but it would still be a fair amount of work. What I would probably do, especially if this were a one-off task, is to pre-process the CSV file into a file of REDUCE input statements. It should not be too difficult to write a script in (g)awk or perl to process a CSV data file and turn every field into a REDUCE assignment to a variable with a unique name generated from the record and field indices. Francis ________________________________ From: Nasser M. Abbasi <nm...@12...> Sent: 31 December 2023 4:31 AM To: red...@li... <red...@li...> Subject: [Reduce-algebra-developers] How to do basic I/O in reduce? Read/write using fprintf? new to reduce cas. Using Reduce (CSL, rev 6339), 16-Jun-2022 on Linux I looked at reduce book (pdf) but I see nothing there. I need to read a plain texfile which has number of problems, each problem is on one line. The file is CSV format. How does one read such a file, either line by line in a loop, or using an import CSV command if reduce has such a thing. These are not reduce commands I wanted to read, but plain text lines separated by comma's that have text and numbers of them. Very basic thing to do in other CAS systems, but could not find a way to do this in Reduce. Thanks --Nasser _______________________________________________ Reduce-algebra-developers mailing list Red...@li... https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers |
From: Arthur N. <ac...@ca...> - 2023-12-31 18:01:55
|
Thank you so much. When earlier this evening I said I would wish to do a bit of research before settling what I did you have delivered something that I feel I can just adopt. And the amount of detail in your selection confirms that this is all very jolly!!!! Arthur On Sun, 31 Dec 2023, Jeff Johnson wrote: > Arthur, > > In my own projects, which need to be cross-platform across dozens of systems, I've settled on the following order. Your mileage may, of course, vary. > > ```c > /** The clock used to obtain timestamps. */ > # if defined(CLOCK_REALTIME_FAST) > # define SIR_WALLCLOCK CLOCK_REALTIME_FAST > # elif defined(CLOCK_REALTIME_COARSE) > # define SIR_WALLCLOCK CLOCK_REALTIME_COARSE > # else > # define SIR_WALLCLOCK CLOCK_REALTIME > # endif > > /** The clock used to measure intervals. */ > # if defined(CLOCK_UPTIME) > # define SIR_INTERVALCLOCK CLOCK_UPTIME > # elif defined(CLOCK_BOOTTIME) && !defined(__EMSCRIPTEN__) > # define SIR_INTERVALCLOCK CLOCK_BOOTTIME > # elif defined(CLOCK_HIGHRES) > # define SIR_INTERVALCLOCK CLOCK_HIGHRES > # elif defined(CLOCK_MONOTONIC) > # define SIR_INTERVALCLOCK CLOCK_MONOTONIC > # else > # define SIR_INTERVALCLOCK CLOCK_REALTIME > # endif > ``` > > The CLOCK_UPTIME and BOOTTIME timers restart at 0 at system boot time, and it *does* take into account time that a system may be suspended (like a snapshotted virtual machine, or a checkpointed/migrates process). The regular MONOTONIC clock usually does not necessarily 'tick' when the machine is not actually running. > > (We support the systems in this table with this order quite successfully- https://github.com/aremmell/libsir#cross-platform-compatibility). > > Time is such a pain. Yes I had observed but I had not dug anything like as deeply... > -- > Jeffrey H. Johnson > tr...@po... > |
From: Arthur N. <ac...@ca...> - 2023-12-31 17:58:40
|
On Sun, 31 Dec 2023, Nasser M. Abbasi wrote: > new to reduce cas. Using Reduce (CSL, rev 6339), 16-Jun-2022 on Linux > I looked at reduce book (pdf) but I see nothing there. > > I need to read a plain texfile which has number of problems, > each problem is on one line. The file is CSV format. > > How does one read such a file, either line by line in a > loop, or using an import CSV command if reduce has such a thing. > > These are not reduce commands I wanted to read, but plain > text lines separated by comma's that have text and numbers > of them. Very basic thing to do in other CAS systems, but > could not find a way to do this in Reduce. > > Thanks > --Nasser I will start with a rather general prefix that applies to many queries, not just yours! This is in the hope that the reply helps others beyond just you who may have related issues. Reduce has two levels at which it can be used. The one that is simpler to get to grips with is known as "algebraic mode" and the data that it works with is algebraic formulae. Numbers are clearly a sub-case of those, but text as such is really just there so one can include it in output eg with write "The answer is ", 2+2; The facilities provided at that level for reading files rather expect that the files will contain a sequence of Reduce commands (which can be just expressions) so you go 'in "file.red";' to read and have Reduce process stuff. The second level is "symbolic mode" where Reduce provides a general purpose programming language that could be used to read csv files or almost anything. However MOSTLY the symbolic mode is used to implement the algebraic transformations that algebraic mode provide. So for instance there is a fragment in the source that starts off symbolic procedure addsq(u, b); ... which is the code that arranges to be able to add "standard quotients" which are the internal form used for representing things like (x+1)/(x-1). Symbolic mode provides a great many functions that can be called! But these are aimed moire at implementers than at end users. However being open source all the code that makes up Reduce is available to and visible to everybody. And very many of the capabilities of the current system have arised because somebody wants a particular facility, finds it is not there but might be needed for themselved and useful to some others so they implement it. The "primers" in the documentation directory are attempts to ease the way in. Sometimes also requests are ones that various of the experiences people on this list could provide them quickly enough that they do. That of course depends on how budy they are on other projects... So from your explanation you want to be able to read a file that contains a comma separated bunch of stuff. Do you mean like word, several words, 1234, 19.542, "maybe a string", two numbers 8 10 and additional lines sort of like that? What then would you do with it? It would be easy to read a line and return a list of the fragments of it that were separted by commas. But I find it hard to know what your use of it would be from there on and hence what would actually serve you best. Do you want to explain a bit more. Note that in symbolic mode the functions that are maybe key would be filehandle := open("filename.dat", 'input); oldinput := rds filehandle; ... readch() ... get characters rds oldinput; close filehandle; and it is usually much easier to keep data in lists than arrays. Much of this is very general - but the query about what you would really find useful may stand out to you! Arthur |
From: Arthur N. <ac...@ca...> - 2023-12-31 17:50:26
|
On Sun, 31 Dec 2023, Jeff Johnson wrote: > Based on the usage I *believe* that "CLOCK_MONOTONIC_FAST" would be sufficient (but if I'm wrong, and very precise timing is required, "CLOCK_MONOTONIC_PRECISE" would be preferred on FreeBSD). These are non-standard FreeBSD-extensions. > > -- > Jeffrey H. Johnson > tr...@po... > There is a lot of this that I at best have a marginal understanding of so I read bits of documentation and web pages. I suspect I should go back to just what C++ mandates! Arthur |
From: Jeff J. <tr...@po...> - 2023-12-31 17:46:16
|
> There is a lot of this that I at best have a marginal understanding of so > I read bits of documentation and web pages. I suspect I should go back to > just what C++ mandates! Arthur I believe that would be MONOTONIC for intervals, and REALTIME for timestamping, practically speaking. Technically speaking, the existence of any monotonic clock is completely optional in POSIX and ISO C (https://pubs.opengroup.org/onlinepubs/9699919799/help/codes.html#MON - "Monotonic Clock: The functionality described is optional. The functionality described is also an extension to the ISO C standard."), but in reality, essentially every modern OS includes a monotonic clock implementation. Worst case you could always fallback to CLOCK_REALTIME (and make sure the clock going backwards won't hang your application). |
From: Jeff J. <tr...@po...> - 2023-12-31 17:21:37
|
Arthur, In my own projects, which need to be cross-platform across dozens of systems, I've settled on the following order. Your mileage may, of course, vary. ```c /** The clock used to obtain timestamps. */ # if defined(CLOCK_REALTIME_FAST) # define SIR_WALLCLOCK CLOCK_REALTIME_FAST # elif defined(CLOCK_REALTIME_COARSE) # define SIR_WALLCLOCK CLOCK_REALTIME_COARSE # else # define SIR_WALLCLOCK CLOCK_REALTIME # endif /** The clock used to measure intervals. */ # if defined(CLOCK_UPTIME) # define SIR_INTERVALCLOCK CLOCK_UPTIME # elif defined(CLOCK_BOOTTIME) && !defined(__EMSCRIPTEN__) # define SIR_INTERVALCLOCK CLOCK_BOOTTIME # elif defined(CLOCK_HIGHRES) # define SIR_INTERVALCLOCK CLOCK_HIGHRES # elif defined(CLOCK_MONOTONIC) # define SIR_INTERVALCLOCK CLOCK_MONOTONIC # else # define SIR_INTERVALCLOCK CLOCK_REALTIME # endif ``` The CLOCK_UPTIME and BOOTTIME timers restart at 0 at system boot time, and it *does* take into account time that a system may be suspended (like a snapshotted virtual machine, or a checkpointed/migrates process). The regular MONOTONIC clock usually does not necessarily 'tick' when the machine is not actually running. (We support the systems in this table with this order quite successfully- https://github.com/aremmell/libsir#cross-platform-compatibility). Time is such a pain. -- Jeffrey H. Johnson tr...@po... On Sun, Dec 31, 2023, at 11:51 AM, Arthur Norman wrote: > Thank you. I will want to do some more research into things before I > decide whether to use plain CLOCK_MONOTONIC for everybody or to install > configure-time checks for its availability and use CLOCK_MONOTONIC_RAW > when available. I know that I have found that looking for a clock with > best resolution and repeatability has worried me! > > SInce you have a fix at present I will take it that I can take a few days > to think... > > THANKS again for a helpful report. Arthur > > > On Sun, 31 Dec 2023, Pedro F. Giffuni via Reduce-algebra-developers wrote: > >> Hi; >> I tried opening a ticket but sourceforge appears to be broken ... >> At least on FreeBSD there is no such thing as > CLOCK_MONOTONIC_RAW:...[x86_64-unknown-freebsd14.0] CXX > csl-sysfwin. > o/usr/ports/math/reduce/work/Reduce-svn6658-src/csl/cslbase/sysfwin.cpp:766:19: > error: use of undeclared identifier 'CLOCK_MONOTONIC_RAW' > clock_gettime(CLOCK_MONOTONIC_RAW, &tt); ^1 error > generated.gmake[4]: *** [Makefile:3106: csl-sysfwin.o] Error 1gmake[4]: > Leaving directory > '/usr/ports/math/reduce/work/Reduce-svn6658-src/cslbuild/x86_64-unknown-freebsd14.0/csl'gmake[3]: > *** [Makefile:1438: all] Error 2gmake[3]: Leaving directory > '/usr/ports/math/reduce/work/Reduce-svn6658-src/cslbuild/x86_64-unknown-freebsd14.0/csl'....Changing > it to CLOCK_MONOTONIC seems to work. >> >> > _______________________________________________ > Reduce-algebra-developers mailing list > Red...@li... > https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers |
From: Rainer S. <rai...@gm...> - 2023-12-31 17:19:37
|
CLOCK_MONOTONIC_RAW is a Linux-specific value, CLOCK_MONOTONIC_FAST and CLOCK_MONOTONIC_PRECISE are specific to FreeBSD. Here is a longer discussion of the various clocks: https://www.baeldung.com/linux/timekeeping-clocks Interesting statement in this article: "While CLOCK_MONOTONIC provides a high level of accuracy, CLOCK_MONOTONIC_RAW might sacrifice some precision for greater immunity to NTP adjustments." Rainer On Sun, 31 Dec 2023 at 16:51 -0000, Arthur Norman wrote: > Thank you. I will want to do some more research into things before I decide > whether to use plain CLOCK_MONOTONIC for everybody or to install > configure-time checks for its availability and use CLOCK_MONOTONIC_RAW when > available. I know that I have found that looking for a clock with > best resolution and repeatability has worried me! > > SInce you have a fix at present I will take it that I can take a few days to > think... > > THANKS again for a helpful report. Arthur > > > On Sun, 31 Dec 2023, Pedro F. Giffuni via Reduce-algebra-developers wrote: > > > Hi; > > I tried opening a ticket but sourceforge appears to be broken ... > > At least on FreeBSD there is no such thing as > CLOCK_MONOTONIC_RAW:...[x86_64-unknown-freebsd14.0] CXX csl-sysfwin. > o/usr/ports/math/reduce/work/Reduce-svn6658-src/csl/cslbase/sysfwin.cpp:766:19: > error: use of undeclared identifier 'CLOCK_MONOTONIC_RAW' > clock_gettime(CLOCK_MONOTONIC_RAW, &tt); ^1 error > generated.gmake[4]: *** [Makefile:3106: csl-sysfwin.o] Error 1gmake[4]: > Leaving directory > '/usr/ports/math/reduce/work/Reduce-svn6658-src/cslbuild/x86_64-unknown-freebsd14.0/csl'gmake[3]: > *** [Makefile:1438: all] Error 2gmake[3]: Leaving directory > '/usr/ports/math/reduce/work/Reduce-svn6658-src/cslbuild/x86_64-unknown-freebsd14.0/csl'....Changing > it to CLOCK_MONOTONIC seems to work. > > > Rainer Schöpf |
From: Arthur N. <ac...@ca...> - 2023-12-31 17:06:54
|
Thank you. I will want to do some more research into things before I decide whether to use plain CLOCK_MONOTONIC for everybody or to install configure-time checks for its availability and use CLOCK_MONOTONIC_RAW when available. I know that I have found that looking for a clock with best resolution and repeatability has worried me! SInce you have a fix at present I will take it that I can take a few days to think... THANKS again for a helpful report. Arthur On Sun, 31 Dec 2023, Pedro F. Giffuni via Reduce-algebra-developers wrote: > Hi; > I tried opening a ticket but sourceforge appears to be broken ... > At least on FreeBSD there is no such thing as CLOCK_MONOTONIC_RAW:...[x86_64-unknown-freebsd14.0] CXX csl-sysfwin. o/usr/ports/math/reduce/work/Reduce-svn6658-src/csl/cslbase/sysfwin.cpp:766:19: error: use of undeclared identifier 'CLOCK_MONOTONIC_RAW' clock_gettime(CLOCK_MONOTONIC_RAW, &tt); ^1 error generated.gmake[4]: *** [Makefile:3106: csl-sysfwin.o] Error 1gmake[4]: Leaving directory '/usr/ports/math/reduce/work/Reduce-svn6658-src/cslbuild/x86_64-unknown-freebsd14.0/csl'gmake[3]: *** [Makefile:1438: all] Error 2gmake[3]: Leaving directory '/usr/ports/math/reduce/work/Reduce-svn6658-src/cslbuild/x86_64-unknown-freebsd14.0/csl'....Changing it to CLOCK_MONOTONIC seems to work. > > |
From: Jeff J. <tr...@po...> - 2023-12-31 17:06:17
|
Based on the usage I *believe* that "CLOCK_MONOTONIC_FAST" would be sufficient (but if I'm wrong, and very precise timing is required, "CLOCK_MONOTONIC_PRECISE" would be preferred on FreeBSD). These are non-standard FreeBSD-extensions. -- Jeffrey H. Johnson tr...@po... On Sun, Dec 31, 2023, at 11:44 AM, Pedro F. Giffuni via Reduce-algebra-developers wrote: > > Hi; > I tried opening a ticket but sourceforge appears to be broken ... > > At least on FreeBSD there is no such thing as CLOCK_MONOTONIC_RAW: > ... > [x86_64-unknown-freebsd14.0] CXX csl-sysfwin.o > /usr/ports/math/reduce/work/Reduce-svn6658-src/csl/cslbase/sysfwin.cpp:766:19: error: use of undeclared identifier 'CLOCK_MONOTONIC_RAW' > clock_gettime(CLOCK_MONOTONIC_RAW, &tt); > ^ > 1 error generated. > gmake[4]: *** [Makefile:3106: csl-sysfwin.o] Error 1 > gmake[4]: Leaving directory '/usr/ports/math/reduce/work/Reduce-svn6658-src/cslbuild/x86_64-unknown-freebsd14.0/csl' > gmake[3]: *** [Makefile:1438: all] Error 2 > gmake[3]: Leaving directory '/usr/ports/math/reduce/work/Reduce-svn6658-src/cslbuild/x86_64-unknown-freebsd14.0/csl' > .... > Changing it to CLOCK_MONOTONIC seems to work. > > _______________________________________________ > Reduce-algebra-developers mailing list > Red...@li... > https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers > > > *Attachments:* > • patch-csl_cslbas_sysfwin.cpp |
From: Pedro F. G. <gif...@ya...> - 2023-12-31 16:44:41
|
Hi; I tried opening a ticket but sourceforge appears to be broken ... At least on FreeBSD there is no such thing as CLOCK_MONOTONIC_RAW:...[x86_64-unknown-freebsd14.0] CXX csl-sysfwin.o/usr/ports/math/reduce/work/Reduce-svn6658-src/csl/cslbase/sysfwin.cpp:766:19: error: use of undeclared identifier 'CLOCK_MONOTONIC_RAW' clock_gettime(CLOCK_MONOTONIC_RAW, &tt); ^1 error generated.gmake[4]: *** [Makefile:3106: csl-sysfwin.o] Error 1gmake[4]: Leaving directory '/usr/ports/math/reduce/work/Reduce-svn6658-src/cslbuild/x86_64-unknown-freebsd14.0/csl'gmake[3]: *** [Makefile:1438: all] Error 2gmake[3]: Leaving directory '/usr/ports/math/reduce/work/Reduce-svn6658-src/cslbuild/x86_64-unknown-freebsd14.0/csl'....Changing it to CLOCK_MONOTONIC seems to work. |
From: Nasser M. A. <nm...@12...> - 2023-12-31 04:54:37
|
new to reduce cas. Using Reduce (CSL, rev 6339), 16-Jun-2022 on Linux I looked at reduce book (pdf) but I see nothing there. I need to read a plain texfile which has number of problems, each problem is on one line. The file is CSV format. How does one read such a file, either line by line in a loop, or using an import CSV command if reduce has such a thing. These are not reduce commands I wanted to read, but plain text lines separated by comma's that have text and numbers of them. Very basic thing to do in other CAS systems, but could not find a way to do this in Reduce. Thanks --Nasser |