Replace ln by log in rule for definite integral of 1/log(x)
You should update your Reduce installation: that particular problem was corrected in rev 6689. Rainer
Housekeeping in PSL tree.
fyi; I think I found a workaround, so I am set now. I simply added y; On the line after load_package specfn; in the script and this seems to worked. It read this line as the answer. Now I get no error from the int() command. --Nasser On 4/18/2024 4:19 PM, Nasser M. Abbasi wrote: I need to integrate int(Lambert_W(x),x); But in script, when I try to load specfn it gives prompt to decalre ln operator. How do I automate this to say Y ? --------- on Linux terminal --------------- redcsl -w Reduce (CSL,...
I need to integrate int(Lambert_W(x),x); But in script, when I try to load specfn it gives prompt to decalre ln operator. How do I automate this to say Y ? --------- on Linux terminal --------------- redcsl -w Reduce (CSL, rev 6687), 9-Jan-2024 ... 1: load_package specfn; Declare ln operator ? (Y or N) Since script does not answer, it returns error on next command int(Lambert_W(x),x); +++ Error unset variable: x Is there a way to tell tell it YES in the command without being prompted? I am doing...
More cleanup in PSL tree
Towards unicode support in PSL.
More svn:executable properties to remove
A bit of housecleaning: remove svn:executable properties on some source files.
Forgot to set svn:keywords property for boot.sl
Add copyright notice and $Id$ header to PSL Reduce build files.
Web REDUCE
OK, now it works! Il giorno 15 apr 2024, alle ore 20:06, Rainer Schöpf schoepf@users.sourceforge.net ha scritto: status: open --> closed assigned_to: Rainer Schöpf Group: --> Comment: Hi, you found a bug in the build process on Windows. There are two very similar files compat.b and pslcompat.b where there should have only been only pslcompat.b. In fact, pslcompat.b is the newer version, but both were used leading to the error. I have renamed compat.b to compat-old.b so that it can no longer interfere...
Segmentation Violations in Windows 10 X86_64 r6762 PSL-Reduce
Hi, you found a bug in the build process on Windows. There are two very similar files compat.b and pslcompat.b where there should have only been only pslcompat.b. In fact, pslcompat.b is the newer version, but both were used leading to the error. I have renamed compat.b to compat-old.b so that it can no longer interfere with the build process. I will commit a more general correction later. Everything should now build without errors, but you have to either build from scratch (i.e. remove the pslbuild...
Rename old compat.b file for mingw-w64: it coflicts with pslcompat.sl
Segmentation Violations in Windows 10 X86_64 r6762 PSL-Reduce
Web REDUCE mobile version
Emscripten Makefile
Make SETcc opcodes known to x86/x86_64 lisp disassembler (cont)
Correction to psltest function in test script
Another typo in a comment
Typo corrected
Correction to previous checkin
Update of regression log file because of additional rules in Reduce.
Correction for problem reported in
Remove some old unused files from PSL source tree.
Build the emscripten version with an explicity stack size since a fairly recent
Make SETcc opcodes known to x86_64 disassembler
This is because I have just reminded myself of something that I am now finding helpful. With the CSL version if you go off comp; symbolic procedure new_or_replacement_function(args); ...; then go "traceset '(new_or_replacement_function);" then each time an assigmnt is performed within that function a little message gets printed showing what variable is being altered and what the new value will be. To see an existing value at some point you can put in something like "x := x;" and just to note passing...
My development version of Web REDUCE will mangle UTF-8 characters in general. It is only intended to accept ASCII plus some special cases (mostly Greek letters) that I use in some of the menus. I hadn't realised until fairly recently that text copied from a web page or HTML email can contain ASCII characters (possibly only space, but maybe others) with the high bit set, which REDUCE doesn't like. So as a quick hack I now truncate unrecognised non-ASCII characters to something that REDUCE accepts....
On Sun, 7 Apr 2024, Francis Wright wrote: This problem of pasting from formatted sources is fixed in my development version of Web REDUCE, which I hope to release soon. I modified the function asciify so that if it doesn't recognise a non-ASCII character to be translated, it truncates the character to 7 bits instead of just returning it unmodified. That seems to work when copying and pasting examples from the HMTL REDUCE manual although I haven't tried it with other formatted source text. Francis...
Aha and thanks. If Reduce expects anything with input characters that have the 0x80 bit set it will be utf-8 sequences - and I suspect that although that is supposed to be in there fairly few people have tried it seriously. So pasting in something that has non-utf-8 use of high bit characters may have odd effects - and I do not think we have had any ideas about detecting or recovering from that! Arthur On Sun, 7 Apr 2024, Hermann Rolfes wrote: Oh, it's a high-bit-space from the manual again (impossible...
$O/bin/redcsl -w -v Codemist Standard Lisp revision 6712 for cygwin:x86_64: Feb 9 2024 Dated: Fri Feb 9 11:59:12 2024 Reduce (CSL, rev 6712), 9-Feb-2024 ... Memory allocation: 8192 Kbytes There are 12 processors available 1: load_package tps; 2: ps(sin x, x, 0); 1 3 1 5 7 x - ---x + -----x + O(x ) 6 120 so exactly which version did you try and exactly what input right from system startup did it get? Arthur On Sun, 7 Apr 2024, Hermann Rolfes wrote: I just tried the TPS package as per Manual 2024:...
This problem of pasting from formatted sources is fixed in my development version of Web REDUCE, which I hope to release soon. I modified the function asciify so that if it doesn't recognise a non-ASCII character to be translated, it truncates the character to 7 bits instead of just returning it unmodified. That seems to work when copying and pasting examples from the HMTL REDUCE manual although I haven't tried it with other formatted source text. Francis From: discussion@reduce-algebra.p.re.sourceforge.net...
Oh, it's a high-bit-space from the manual again (impossible to see), for some reason all copy-paste examples fail usually. My work around for my WebREDUCE fork is: const buf = new Uint8Array(str.length + 1); // Array of 8-bit unsigned integers, null-terminated, to match a C/C++ string // (hence the length + 1). The contents are initialized to 0. for (let i = 0; i < str.length; i++) { let charCode = str.charCodeAt(i); // Returns a number that is the UTF-16 code unit value at the given index. if (charCode...
I just tried the TPS package as per Manual 2024: load_package tps; a := ps(sin x, x, 0); *** ? declared operator *** a declared operator Anyone knows what's wrong with it? In my REDCSL from 2014 it works fine (didn't compile any other version so far).
Use list2widestring instead of list2string in newtok to generate printed string for new operators so that multibyte characters are printed correctly (e.g. #times;)
Build process for PSL Reduce:
Some invalid arguments to num_int caused a car of nil.
The input
I hope this makes the emscripten version build again - some changes in
Hello Francis and Rainer, ty for your replies. Obviously I do not grasp your advice or you run a newer version of Reduce. What I did using Reduce (CSL, rev 6657), 10-Dec-2023 ... 1: f := ((1+x)/(1-x))^(1/4)*(x^2-x); 2: plot(f,x=(-1 .. 1)); what shows an "asymatric wave", kind of... 3: load_package numeric; num_int(f,x=(-1 .. 1.0)); 0.277668856764 That is close to pi/sqrt(128) and for me correct enough. 5: on rationalize; 6: load_package numeric; num_int(f,x=(-1 .. 1.0)); -0.277668856764 Thus on rationalize;...
Add nointsubst switch (int module) to entry.red so that th switch is not reset when int is loaded.
Actually, it is indefinite integration that returns the wrong result with a certain set of switches. Try this: f := ((1+x)/(1-x))^(1/4)*(x^2-x); on rationalize,combinelogs; int(f,x); As Francis pointed out, the error is occurs during some substitution. When I switch substitutions off with on nointsubst the result is correct. As an aside: With the switch rationalize set to on, the integrand is transformed so that the denominator is a polynomial. This seems to trigger the error. Starting in a fresh...
I think you should doubt the result of a definite integration if there is the possibility that it has taken the wrong branch of a complex-valued function, perhaps within some transformed version of the integrand, which may be what has gone wrong here; I haven't investigated. That's much less likely to happen with numeric integration when the integrand is real throughout the integration range. Francis From: discussion@reduce-algebra.p.re.sourceforge.net discussion@reduce-algebra.p.re.sourceforge.net...
There exist formulas Reduce can't integrate, then numeric integrate still returns a result. But up to now, if definite integration was successful, I took the outcome for real. Up to now: ((1+x)/(1-x))^(1/4)*(x^2-x); int(ws,x,0,1); results -22/3-- in contrast, numeric integrate shows -0.230728160176 what is more reasonable compared with the plot. Analytic result is shown here. Question: When should I doubt the result of definite integration and check by numeric integrate?
I have just returned from a trip that means I could not join in this diuscussion. Maybe everything is now sorted so I do not need to worry. But still here are some thoughts/questions... Reduce as a whole has these two modes - algebraic and symbolic. I think that he concept from early days was that "ordinary users" would use (just) algebraic mode and (just) use it to express algebraic evaluation, simplification and transformation. So the only data type really provided there is a "formula" where numbers...
Fix typo in example in gnuplot.tex
Typo in .tst file
Autoloading: make sure that the stat property is reset before defined an autoload stub.
Correct a new version of an old error: off cref when rcref is loaded but cref is not on
Correct a number of problems in the sparse package:
The definition of [ and ] and !*lsqb!* and !*rsqb!* conflicts with the previous definition as !*lsqbkt!* and !*rsqbkt!*,
Add a regression test file for the recently corrected gentran problem.
I commited a fix for the problem with gentran you reported. Your example should work now after rebuilding. Thanks for letting us know. Eberhard
Gentran: Strip procedure info generated by formproc. The info part was introduced after the creation of the gentran package and is of no use here.
Print an error message when trying to take the determinant of a non-square matrix.
Update regressions test file after recent update to linalg.
Update linalg test output after recent changes to linalg.
The info that in other cases ends up on the property list saying where a procedure was defined. Has ended up unhelpfully fed to gentran. When that info was added certainly no thought was given to gentran!.. Which needs to ignore it. I can look harder after Easter but not now. It may well also misbehave on all other up to date versions! But I can not check this week. Arthur From: discussion@reduce-algebra.p.re.sourceforge.net discussion@reduce-algebra.p.re.sourceforge.net on behalf of Hermann Rolfes...
Hey all! I'm experimenting with gentran, but I only get simple examples to work. When I try a little bit more advanced one: load gentran; GENTRANLANG!* := 'C$ GENTRAN PROCEDURE FAC N; BEGIN DECLARE FAC, N, I, F : INTEGER; F := FOR I:=1:N PRODUCT I; RETURN F END$ Then in WebREDUCE it causes these errors: (defined!-in!-file . !-) *** Scalar definitions cannot be translated (defined!-on!-line . 3) *** Scalar definitions cannot be translated (procedure fac nil expr (n) (rblock nil (setq f (for i (1 1...
Also if you like gentran look at scope which I have never had cause to use but is for generating tidier code than just gentran. Arthur From: discussion@reduce-algebra.p.re.sourceforge.net discussion@reduce-algebra.p.re.sourceforge.net on behalf of Hermann Rolfes kungfooman@users.sourceforge.net Sent: Saturday, March 9, 2024 9:41:45 PM To: [reduce-algebra:discussion] 899365@discussion.reduce-algebra.p.re.sourceforge.net Subject: [reduce-algebra:discussion] REDUCE <-> JavaScript Thank you all a lot...
Thank you all a lot for your input! I figured there is even a package called gentran which can generate code (e.g. C code) - I will play around with all and see what I can come up with. I like LISP as being sort of an abstract syntax tree, so it shouldn't be too hard from now on - thank you all again! And have a nice time in Kathmandu, Arthur - there is no time pressure here, just learning and testing around
Check the property list with list or read cslbase/make-c-code to see the property name which is nor just saved. And saved definitions are put within fasl files and need explicity loading to get them back and they are only generally kept in bootstrap reduce. I will be able to help a lot better after Easter unless this is very urgent. Also psl does not do savedef. Arthur From: discussion@reduce-algebra.p.re.sourceforge.net discussion@reduce-algebra.p.re.sourceforge.net on behalf of Francis Wright fjwright@users.sourceforge.net...
I think Arthur meant that you should use get('foo, 'saved); It's very unusual to have a doubled single quote in Lisp. But the above doesn't seem to produce any output in Web REDUCE either. The REDUCE parser generates Lisp code, which by default is saved in the system and interpreted when you call a function. This is probably the closest that REDUCE gets to Javascript. You can see the saved Lisp for your procedure foo by doing getd 'foo; but it doesn't look much like the REDUCE input. However, most...
Hi from Kathmandu, with time after this evening less certain re email. I reduce consider the function name "cos". At the level of lisp/rlisp it is a fn to compute the cosine of a double precision float. It May be implemented by rlisp code or with psl or csl at least it is a function implemented within the lisp kernel. In that case after some wrapper code to disentangle the lisp representation of a float it uses code from the crlibm correctly rounded maths library and the c source for that is in the...
REDUCE IDE Version 1.12
Hey Arthur, thank you for your reply! In JavaScript I'm used to simply write a function name and double-click on it in F12/DevTools in order to move to its source for inspection. I want to implement something similiar for WebREDUCE - If you know how, I will take any information present, be it the entire original source, function bytecodes or function pointers. Every piece can help to debug a system. Is this how you mean it? I tried different variations, but couldn't get it to work so far: procedure...
Thank you @schoepf for fixing the manual!
More corrections to turtle documentation, add missing info function.
I suspect the documentation was intended for an updated version that didn't make it into the code repository. It's difficult to say after 25 years. I corrected the description of the move command and removed the description of fdraw which doesn't exist. If anyone is willing to look into the code and improve it, go ahead. The code is not very complicated.
Correction for a problem reported by Alan Barnes: a rule for derivatives is sometimes not completely applied when differentiating more than once.
Update turtle documentation.
Hello all, I worked the last week to bring GNU Plot into WebREDUCE. I started this repo for developers who want to try it out: https://github.com/kungfooman/WebREDUCE/ Instead of just plotting, you will receive four windows: 1) The gnu commands/script. 2) The data points. 3) The actual plot image. 4) The gnuplot error message window. So once you entered a plot, you can easily change it afterwards: Input: plot((x+y)**4); The cool thing: you can even still edit the GNU Plot input and test quickly around...
First let me note that I’m on a trip so internet is uncertain for me right now. If foo is an inter[preted function then gets ‘foo returns the lisp code for it and print may render that in lisp. For csl reduce the version but as bootstrapreduce puts the lisp version of any code to be accessed via get(‘foo, “saved). In each case id foo was introduced in algebraic mode then it may not look like what you ``”expect”.. There was once a scheme (cedit?) for people to edit the most recent input they had types....
Test code from: procedure peak(r); begin; return for i:=0:r collect {move(x_coord+5,y_coord-10), move(x_coord+10,y_coord+60), move(x_coord+10,y_coord-60), move(x_coord+5,y_coord+10)}; end; draw {home(), peak(3)}; Error: *** move called with 2 instead of 1 arguments Reason: apparently Turtle#move only takes a {x, y} vector nowadays - but the docs document it as taking two dedicated arguments. Did the API change but no one updated the docs?
Is it possible to print the source code of a function itself? In JavaScript you can do: function test(a, b) { return a + b; } console.log(test.toString()); // Prints source code of function Is there something like globalThis or window? I need it to implement auto-complete of possible commands in WebREDUCE, e.g. Object.keys(window);
Indeed you are right, I'm just learning! I realized most code is written in symbolic mode aswell by fitting the gnuplot procedures. So seeing string code in algebraic mode is probably an anti pattern?
Fixed by: https://sourceforge.net/p/reduce-algebra/code/6730/ thank you! (can "Issues" be closed on here?)
Thank you for the feedback @fjwright and @arthurcnorman As I'm learning I want to remove restrictions, therefore I deepdived into dozens of PDF's I could find about REDUCE and added GNU Plot - also running as web assembly:
Thank you for the feedback @fjwright and @arthurcnorman As I'm learning I want to remove restrictions, therefore I deepdived into dozens of PDF's I could find about REDUCE and added GNU Plot - also running as web assembly:
For source forge we can grant write authority to those who have something to insert and that there is some chance that they will then support at least for a year or two. And some other than there does not feed in art all directly to the main distributed version, but of course anybody can set up or register their own subversion of git or anything else site to do their own work in with their friends and just copy the current state from source forge into it as a fork. Mostly new contributors sort out...
Correct error in turtle documentation, discovered by Hermann Rolfes.
I have used reduce for 53 years but have never tried to concatenate two strings. Normally I use reduce for algebraic calculations. =-John ff
You might like to take a look at https://github.com/orgs/reduce-algebra/teams/reduce-algebra. I have no idea how well it works, but at least it has provided a home for some REDUCE code that would otherwise have disappeared. Francis [https://github.githubassets.com/assets/github-logo-55c5b9a1fe52.png]https://github.com/orgs/reduce-algebra/teams/reduce-algebra Build software better, togetherhttps://github.com/orgs/reduce-algebra/teams/reduce-algebra GitHub is where people build software. More than...
Yes indeed, I'm warming up to the source code - I'm good in C and JavaScript and invested heaps of time into WebAssembly in the past and embedded several scripting engines in different projects - I will probably find a way. Contributing on SourceForge seems harder than on GitHub, but I will see once I have some patches.
Very much the "it is opensource" means that if YOU really wanted a feature you can add it to The benefit of others. In the past we have helped a bunch of people get started, do if you are willing please ask and explain just what would help. If it is trivial we may just do it. If a bit bigger we can help you do some of the work! Arthur From: discussion@reduce-algebra.p.re.sourceforge.net discussion@reduce-algebra.p.re.sourceforge.net on behalf of Hermann Rolfes kungfooman@users.sourceforge.net Sent:...
Link: https://reduce-algebra.sourceforge.io/manual/manualse117.html https://reduce-algebra.sourceforge.io/manual/manualse117.html#x153-28900018.2 Example code: load_package turtle; draw {for i:=1:12 collect {leftturn(30), for j:=1:12 collect {forward 40, leftturn(30)}} }; Reason it doesn't work: there is no leftturn procedure, only turnleft. Fix: load_package turtle; draw {for i:=1:12 collect {turnleft(30), for j:=1:12 collect {forward 40, turnleft(30)}} };
My favorite way would be embedding the browser directly into REDUCE. Performance would certainly be superior over the other possibilities. Did you try the performance of https://reduce-algebra.sourceforge.io/web-reduce/ ? I just started to use it for a few days and it feels very responsive to me so far. Only thing I miss is ability to interact with JavaScript for e.g. plotting into a <canvas> - but since this is open source, this is just a matter of time until there will be more language interop...
That works like a charm, thank you Eberhard! I'm reading Application of Geometric Algebra to Electromagnetic Scattering which is the only reason I learned about REDUCE. The nature of multivector equations etc. is that it is rather slow in interpreted code, therefore one should generate code e.g. for C or JavaScript. It's strange to not have a good set of string functions, since you require them for meta programming. Mathematica e.g. comes with all kinds of string functions, which allow for quick...
Hello, For some reason string manipulation comes up here once in a while. It is not really something that is used in Reduce. What are you trying to accomplish? Anyway, to answer your question the following should do symbolic procedure explode_string u; 'list . cdr reverse cdr reverse explode u; symbolic operator explode_string; 15: explode_string "Hello world"; {H, e, l, l, o, , w, o, r, l, d} 16: Eberhard
Thank you! I really want to share the list/array, so I worked something out: % Some kind of string representation magic from symbolic mode. operator !"; a := "Hello"; share a; symbolic; c := explode(a); share c; algebraic; realRet := sub(!" = list, c); share realRet; realRet; I only have one last issue: to remove the last list element, which is just there because of the substitution for: (!" !H e l l o ! !W o r l d !")
On the recuce homepage, www.reduce-algebra.com, there is a symbolic mode primer, and share is in the section "Communication between algebraic and symbolic modes". I think the problem with your solution to reverse a string here is that with explode you convert it to a list of characters, and try to return that to algebraic mode. If you compress it back, it works: symbolic procedure rev(a); begin; return compress(reverse(explode(a))); end; symbolic operator rev; rev("hello");
On the recuce homepage, www.reduce-algebra.com, there is a symbolic mode primer, and share is in the section "Communication between algebraic and symbolic modes". I think the problem with your solution to reverse a string here is that with explode you convert it to a list of characters, and try to return that to algebraic mode. If you compress it back, it works: symbolic procedure rev(a); begin; return compress(reverse(explode(a))); end; symbolic operator rev; rec("hello");
On the recuce homepage, www.reduce-algebra.com, there is a symbolic mode primer, and share is in the section "Communication between algebraic and symbolic modes". I think the problem with your solution to reverse a string here is that with explode you convert it to a list of characters, and try to return that to algebraic mode. If you compress it back, it works: symbolic procedure rev(a); begin; return concat(reverse(explode(a))); end; symbolic operator rev; rec("hello");
Thank you so much for the symbolic operator/procedure trick, that's exactly what I searched for - and I also didn't see share in any PDF yet, it works great for simple data types. I also try to find a solution for JavaScript's "Hello World".split(''); and tried this: symbolic procedure explodeAndReverse(a); begin; return reverse(explode(a)); end; symbolic operator explodeAndReverse; s:=explodeAndReverse("Hello"); s; But then "sharing" stops working - do you happen to know how to share a symbolic...
You're absolutely right, sorry. I have a second try here: symbolic procedure joinstr(a, b); begin; return concat(a, b); end; symbolic operator joinstr; s:=joinstr("Hello", " world!"); s; You could also just use concat in symbolic mode: a:="Hello"; b:=" world!"; share a, b; symbolic; c:=concat(a, b); share c; algebraic; c;
You're absolutely right, sorry. I have a second try here: symbolic procedure joinstr(a, b); begin; return concat(a, b); end; symbolic operator joinstr; s:=joinstr("Hello", " world!"); s;
Hello arpi, thank you for your answer! I think it doesn't actually concatenate anything though. You can test that by: both := joinstring("Hello", "World"); write both; % prints nil Any ideas to have a real string concatenation?