wxMaxima-developers / wxmaxima

A gui for the computer algebra system Maxima built with wxWidgets
https://wxMaxima-developers.github.io/wxmaxima/
Other
471 stars 98 forks source link

mod function #1750

Closed milsap1234 closed 4 weeks ago

milsap1234 commented 1 year ago

wxMaxima 22.03.0 wxwidgets 3.2.1 maxima version 5.46.0 (x86_64-unknown linux gnu) Maxima compiled using ECL 21.2.1 Some kind of overflow : (%i39) mod(3^38,101); mod(3^39,101) ; mod(3^100,101); (%o37) 77 (%o38) -173 (%o39) 18884545563065182146068328485841 Edit: (%i5) power_mod(3,100,101); (%o5) 1

OK in maxima: (%i2) mod(3^38,101); mod(3^39,101); mod(3^100,101); (%o2) 77 (%o3) 29 (%o4) 1

daute commented 1 year ago

Very strange. Are you sure, you use the same Maxima version? Maybe a self compiled version in one example, a version installed using a package manager in the other example? Can you give the output of build_info(); in both cases?

(But I can't even believe, that Maxima (even a older version) fails in such trivial operations...). Best regards, Wolfgang

Edit: I cannot reproduce it here, wxMaxima 22.03.0 does output the same as text mode Maxima.

milsap1234 commented 1 year ago

You are right, Wolfgang: I installed maxima from the artix-linux repository, wxmaxima by following the instructions here: https://github.com/wxMaxima-developers/wxmaxima/blob/main/Compiling.md Since I am inexperienced at this, I may well have made some mistake, although so far wxmaxima works as expected otherwise. I'll try reinstalling and report back.

(%i11) build_info(); (%o11) build_info(version="5.46.0",timestamp="2023-02-18 16:18:14",host="x86_64-unknown-linux-gnu",lisp_name="ECL",lisp_version="21.2.1",maxima_userdir= "/home/spot/.maxima",maxima_tempdir="/tmp",maxima_objdir="/home/spot/.maxima/binary/5_46_0/ecl/21_2_1",maxima_frontend="wxMaxima", maxima_frontend_version="22.03.0_GTK3")

(%i1) build_info(); (%o1) Maxima version: "5.46.0" Maxima build date: "2023-02-18 16:18:14"
Host type: "x86_64-unknown-linux-gnu" Lisp implementation type: "ECL" Lisp implementation version: "21.2.1" User dir: "/home/spot/.maxima" Temp dir: "/tmp" Object dir: "/home/spot/.maxima/binary/5_46_0/ecl/21_2_1" Frontend: false

gunterkoenigsmann commented 1 year ago

I have just installed ECL 22.2.1 => will give it a try tomorrow on my system.

daute commented 1 year ago

Where do you get ECL 22.2.1? 21.2.1 seems the most recent release, according to: https://ecl.common-lisp.dev/

I tried to compile the same setup than you (Maxima 5.46.0 compilied with ECL 21.2.1, wxMaxima 22.03 (the most recent release is 23.02)), but could not reproduce the effect. Very strange.

And you use the same Maxima version, according to build_info()-output. I suspected, the command line version might be e.g. in /usr/bin, the version you selected in wxMaxima maybe in /usr/local/bin, /opt/maxima or somewhere else. I have no idea, whats the problem there.Maxima does the computation as a backend, and if it is done right, wxMaxima is just displaying the text, it gets from Maxima. That can't overflow...

Sorry, that I can't help. Maybe try a more recent wxMaxima version, but as I said - I used your versions here and everything works (here).

Best regards, Wolfgang

daute commented 1 year ago

I am sorry, I did not see, that the response was from Gunter, the ECL version number was maybe just a typo.

Wolfgang

gunterkoenigsmann commented 1 year ago
(%i1)   build_info();
(%o1)   build_info(version=
"branch_5_46_base_1607_geda296dc6",timestamp=
"2023-02-19 22:35:01",host="x86_64-pc-linux-gnu",lisp_name="ECL",
lisp_version="21.2.1",maxima_userdir="/home/gunter/.maxima",
maxima_tempdir="/tmp",maxima_objdir=
"/home/gunter/src/maxima-code/binary/branch_5_46_base_1607_geda296dc6/ecl/21_2_1"
,maxima_frontend="wxMaxima",maxima_frontend_version=
"23.02.0-DevelopmentSnapshot_GTK3")
(%i4)   mod(3^38,101); mod(3^39,101) ; mod(3^100,101);
(%o2)   77

(%o3)   29

(%o4)   1

Seems like I cannot reproduce the problem, neither. But ECL has already shown errors that appear only on some CPUs (Intel vs. AMD or similar) and bugs that manifested only on some machines and only in one of 100 runs or so => hard to debug, but definitively plausible that this bug exists and somehow is triggered by wxMaxima, possibly only by changing the memory layout ever so slightly by defining its own variables.

milsap1234 commented 1 year ago

Thank you both for your attention to this.
I tried reinstalling on the artix system (arch minus systemd) but the error persists. Then I tried installing on the same AMD machine in antiX (debian minus systemd) and the error does not occur: (%i1) build_info(); (%o1) build_info(version="5.44.0",timestamp="2021-04-24 14:52:58",host="x86_64-pc-linux-gnu",lisp_name= "GNU Common Lisp (GCL)",lisp_version="GCL 2.6.12",maxima_userdir="/home/demo/.maxima",maxima_tempdir="/tmp", maxima_objdir="/home/demo/.maxima/binary/5_44_0/gcl/GCL_2_6_12",maxima_frontend="wxMaxima", maxima_frontend_version="20.12.1_GTK3_OpenMP201511+Locks") (%i3) mod(3^39,101);mod(3^100,101); (%o2) 29 (%o3) 1 So the problem is easy to avoid. I will advise if a future version eliminates the error, or if some other error presents itself. Thanks again

robert-dodier commented 4 weeks ago

I tried these examples mod(3^38,101); mod(3^39,101) ; mod(3^100,101); with Maxima post-5.47 + ECL 23.9.9 on Ubuntu, and I don't see the errors shown in the original report. I'm going to close this bug report since it hasn't been reproduced; if it comes back, let's open a new report.