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: Nasser M. A. <nm...@12...> - 2024-01-07 12:10:23
|
Fyi; As reference, this integral is #222 from Timofeev well known Problems. Here is link <https://12000.org/my_notes/CAS_integration_tests/reports/summer_2023_Rubi_4_17_3/test_cases/0_Independent_test_suites/10_Timofeev_Problems/reportsubsection242.htm> --Nasser On 1/7/2024 5:39 AM, Arthur Norman wrote: > On Sun, 7 Jan 2024, Arthur Norman wrote: >>> redcsl -w >>> Reduce (CSL, rev 6657), 10-Dec-2023 ... >>> >>> 1: int( >>> x*(1+x)^(2/3)*(1-x)^(1/2)/(-(1-x)^(5/6)*(1+x)^(1/3)+(1-x)^(2/3)*(1+x)^(1/2)),x); >>> Killed >>> After about 10-15 minutes. I am running this on Linux Manjaro inside >>> virtual box with 64 GB RAM for the VBox, and on fast PC. >> > This message is mainly for other Reduce maintainers. When I arrange to be > able to get a backtrace from this (which took be a little bit of fiddling, > but redefining systemgchook to raise an error dis the trick) I see a > fragment of the traceback saying as follows where there has been an > attempt to make progress via trig functions, where abominably large > integers are in play and I end up in a hugely deep recursion of !*multf. > This after only around 30 seconds of CPU time. The expression I see looks > as if it includes a cos(!!intvar2)^1364. Ha ha ha. > > Via "on trint" I can see it has started by shifting so that instead of > both x+1 and x-1 it has y and y-2 or some such and there is anther > conversion => 1-w^2. We get > > Start of Integration; integrand is > > 2 2/3 2 > 2*( - !intvar1 + 2) *!intvar1*( - !intvar1 + 1) > -------------------------------------------------------------------------- > 1/3 1/3 2 1/3 2 > !intvar1 *(!intvar1 *( - !intvar1 + 2) - sqrt( - !intvar1 + 2)) > > > and that prompts a conversion to > > Start of Integration; integrand is > > 1/3 2/3 2 2 > (4*cos(!intvar2) *2 *cos(!intvar2) *sin(!intvar2)*( - 2*cos(!intvar2) > + 1)) > > 1/3 1/3 > /(sqrt(2) *(sin(!intvar2) *cos(!intvar2)*sqrt(2) > > 1/3 2 1/3 2/3 > 1/3 > - sqrt(2) *( - cos(!intvar2) + 1) *cos(!intvar2) *2 > )) > > Determination of the differential field descriptor > gives the functions: > ((expt (cos !!intvar2) (quotient 1 3)) (expt (plus (minus (expt (cos > !!intvar2) 2)) 1) (quotient 1 3)) (expt (sin !!intvar2) (quotient 1 3)) > (sin !!intvar2) (cos !!intvar2) !!intvar2) > > after which things fairly repidly go ugly! > > Any ideas? > Arthur > > >> > -2006582604045247462173839524414111582012306138161916297721207009532444822043 >> )))))) >> Inside: transcendentalcase >> Arg1: ((((#1=(cos !!intvar2) . 4) ((#2=(expt #1# (quotient 1 3)) . 1) > ((#3=(e >> 2 (quotient 1 3)) . 2) ((#4=(sin !!intvar2) . 1) . -8)))) ((#1# . 2) > ((#2# . >> ((#3# . 2) ((#4# . 1) . 4))))) ((#1# . 1) (((expt #4# (quotient 1 3)) . > 1) ( >> =(expt #5=(sqrt 2) (quotient 1 3)) . 1) ((#5# . 1) . 1)))) ((#2# . 2) > (((expt >> plus (minus (expt #1# 2)) 1) (quotient 1 3)) . 1) ((#6# . 2) ((#3# . 1) > . -1) >> ) >> Arg2: !!intvar2 >> Arg3: nil >> Arg4: ((expt #1=(cos !!intvar2) (quotient 1 3)) (expt (plus (minus (expt > #1# >> 1) (quotient 1 3)) (expt #2=(sin !!intvar2) (quotient 1 3)) #2# #1# > !!intvar >> Arg5: ((expt 2 (quotient 1 3)) (expt #1=(sqrt 2) (quotient 1 3)) #1#) >> Inside: integratesq >> Arg1: ((((#1=(cos !!intvar2) . 4) ((#2=(expt #1# (quotient 1 3)) . 1) > ((#3=(e >> 2 (quotient 1 3)) . 2) ((#4=(sin !!intvar2) . 1) . -8)))) ((#1# . 2) > ((#2# . >> ((#3# . 2) ((#4# . 1) . 4))))) ((#1# . 1) (((expt #4# (quotient 1 3)) . > 1) ( >> =(expt #5=(sqrt 2) (quotient 1 3)) . 1) ((#5# . 1) . 1)))) ((#2# . 2) > (((expt >> plus (minus (expt #1# 2)) 1) (quotient 1 3)) . 1) ((#6# . 2) ((#3# . 1) > . -1) >> ) >> Arg2: !!intvar2 >> Arg3: nil >> Arg4: nil >> Calling transcendentalcase from integratesq >> Arg1: ((((#1=(expt (plus (minus (expt !!intvar1 6)) 2) (quotient 1 3)) . > 2) ( >> !!intvar1 . 10) . -6) ((!!intvar1 . 4) . 6))) ((#1# . 1) ((!!intvar1 . > 1) . 1 >> (((sqrt (plus (minus (expt !!intvar1 6)) 2)) . 1) . -1)) >> Arg2: !!intvar1 > |
From: Arthur N. <ac...@ca...> - 2024-01-07 12:09:24
|
The following, run via bootstrapreduce badint.red -l badint.log -k40M seems to show that the sink into insanity arises within a call to multoutdenr. This tried to remove roots from the denominator of an expression into the numerator by multiplying each by a conjugate of the denominator. The mix of various jolly exponents here has - I guess - got in in a twist so I finds a conjugate and multiplies only to find there are still roots in the denominator. So it tries again and again until memory is full and the world collapses. Now is not the moment for me to know how to fix this, but at least this is a failure in a short fragment of code that is trying to something that is understandable. The only change in this function definition since 1987 has been that if after tidying of the denominator is a negative integer then signed of numerator and denominator are flipped. So this behaviour has been there unreported for at least 36 years. The version in 1983 was all written in upper case letters and did not deal with the nth root cases - only the sqrt case. Perhaps this integral is not one that arises terribly often as a natural problem needing to be solved! I have little doubt that when somebody looks harder at the very least the infinite loop can be disposed of so that the integral can fail to be evaluated but in a sensible amount of time & space. Arthur ============================= on echo; int(x,x); % to get package loaded lisp verbos t; lisp enable!-errorset(3,3); tr transcendentalcase, sqrt2top, multoutdenr; on trint; symbolic procedure aftergcsystemhook u; error(1234, "gchappens"); int( x*(1+x)^(2/3)*(1-x)^(1/2)/(-(1-x)^(5/6)*(1+x)^(1/3)+(1-x)^(2/3)*(1+x)^(1/2)) ,x); quit; ============================= |
From: Arthur N. <ac...@ca...> - 2024-01-07 11:40:28
|
On Sun, 7 Jan 2024, Arthur Norman wrote: >> redcsl -w >> Reduce (CSL, rev 6657), 10-Dec-2023 ... >> >> 1: int( >> x*(1+x)^(2/3)*(1-x)^(1/2)/(-(1-x)^(5/6)*(1+x)^(1/3)+(1-x)^(2/3)*(1+x)^(1/2)),x); >> Killed >> After about 10-15 minutes. I am running this on Linux Manjaro inside >> virtual box with 64 GB RAM for the VBox, and on fast PC. > This message is mainly for other Reduce maintainers. When I arrange to be able to get a backtrace from this (which took be a little bit of fiddling, but redefining systemgchook to raise an error dis the trick) I see a fragment of the traceback saying as follows where there has been an attempt to make progress via trig functions, where abominably large integers are in play and I end up in a hugely deep recursion of !*multf. This after only around 30 seconds of CPU time. The expression I see looks as if it includes a cos(!!intvar2)^1364. Ha ha ha. Via "on trint" I can see it has started by shifting so that instead of both x+1 and x-1 it has y and y-2 or some such and there is anther conversion => 1-w^2. We get Start of Integration; integrand is 2 2/3 2 2*( - !intvar1 + 2) *!intvar1*( - !intvar1 + 1) -------------------------------------------------------------------------- 1/3 1/3 2 1/3 2 !intvar1 *(!intvar1 *( - !intvar1 + 2) - sqrt( - !intvar1 + 2)) and that prompts a conversion to Start of Integration; integrand is 1/3 2/3 2 2 (4*cos(!intvar2) *2 *cos(!intvar2) *sin(!intvar2)*( - 2*cos(!intvar2) + 1)) 1/3 1/3 /(sqrt(2) *(sin(!intvar2) *cos(!intvar2)*sqrt(2) 1/3 2 1/3 2/3 1/3 - sqrt(2) *( - cos(!intvar2) + 1) *cos(!intvar2) *2 )) Determination of the differential field descriptor gives the functions: ((expt (cos !!intvar2) (quotient 1 3)) (expt (plus (minus (expt (cos !!intvar2) 2)) 1) (quotient 1 3)) (expt (sin !!intvar2) (quotient 1 3)) (sin !!intvar2) (cos !!intvar2) !!intvar2) after which things fairly repidly go ugly! Any ideas? Arthur > -2006582604045247462173839524414111582012306138161916297721207009532444822043 > )))))) > Inside: transcendentalcase > Arg1: ((((#1=(cos !!intvar2) . 4) ((#2=(expt #1# (quotient 1 3)) . 1) ((#3=(e > 2 (quotient 1 3)) . 2) ((#4=(sin !!intvar2) . 1) . -8)))) ((#1# . 2) ((#2# . > ((#3# . 2) ((#4# . 1) . 4))))) ((#1# . 1) (((expt #4# (quotient 1 3)) . 1) ( > =(expt #5=(sqrt 2) (quotient 1 3)) . 1) ((#5# . 1) . 1)))) ((#2# . 2) (((expt > plus (minus (expt #1# 2)) 1) (quotient 1 3)) . 1) ((#6# . 2) ((#3# . 1) . -1) > ) > Arg2: !!intvar2 > Arg3: nil > Arg4: ((expt #1=(cos !!intvar2) (quotient 1 3)) (expt (plus (minus (expt #1# > 1) (quotient 1 3)) (expt #2=(sin !!intvar2) (quotient 1 3)) #2# #1# !!intvar > Arg5: ((expt 2 (quotient 1 3)) (expt #1=(sqrt 2) (quotient 1 3)) #1#) > Inside: integratesq > Arg1: ((((#1=(cos !!intvar2) . 4) ((#2=(expt #1# (quotient 1 3)) . 1) ((#3=(e > 2 (quotient 1 3)) . 2) ((#4=(sin !!intvar2) . 1) . -8)))) ((#1# . 2) ((#2# . > ((#3# . 2) ((#4# . 1) . 4))))) ((#1# . 1) (((expt #4# (quotient 1 3)) . 1) ( > =(expt #5=(sqrt 2) (quotient 1 3)) . 1) ((#5# . 1) . 1)))) ((#2# . 2) (((expt > plus (minus (expt #1# 2)) 1) (quotient 1 3)) . 1) ((#6# . 2) ((#3# . 1) . -1) > ) > Arg2: !!intvar2 > Arg3: nil > Arg4: nil > Calling transcendentalcase from integratesq > Arg1: ((((#1=(expt (plus (minus (expt !!intvar1 6)) 2) (quotient 1 3)) . 2) ( > !!intvar1 . 10) . -6) ((!!intvar1 . 4) . 6))) ((#1# . 1) ((!!intvar1 . 1) . 1 > (((sqrt (plus (minus (expt !!intvar1 6)) 2)) . 1) . -1)) > Arg2: !!intvar1 |
From: Arthur N. <ac...@ca...> - 2024-01-07 10:02:51
|
> redcsl -w > Reduce (CSL, rev 6657), 10-Dec-2023 ... > > 1: int( > x*(1+x)^(2/3)*(1-x)^(1/2)/(-(1-x)^(5/6)*(1+x)^(1/3)+(1-x)^(2/3)*(1+x)^(1/2)),x); > Killed > After about 10-15 minutes. I am running this on Linux Manjaro inside > virtual box with 64 GB RAM for the VBox, and on fast PC. 1: lisp verbos t; 0 2: on time; Time: 0 ms 3: int( 3: x*(1+x)^(2/3)*(1-x)^(1/2)/(-(1-x)^(5/6)*(1+x)^(1/3)+(1-x)^(2/3)*(1+x)^(1/2)) 3: ,x); +++ Garbage collection 1 (bignum(136)) after 12.90+0.00 seconds At gc end about 696.0 Mbytes of 16288.0 (4.3%) of heap is in use +++ Garbage collection 2 (internal ncons) after 22.56+0.45 seconds At gc end about 48.0 Mbytes of 16288.0 (0.3%) of heap is in use +++ Garbage collection 3 (internal acons) after 33.42+0.48 seconds At gc end about 1264.0 Mbytes of 16288.0 (7.8%) of heap is in use +++ Garbage collection 4 (internal cons) after 41.87+1.12 seconds At gc end about 2688.0 Mbytes of 16288.0 (16.5%) of heap is in use +++ Garbage collection 5 (internal list3) after 47.78+2.31 seconds At gc end about 3792.0 Mbytes of 16288.0 (23.3%) of heap is in use +++ Garbage collection 6 (internal cons) after 51.79+3.68 seconds At gc end about 4608.0 Mbytes of 18448.0 (25.0%) of heap is in use +++ Garbage collection 7 (internal cons) after 56.95+5.18 seconds At gc end about 5448.0 Mbytes of 21808.0 (25.0%) of heap is in use +++ Garbage collection 8 (bignum(248)) after 63.25+7.07 seconds At gc end about 6456.0 Mbytes of 25840.0 (25.0%) of heap is in use +++ Garbage collection 9 (internal cons) after 70.98+9.39 seconds At gc end about 7664.0 Mbytes of 30672.0 (25.0%) of heap is in use +++ Garbage collection 10 (bignum(224)) after 80.18+12.48 seconds At gc end about 9104.0 Mbytes of 36432.0 (25.0%) of heap is in use ... etc until so much of your poor machine's memory is consumed that it feels clogged - and eventually Reduce will give up. The fact that presenting this integral to the system leads to such extreme memory use us clearly pathological and right now I do not know in detail wht the poort thing is so messed up. If this was a naturally arising problem that a typical end-user had stumbled upon I might feel obliged to try to investigate, but my bet is that in the torture tests you have there may be more bad cases and I will not have time or energy to try to chase them all down. If you want to investigate yourself that would be GREAT because one of the better things about new users if we assist them is that some end up willing to do detailed bug hunting because that relates to their particular problems. And if they can then propose corrections that is even better! When debugging I often use "bootstrapreduce" rather than "redcsl" since it is less optimised so more info is available when things fail. You can then go "tr functionname;" to ask the system to tell you about all calls to that function. "on backtrace;" can lead to info about what was going on if things crash. And you interpret all those by reference to the source code which is of course where corrections should eventually end up. Arthur |
From: Arthur N. <ac...@ca...> - 2024-01-07 09:30:48
|
Reduce has a user interface built round a model where all variables hold algebraic formulae. Numbers are merely a special case of that. Lists and vectors are thought of in that context and mostly matrices are things defined once at the top level and that their elements are not much more than variables that one gets indexed access to. Was designed for users who were performing algebra and the emphasis of implementrers over the years have been that (and in some areas the support may now feel ancient but in others the speed and reliability may be good and the breadth of support fully adqequate). Some other systems take the view that they will not modify or simplift user input until explicitly asked to. Reduce has a fundamental model that where4 it can it will always concert formulae to a representation that is as canonical as it can. Well the area that applies most strongly is that brackets are (almost) always multiplied out and and terms in a formula are sorted (often alphabetically). Its response to different users wanting to see output in various formats is generally handled bt flags and the like that influence output presentation. eg "factor x;" causes output to display things as polynomials in x, and "on revpri;" changes whether high or low order terms come first. Neither of those influence what is going on inside the system when it calculates. Now I explain all this (again because I hope that material in the archive of the mailing list can help others in the future - ie my audience is not just you!) because that means that passing file names around and collecting string forms of expressions into lists is not the "expected" use case. Howver in some sense with Reduce one can claim that almost ANYTHING is possible. That is because it has these4 two layers - symbolic and algebraic modes. Algabraic mode is aimes as above at people who have a particular algebric problem that is more or less within the system's scope that they want solved. We perhaps believe that that covers the vast majority of users and you see that the manual explaining what is available for them is already quite bulky. Then there is symbolic mode which is for people who wish or need to work with strings, custom formatted output, resource limits, the detailed data structures that represent formulae (eg to assess their bulk, which is what I expect you mean by leafcount - but note that a discussion is needed there about what tree you are counting the leaves on and what constitutes a leaf), to use hash-tables and build new data structures that are special to their application. There is a degree of overlaps in what can be done in each mode - so in algebaic mode one can have procedures and work with lists and there are functions for operations like "give me the first term from this formula". But there is DRAMATICALLY greater flexibility when one moves to the lower level. Of course accessing that comes with a learning curve. Over the years a number of us have had experience assisting various mathematicians and scientists who have (algebraic) problems to cope with that, and the primers in the documentation represent some of that. But also the availability of the source code for browsing and to provide model fragments of code that maybe do things similar to what is needed. So for instance while Reduce is being built there has to be code that reads in thousand or so little files that make up its full source, with a master file (packages/packge.map) listing the names and locations of each module and each module typically starting with a statement that indicated the set of files that make it up, as in create!-package('(rlisp module newtok rsupport slfns superv tok xread lpri parser block form proc forstat loops statmisc smacro io infix switch where list array inter charname newtok1), nil); which arranges that when the "rlisp" package is built or rebuilt that 26 files with names like packages/rlisp/loops.red are all processed. Obviously the short name "loops" there is subject to bits ot string concatenation to get the full name of the file to be used. And there are functions for checking if particular files exist, looking at and comparing data-stamps and basically all the things that those who are looking for a reasonably general purpose programming language rather than a user interface aimed at algebra might need. If one goes to the top of the reduce source tree and goes scripts/testall.sh you will find that that runs a test file for each module that has one. It achieves this by inspecting packages/package.map to sort out the bunch pf package names and calls scripts/test1.sh for each. We do not expect novice users who start by looking at the algebraic capabilities of Reduce to be able to set up scripts like that in short order, and various details of it represent several iterations. That stuff is also not coded with a view to it being the cleanest neatest example of how to do things! But in terms of what you are now explaining it shows what some of us did in response to a related need. In a different style of doing things packages/support/remake.red involved passing a module name to a function, uising module2!-to!-file to derive an associates file name and then package!-remake builds or rebuilds that module. And building Reduce involves scripts that either as such or explicitly do that over and over again. For PSL the top level is orchestrated by shell scripting, for CSL it all happens within the system, using a capability that says "OK you have just done something interesting, but now do a full restart so that I can do the next step with a clean slate". You say "put the names of files in a list and iterate over it". So you see that both in testall.sh and in the PSL build scripts rather than making a list within Reduce and iterating it we just process each file one after the other. Eg rather than having list_of_files := '("file1" "file2" ...)$ we might have process "files"; process "file2"; or in "file1"; in "file2"; or go for f in file1 file2 ...; do redcsl $f -l $f.log; done at shell level. A great deal of what you have been asking about is not the solving of individual alghebraic problems. It is more system-oriented and the sense that I get is that you start with clear initial ideas about exactly what input and output formats you want, with those choices having been built up from your experiences with other systems. That can all be done in Reduce but at a cost of learning how to use it as a system programmer and developer not as a simple mode user. I will terminate this already too-lomg email with two further illustrations of Reduce flexibility. A few years ago I became interested in Rubi (bu Al Rich). He could provides a bunch of rewrite rules to perform integration. But they are supplied in Mathematica syntax. That is not as such helpful for Reduce - so I sat down and coded enough of a parser that it can parse the Mathematica stuff into data structues that can exist within Reduce. And if you look in packages/rubi_red you will see my response to reading a bunch of files - I have a line of code that calls the parse function on each. I had no thought of sitting putting the file-names in a list to iterate over in that that would not have shrunk the code much. The rubi experiemnt is then stalled because of a combination of me getting ditracted and the fact that the rules depend on the behaviour of Mathematica pattern matching. In that system I can not even in principle inspect the source code to reverse engineer exactly how the pattern matching works so I do not know just what is required. If things were the other way round ana Mathematica user needed to know EXACTLY how Reduce did something then they could start by using "trace" to watch function calls and data as it flowed through and then if they wanted they coulkd pick up the code wholesale and re-use it. The final example is also from some years ago while I was visiting a Maple-centric university. Because I have access to all of the software stack of Reduce I could add to the CSL Reduce some facilitis such that a version of reduce compiled as a loadable module could be loaded fromn within Maple and data passed backwards and forwards. Traces of that can seen in the file csl/cslbase/maple_interface.cpp and elsewhere in the CSL sources. I think that neither of those are for the feint-hearted but they may suggest to you that when one is ready to do a deep dive in Reduce is not as restricted or limited as you have perhaps gained as your first impression! Arthur On Sun, 7 Jan 2024, Nasser M. Abbasi wrote: > > in my script if I do > > ------------ > in "B.red"; > ------------ > > It works. Where B.red is file in same folder. > > But if I do > > ----------- > file_name := "B.red"; > in file_name; > ------------- > > It gives error > > +++ Error file could not be opened: "file_name" > > It looks like "in", "out" and "shut" commands want literal arguments. > But this is very limiting for me, as I need to pass the names of > the files to process in variables and not hard code the file names, > as I have 100's of files that I need to put in a list > and loop over. > > Is there a way around this? > > Reduce (CSL, rev 6657), 10-Dec-2023 > > 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-07 00:02:15
|
in my script if I do ------------ in "B.red"; ------------ It works. Where B.red is file in same folder. But if I do ----------- file_name := "B.red"; in file_name; ------------- It gives error +++ Error file could not be opened: "file_name" It looks like "in", "out" and "shut" commands want literal arguments. But this is very limiting for me, as I need to pass the names of the files to process in variables and not hard code the file names, as I have 100's of files that I need to put in a list and loop over. Is there a way around this? Reduce (CSL, rev 6657), 10-Dec-2023 Thanks, --Nasser |
From: Arthur C. N. <ac...@ca...> - 2024-01-06 23:33:34
|
Algint is the output of a PhD project. Almost only it's originator will be able to maintain it. ________________________________ From: Nasser M. Abbasi <nm...@12...> Sent: Saturday, January 6, 2024 9:18:12 PM To: red...@li... <red...@li...>; Nasser M. Abbasi <nm...@12...> Subject: [Reduce-algebra-developers] using load_package "algint"; makes some integrals hang fyi; I've noticed that loading package load_package "algint"; Makes some integrals hang. Therefore for now I will not load it as I do not have timeout in place to prevent the hangs. I still need to learn how to set timeout. Here is an example load_package "algint"; int(1/(1+(x+(x^2+1)^(1/2))^(1/2)),x); Hangs I've I run the same command without first loading this package it will finish fast (but not solve the integral) but at least will not hang. --Nasser _______________________________________________ Reduce-algebra-developers mailing list Red...@li... https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Freduce-algebra-developers&data=05%7C02%7Cacn1%40universityofcambridgecloud.onmicrosoft.com%7C9dd32c2c853e43dcddfa08dc0f03d221%7C49a50445bdfa4b79ade3547b4f3986e9%7C1%7C0%7C638401756420077558%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C62000%7C%7C%7C&sdata=64SjaQTJkfh%2B4VScLlBRFRi5gkARhXURzql6lx2UFiQ%3D&reserved=0<https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers> |
From: Arthur C. N. <ac...@ca...> - 2024-01-06 23:33:33
|
Have you gone lisp verbos t as previously suggested to watch memey turnover ________________________________ From: Nasser M. Abbasi <nm...@12...> Sent: Saturday, January 6, 2024 10:18:42 PM To: red...@li... <red...@li...> Subject: [Reduce-algebra-developers] sometimes reduce process gets killed on its own FYI; --------------------- redcsl -w Reduce (CSL, rev 6657), 10-Dec-2023 ... 1: int( x*(1+x)^(2/3)*(1-x)^(1/2)/(-(1-x)^(5/6)*(1+x)^(1/3)+(1-x)^(2/3)*(1+x)^(1/2)),x); Killed > After about 10-15 minutes. I am running this on Linux Manjaro inside virtual box with 64 GB RAM for the VBox, and on fast PC. Build reduce from source to use CSL. You might want to make sure to save all your work before running this command as it seems to consume all CPU and Linux became not usable until the reduce process terminates on its own. --Nasser _______________________________________________ Reduce-algebra-developers mailing list Red...@li... https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Freduce-algebra-developers&data=05%7C02%7Cacn1%40universityofcambridgecloud.onmicrosoft.com%7C3875feb15ded4960fe3108dc0f058221%7C49a50445bdfa4b79ade3547b4f3986e9%7C1%7C0%7C638401763528983677%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C62000%7C%7C%7C&sdata=%2B%2FWXOja0kBY88yNrDzmhMWfM1wgjFXe%2BwWBO7znUrUs%3D&reserved=0<https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers> |
From: Arthur C. N. <ac...@ca...> - 2024-01-06 23:31:57
|
Consider "on rounded;". ________________________________ From: Nasser M. Abbasi <nm...@12...> Sent: Saturday, January 6, 2024 1:19:00 PM To: red...@li... <red...@li...>; Nasser M. Abbasi <nm...@12...> Subject: [Reduce-algebra-developers] How to make write 0.002 write 0.002 and not 1/500 ? Hello; Is it possible to make write not convert decimal to rational? ---------------------------- 3: symbolic operator time; 4: start_time := time(); start_time := 19 5: int(sin(x),x); 6: time_taken := time() - start_time; time_taken := 2 7: time_taken := evalf(time_taken/1000); time_taken := 0.002 8: write time_taken; 1 ----- 500 ----------------------- I looked at help for write but see no formating option. Thanks --Nasser _______________________________________________ Reduce-algebra-developers mailing list Red...@li... https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Freduce-algebra-developers&data=05%7C02%7Cacn1%40universityofcambridgecloud.onmicrosoft.com%7C0884f7e94e8e441557d308dc0efbfc3f%7C49a50445bdfa4b79ade3547b4f3986e9%7C1%7C0%7C638401722769297263%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C62000%7C%7C%7C&sdata=ALPfn4MbaIjOq7sMXOrNUK69y6kqGGFSj%2BakKuNlwF4%3D&reserved=0<https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers> |
From: Nasser M. A. <nm...@12...> - 2024-01-06 22:18:56
|
FYI; --------------------- redcsl -w Reduce (CSL, rev 6657), 10-Dec-2023 ... 1: int( x*(1+x)^(2/3)*(1-x)^(1/2)/(-(1-x)^(5/6)*(1+x)^(1/3)+(1-x)^(2/3)*(1+x)^(1/2)),x); Killed > After about 10-15 minutes. I am running this on Linux Manjaro inside virtual box with 64 GB RAM for the VBox, and on fast PC. Build reduce from source to use CSL. You might want to make sure to save all your work before running this command as it seems to consume all CPU and Linux became not usable until the reduce process terminates on its own. --Nasser |
From: Nasser M. A. <nm...@12...> - 2024-01-06 22:06:50
|
fyi; I've noticed that loading package load_package "algint"; Makes some integrals hang. Therefore for now I will not load it as I do not have timeout in place to prevent the hangs. I still need to learn how to set timeout. Here is an example load_package "algint"; int(1/(1+(x+(x^2+1)^(1/2))^(1/2)),x); Hangs I've I run the same command without first loading this package it will finish fast (but not solve the integral) but at least will not hang. --Nasser |
From: Nasser M. A. <nm...@12...> - 2024-01-06 21:28:15
|
Currently my script has matrix of data I want to process. So the matrix is inside the script itself. But I'd like to separate the matrix from the script, and just have the script read the matrix from a file, as I will have many different matrices to process. This is what I have now: ---- file.red----- load_package "algint"; off nat; % off echo; linelength 4000; COMMENT These are integration problems to solve; matrix A; A:=mat(( (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 ), ( (1+exp(x))*exp(exp(x)+x)/(exp(x)+x),x ), ( exp(1+1/ln(x))*(-1+ln(x)^2)/ln(x)^2,x ), ( exp(x+1/ln(x))*(-1+(1+x)*ln(x)^2)/ln(x)^2,x ) )$ nrows := part(length(A),1)$ etc.., the rest of the script.. ------------------------- Which I run using redcsl < file.red WHat I'd like to do is put the matrix in its own file. say A.mat ------- A.mat--------------- matrix A; A:=mat(( (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 ), ( (1+exp(x))*exp(exp(x)+x)/(exp(x)+x),x ), ( exp(1+1/ln(x))*(-1+ln(x)^2)/ln(x)^2,x ), ( exp(x+1/ln(x))*(-1+(1+x)*ln(x)^2)/ln(x)^2,x ) )$ -------------------------------- And read file.red read that file at the start. But I do not see a command to do this looking at the manual PDF file. The matrix will always be called variable A if this makes any difference and the input file can be A.mat or any other name. Is this possible to do in Reduce? I am using rev 6657 on Linux. In Maple, I just do read file.mpl And this reads any Maple expressions/variables in file.mpl Thanks --Nasser |
From: Nasser M. A. <nm...@12...> - 2024-01-06 21:27:29
|
I found it. So I am ok. It is in "A.mat"; I just needed to add end; At the end of my A.mat to make reduce happy. Strange I could not find this command in the manual. But I just saw the help pages that come with Reduce which is much easier to use than the manual. --Nasser On 1/6/2024 1:50 AM, Nasser M. Abbasi wrote: > Currently my script has matrix of data I want to process. > > So the matrix is inside the script itself. > > But I'd like to separate the matrix from the script, > and just have the script read the matrix from a file, > as I will have many different matrices to process. > > This is what I have now: > > ---- file.red----- > > load_package "algint"; > off nat; > % off echo; > linelength 4000; > > COMMENT These are integration problems to solve; > > matrix A; > A:=mat(( (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 ), > ( (1+exp(x))*exp(exp(x)+x)/(exp(x)+x),x ), > ( exp(1+1/ln(x))*(-1+ln(x)^2)/ln(x)^2,x ), > ( exp(x+1/ln(x))*(-1+(1+x)*ln(x)^2)/ln(x)^2,x ) )$ > > > nrows := part(length(A),1)$ > > etc.., the rest of the script.. > ------------------------- > > Which I run using > > redcsl < file.red > > WHat I'd like to do is put the matrix in its own file. > say A.mat > > ------- A.mat--------------- > matrix A; > A:=mat(( (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 ), > ( (1+exp(x))*exp(exp(x)+x)/(exp(x)+x),x ), > ( exp(1+1/ln(x))*(-1+ln(x)^2)/ln(x)^2,x ), > ( exp(x+1/ln(x))*(-1+(1+x)*ln(x)^2)/ln(x)^2,x ) )$ > -------------------------------- > > And read file.red read that file at the start. > > But I do not see a command to do this looking at the manual PDF file. > > The matrix will always be called variable A if this makes > any difference and the input file can be A.mat or any other name. > > Is this possible to do in Reduce? I am using rev 6657 on > Linux. > > In Maple, I just do > > read file.mpl > > And this reads any Maple expressions/variables in file.mpl > > Thanks > --Nasser |
From: Nasser M. A. <nm...@12...> - 2024-01-06 21:10:42
|
Hello; Is it possible to make write not convert decimal to rational? ---------------------------- 3: symbolic operator time; 4: start_time := time(); start_time := 19 5: int(sin(x),x); 6: time_taken := time() - start_time; time_taken := 2 7: time_taken := evalf(time_taken/1000); time_taken := 0.002 8: write time_taken; 1 ----- 500 ----------------------- I looked at help for write but see no formating option. Thanks --Nasser |
From: Nasser M. A. <nm...@12...> - 2024-01-05 18:10:13
|
On 1/5/2024 10:29 AM, Francis Wright wrote: > Hi, Nasser > > I think this strange line breaking is at least partly a consequence of using write to output a list. I'm working on an alternative version of the code you sent me that doesn't use a list and also doesn't produce the strange line breaks. I'll let you have a copy once I have made a bit more progress. > > Do you want the "{" and "}" characters and the final "$" in the output? Actually, I do not. I was thinking istead of using fprintf to write formatted output to file (like I do with other CAS systems), which reduce does not have, is to just use WRITE to print to the screen each record (i.e. list) and pipe that to a file. Each line (i.e list) contains the result of running one integral by Reduce. It has fields that show the inegral number, CPU time used, leaf count, result (0 or 1 for failed or passed) the actual integral, the anti-derivative, latex for the anti, command used, etc... So if there are 10 integrals, there will be 10 lines. Each field is comma separated. There are 14 fields. This is what I do now in the script I send in last email in the list I called M. Here is description of each line <https://12000.org/my_notes/CAS_integration_tests/indexsection4.htm> Which I emailed you directly before. The script also describes each field type. It is CSV file. It has strings and integers with comma separated. I attach an actual such CSV generated by Mathematica for a test file I have of only 6 integrals called m_listA.txt I still need to convert the anti-derivative generated by Reduce to Latex then convert that to string. Also the anti-derivative as is (no Latex conversion) but convert to string. If I can figure how to convert an symbolic expression to string in Reduce, that will go long way. I also attached the script for sympy using python showing the formatting of output. You can't run this, but this shows you how it is done using python's write() command. (Incidentally, the final "$" is caused by using "off nat".) And shouldall the mathematical output be in the form of LaTeX, or do you want some of it in the form of normal REDUCE input? > Some are normal Reduce input. But encoded as string as you see in the attached file example for Mathematica. There is a an SQL database based on free databse SQLite3 which any one can download and look at other CAS system result here <https://12000.org/my_notes/CAS_integration_tests/reports/summer_2023_Rubi_4_17_3/DATA_BASE/index.htm> If I can get the output I need from Reduce, I will be able to add Reduce to the independent CAS integration test for the next version. If not, then will not be able to do it. > I'm still not convinced that string concatenation is necessary, but if it is then I'll show you how to do it. I do not need string concatenation actually, if I can figure how to convert reduce to string directly. Thanks for help. Feel free to let me know if you need any other info. I'd like to add Reduce, but I never used it before in my life. Just found it is at sourceforge last week. It will good to see how its integrate compare to the other CAS systems if possible. --Nasser > > Francis > > ________________________________ > From: Nasser M. Abbasi <nm...@12...> > Sent: 05 January 2024 9:49 AM > To: red...@li... <red...@li...> > Subject: [Reduce-algebra-developers] why command write of a list sometimes display the list on multiple lines on screen vs. all the list on same line? > > I have list, which in the attached script I print on to the terminal using > > write M; > > Where M is the list. > > Sometimes it displays on the terminal on one line as expected. > sometimes it displays each entry in the list on separate line. > > Here is screen shot attached. > > I added > > off output; > linelength(1000); > > At the top of my script in order to only see explicit output > from the "write" command and nothing else as the script runs. > > But I still see numbers 1: 2: 3: etc... print at the start of the > script. why is that? > > Please see the script file.red attached. > > I run it as follows > > redcsl < file.red > > I am using Reduce (CSL, rev 6657), 10-Dec-2023 on Linux > which I build from source code. (Thanks to Francis Wright for > sending me link to the source tar file as it was not easy to > find it at sourceforge). > > What do I need to change in the script so each list is printed > on one line, no matter how long it is? > > Thanks > --Nasser > |
From: Francis W. <f.j...@li...> - 2024-01-05 17:05:02
|
Hi, Nasser I think this strange line breaking is at least partly a consequence of using write to output a list. I'm working on an alternative version of the code you sent me that doesn't use a list and also doesn't produce the strange line breaks. I'll let you have a copy once I have made a bit more progress. Do you want the "{" and "}" characters and the final "$" in the output? (Incidentally, the final "$" is caused by using "off nat".) And should all the mathematical output be in the form of LaTeX, or do you want some of it in the form of normal REDUCE input? I'm still not convinced that string concatenation is necessary, but if it is then I'll show you how to do it. Francis ________________________________ From: Nasser M. Abbasi <nm...@12...> Sent: 05 January 2024 9:49 AM To: red...@li... <red...@li...> Subject: [Reduce-algebra-developers] why command write of a list sometimes display the list on multiple lines on screen vs. all the list on same line? I have list, which in the attached script I print on to the terminal using write M; Where M is the list. Sometimes it displays on the terminal on one line as expected. sometimes it displays each entry in the list on separate line. Here is screen shot attached. I added off output; linelength(1000); At the top of my script in order to only see explicit output from the "write" command and nothing else as the script runs. But I still see numbers 1: 2: 3: etc... print at the start of the script. why is that? Please see the script file.red attached. I run it as follows redcsl < file.red I am using Reduce (CSL, rev 6657), 10-Dec-2023 on Linux which I build from source code. (Thanks to Francis Wright for sending me link to the source tar file as it was not easy to find it at sourceforge). What do I need to change in the script so each list is printed on one line, no matter how long it is? Thanks --Nasser |
From: Arthur N. <ac...@ca...> - 2024-01-05 16:51:56
|
On Fri, 5 Jan 2024, Nasser M. Abbasi wrote: > I have list, which in the attached script I print on to the terminal using > > write M; > > Where M is the list. > > Sometimes it displays on the terminal on one line as expected. > sometimes it displays each entry in the list on separate line. > > Here is screen shot attached. > > I added > > off output; > linelength(1000); > > At the top of my script in order to only see explicit output > from the "write" command and nothing else as the script runs. > > But I still see numbers 1: 2: 3: etc... print at the start of the > script. why is that? > > Please see the script file.red attached. > > I run it as follows > > redcsl < file.red > > I am using Reduce (CSL, rev 6657), 10-Dec-2023 on Linux > which I build from source code. (Thanks to Francis Wright for > sending me link to the source tar file as it was not easy to > find it at sourceforge). > > What do I need to change in the script so each list is printed > on one line, no matter how long it is? > > Thanks > --Nasser > If you drill down you will find the following code... put('list,'prifn,'listpri); symbolic procedure listpri l; % This definition is basically that of INPRINT, except that it % decides when to split at the comma by looking at the size of % the argument. begin scalar orig,split,u; u := l; l := cdr l; prin2!* get('!*lcbkt!*,'prtch); % Do it this way so table can change. orig := orig!*; orig!* := if posn!*<18 then posn!* else orig!*+3; if null l then go to b; split := treesizep(l,40); % 40 is arbitrary choice. a: maprint(negnumberchk car l,0); l := cdr l; if null l then go to b; oprin '!*comma!*; if split then terpri!* t; % <<<<<<<<<<<<< go to a; b: prin2!* get('!*rcbkt!*,'prtch); % terpri!* nil; orig!* := orig; return u end; and who put that in or last edited it is hard to tell, but I note the general copyright notice on the file gives the year as 1987 - so you may have some trouble. However when I dig back I find that magic code in Reeduce 3.3 files from 1987... So the answer is basically that back then output was to terminals and line printers for inspection and grossly over-long lines were not viewed as helpful, and that is a HACK that back then made the system nicer for general users. Since output that has super-long lines can not be viewed as human readable I would tend not to fuss about the line breaks. But if I did I could just enter a copy of the above code with the "split" related lines removed. And ask very politely if the maintainers would consider adding a flag that says "off splitverylonglists;" by putting an "if !*splitverylonglists then" in front of those few lines. The excess prompts are because you are piping input in via stdin, so each line is seen as a fresh input line deserving a prompt. The use of "in" to read a file or for the csl version going "redcsl inputfile.red" (note without any "<") may make life feel better. I offer a slightly reworked file.red for your delight... This shows that when one becomes a Reduce expert all sorts of specialist facilities become available. But these are aimed mainly at people who are implementing bodies of code to support new sorts of algebra etc (or indeed who are writing more or less elaborate test scripts). You keep mentioning Maple and Mathematica - I use neither of which and I do not have a budget to purchase expensive software! Eg the Maple Personal license at £221 may not be used for academic or non-profit use. I am not a student and anyway the cheaper student license prohibits use for research. So I would need to look at the Academic Single User license at £970. It looks as if Mathematica starts at £155 per year for online access or their most popular option is at £318 or £160 per year. Well actually for Mathematica my best option is to but a Raspberry Pi... not as fast and less memory than my main machine has but cheaper! But then compare and observe that Reduce is Open Source under about as permissive license as you can find. You can easily fetch all the sources if you need to build that way by pointing subversion at sourceforge, but there are (irregular) snapshots both of binaries for Windows, Linux and Mac and source. As to documentation, we do not have a cluster of hired documentation maintainance people, so I hope people will accept that the 1200 pages of manual that we have represents some work having been done on that. My feeling is that at that size it is hideously hard to find things just because there is so much. But I do not know how to deal with that challenge. Open source has some strengths but also weaknesses. A strength is that unlike the situation with the commercial offerings anybody can inspect all the code to find what capabilities are available, and the test/demo scripts (files with names of the form *.tst" and their associated *.rlg logs) illustrate facilities in ways that can be much more concrete than the manual. And comments in the source code may sometimes be the nearest to the manual that bits of documentation have got. Obviously the matching downside is that the full explanation is to be taken to include all that source code which is hard to get into and amazingly bulky, and that without a room full of people paid to refine documentation and user interface things develop based on perceived demand. With the sort of demand that causes an individual to take things into their own hands the strongest driver. So without doubt Reduce does not have document processing, graphing and publication facilities like the commercial offerings, nor a notebook-style GUI etc. SOME of its algebraic capabilities are a decent match for the rest of the field, we believe that some win but others represent technology from perhaps decades ago. The extent to which that matters depends critically on the particular problem you are trying to solve! If we do well we do well. If we do not then it is open to anybody to contribute enhancements, and they have the capability of making changes as deep inside the system as they need to. But being a stingy person without a body that funds my activity I still feel happy where I am.... off output; %load_package "algint"; % only try if actually needed! off nat; linelength(1000); % The fact that I have the following bunch of "symbolic operator" % statements points to this code wanting to do things rather % different from casual users, and that the code wants to use % various system-level facilities and it really therefore % wants to be coded in symbolic mode where there is finer % control over everything. symbolic operator time; symbolic operator printf; symbolic operator bldmsg; symbolic operator flatsizec; symbolic operator concat; COMMENT These are integration problems to solve; A := { % A list is nicer than a matrix I think {sin(x), x}, {1/(x^12+x^2), x}, {1/x*cos(x)*(1+x)^2+tan(x)*exp(x), x}, {sin(x)*exp(x), x}, {cos(x)*(1+x), x}, {1/(x^4+1), x}, {cos(x)*(1+x)^2+tan(x)*exp(x), x} }; COMMENT M is list which holds result for each integral. This is description of each entry in the list item 1 integer. The integral number item 2 integer. 1 or 0 depending is solved or not item 3 integer. leaf size of antiderivative. 0 if failed. item 4 integer. place holder. Put 0 for now. item 5 string representation of the CPU time. How long it took to do the integration. item 6 string. place holder. Put " " for now. item 7 string. The command used to do the integration as string. for example "int( sin(x),x)". item 8 string. The antiderivative produced in Latex. For now use " " until I figure out how to do this in Reduce item 9 string. Place holder. Use " " for now. item 10 integer. Place holder. Use 0 for now. item 11 string. The actual anti-derivative produced as string. Use " " for now until I figure out how to do this in Reduce item 12 string. Grade of anti-derivative. Use "B" for reduce. item 13 string. use " " for Reduce. item 14 integer. use 0 for Reduce. ; counter := 0; foreach p in A do begin scalar start_time, time_used, anti; % To limit the scope of these % How to set timelimit on int command? % Messy unless in symbolic mode % eg csl/cslbase/buildreduce.lsp uses limits for profiling runs. start_time := time(); anti := int(first p, second p); time_used := time() - start_time; M:={ % Repeatedly appending items one at a time looks clumsy. counter := counter+1, if freeof(anti, int) then 1 else 0, flatsizec anti, %field 3. 0, %field 4. Not used; time_used, %field 5. CPU time used """N/A""", %field 6. not used. bldmsg("""int(%@p, %@p)""", first p, second p), %field 7. command used. % Note bldmsg mostly for internal use so % a bit cryptic here, but does the job! """\\int \\,dx""", """N/A""", %field 9. Not used. Place holder 0, %field 10. Not used. Place holder bldmsg("""%@p""", anti), %field 11. actual antiderivative in double quotes. % Getting things in LaTeX form would be % feasible but is much deeper into symbolic % mode. """B""", %field 12. OK as is. use "B"; """N/A""", %field 13. OK as is. use "N/A"; 0}; %field 13. OK as is. printf("%@p", M); %display the row out "file.output"; printf("%@p%n", M); out t; % Send to the file end; end; ============================= Arthur |
From: Alan B. <ala...@gm...> - 2024-01-05 16:00:39
|
Note that there is much useful documentation in "InsideReduce", "Symbolic Mode Primer" and "Standard Lisp Report" in .../doc/primers. Note however that some prior knowledge of Lisp is necessary. There are many textbooks on Lisp, but be aware there may be some differences in detail depending on the dialect of Lisp described. Two vintage texts that I have found useful are: RLisp 88 by Jed Marti World Scientific (1993) Lisp by PH Winston & BKP Horn Addison-Wesley (1981) See my further comments below in red. AB On 05/01/2024 10:54, Nasser M. Abbasi wrote: > if I write > >> redcsl -w > Reduce (CSL, rev 6657), 10-Dec-2023 ... > > 1: a:="hello"; > 2: b:="world"; > > How could make new variable "helloworld" by > concatenating a and b? > > I can't find such command in the manual or > by searching. > The following text appears in InsideReduce in the primers section of the Reduce documentation. Perhaps the easiest suggestion for somebody who want to get started with string manipulation is to note that the function explode2 converts a string into a list of its constituent characters and functions like compress and list2string can be used to convert in the other direction. Any manner of string searching or concatenation becomes straightforward when it is performed on lists of characters. > Do I have to write lisp code to do this? if so, > I know nothing about lisp. I also do not know > how to call lisp from Reduce top level. From Reduce top-level use symbolic; or lisp; Then use algebraic; to return to algebraic mode. Individual commands may be prefixed with symbolic or lisp if you only want a few commands executing in symbolic mode > > I have a new to make string in Reduce by concatenating > other string. This is easy to do in Maple and Mathematica > using the cat function and using <> in Mathematica. > > Does Reduce have such build in command? > > Thanks, > --Nasser > > > _______________________________________________ > Reduce-algebra-developers mailing list > Red...@li... > https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers |
From: Alan B. <ala...@gm...> - 2024-01-05 15:07:32
|
See my comments below in red. Alan Barnes On 05/01/2024 09:49, Nasser M. Abbasi wrote: > I have list, which in the attached script I print on to the terminal > using > > write M; > > Where M is the list. > > Sometimes it displays on the terminal on one line as expected. > sometimes it displays each entry in the list on separate line. Not sure why this happens (maybe acn can elucidate) -- Reduce was originally developed for interactive use and consequently tries to break long lines at meaningful points -- not always successfully. > > Here is screen shot attached. > > I added > > off output; > linelength(1000); > > At the top of my script in order to only see explicit output > from the "write" command and nothing else as the script runs. > > But I still see numbers 1: 2: 3: etc... print at the start of the > script. why is that? > > Please see the script file.red attached. > > > I run it as follows > > redcsl < file.red > It is better to start Reduce (with redcsl or redpsl according to taste) and then do #000000 in "file.red"$ Output from the individual commands in the file can be controlled by using semicolon or dollar as desired. > I am using Reduce (CSL, rev 6657), 10-Dec-2023 on Linux > which I build from source code. (Thanks to Francis Wright for > #0000#00000000 > sending me link to the source tar file as it was not easy to > find it at sourceforge). > > What do I need to change in the script so each list is printed > on one line, no matter how long it is? > > 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-05 11:36:01
|
On 1/4/2024 11:11 AM, Francis Wright wrote: > There is also the function with!-timeout defined in "rlisp/inter.red", which I presume is portable, at least between CSL and PSL, and might be closer to what Nasser is looking for. > > Francis Could you please show a small example of how to use this function? I see in the inter.red this smacro procedure with!-timeout(n, u); (lambda !~ott!~; (lambda trap!-time!*; << trap!-time!* := time() + fix n; if numberp !~ott!~ and trap!-time!* > !~ott!~ then trap!-time!* := !~ott!~; catch('!@timeout!@, u . nil)>>)(nil)) (trap!-time!-value()); But have no idea how to use this in my script. How would the code looks like if I want to set a time out on the call to int() for say 30 seconds and find out if it timed out or not? As I showed before, in Maple I do this using try anti_derivative := timelimit(30, int(sin(x),x) ); print(" did not time out."); catch: print("opps, timed out., Failed"); end try; What will the code in Reduce look like using the function with!-timeout ? I learn better by seeing an example. Thanks --Nasser > > ________________________________ > From: Arthur Norman <ac...@ca...> > Sent: 04 January 2024 9:48 AM > To: Nasser M. Abbasi <nm...@12...> > Cc: red...@li... <red...@li...> > Subject: Re: [Reduce-algebra-developers] Does reduce have a way to set timelimit on an operation? > > 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 > > > > _______________________________________________ > Reduce-algebra-developers mailing list > Red...@li... > https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers > |
From: Nasser M. A. <nm...@12...> - 2024-01-05 11:24:34
|
if I write >redcsl -w Reduce (CSL, rev 6657), 10-Dec-2023 ... 1: a:="hello"; 2: b:="world"; How could make new variable "helloworld" by concatenating a and b? I can't find such command in the manual or by searching. Do I have to write lisp code to do this? if so, how? I know nothing about lisp. I also do not know how to call lisp from Reduce top level. I have a new to make string in Reduce by concatenating other string. This is easy to do in Maple and Mathematica using the cat function and using <> in Mathematica. Does Reduce have such build in command? Thanks, --Nasser |
From: Nasser M. A. <nm...@12...> - 2024-01-05 10:54:55
|
I have list, which in the attached script I print on to the terminal using write M; Where M is the list. Sometimes it displays on the terminal on one line as expected. sometimes it displays each entry in the list on separate line. Here is screen shot attached. I added off output; linelength(1000); At the top of my script in order to only see explicit output from the "write" command and nothing else as the script runs. But I still see numbers 1: 2: 3: etc... print at the start of the script. why is that? Please see the script file.red attached. I run it as follows redcsl < file.red I am using Reduce (CSL, rev 6657), 10-Dec-2023 on Linux which I build from source code. (Thanks to Francis Wright for sending me link to the source tar file as it was not easy to find it at sourceforge). What do I need to change in the script so each list is printed on one line, no matter how long it is? Thanks --Nasser |
From: Francis W. <f.j...@li...> - 2024-01-04 20:11:57
|
You can get the time taken for a computation in millisecond in the REDUCE variable time_taken like this: % Make the Lisp time function available in algebraic mode. % It returns CPU time since the program started in milliseconds as an integer. symbolic operator time; start_time := time(); % Evaluate an integral (for example)... time_taken := time() - start_time; Francis ________________________________ From: Nasser M. Abbasi <nm...@12...> Sent: 04 January 2024 1:09 AM To: red...@li... <red...@li...>; Nasser M. Abbasi <nm...@12...> Subject: [Reduce-algebra-developers] How to use on time; in reduce to record time used for a command? 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 _______________________________________________ Reduce-algebra-developers mailing list Red...@li... https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers |
From: Arthur N. <ac...@ca...> - 2024-01-04 17:34:39
|
On Thu, 4 Jan 2024, Francis Wright wrote: > There is also the function with!-timeout defined in "rlisp/inter.red", which I presume is portable, at least between CSL and PSL, and might be closer to what Nasser is looking for. > > Francis > Thank you - I had forgotten that. Observe that it works by instating a hook function that is called after each garbage collection, so if Reduce has loads of memory it may take a while before the next garbage collection happens, but by virtue of that it works under either CSL or PSL. Arthur |
From: Francis W. <f.j...@li...> - 2024-01-04 17:11:26
|
There is also the function with!-timeout defined in "rlisp/inter.red", which I presume is portable, at least between CSL and PSL, and might be closer to what Nasser is looking for. Francis ________________________________ From: Arthur Norman <ac...@ca...> Sent: 04 January 2024 9:48 AM To: Nasser M. Abbasi <nm...@12...> Cc: red...@li... <red...@li...> Subject: Re: [Reduce-algebra-developers] Does reduce have a way to set timelimit on an operation? 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 _______________________________________________ Reduce-algebra-developers mailing list Red...@li... https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers |