### External Project Setup for SBCL in CMake Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/sbcl/CMakeLists.txt This CMake code defines an external project 'sbcl' to download and manage the SBCL Lisp compiler. It specifies the URL for downloading the SBCL installer, the directory for downloads, the MD5 checksum for verification, and custom commands for download, extraction, configuration, and build steps. Note that CONFIGURE_COMMAND and INSTALL_COMMAND are intentionally left empty, relying on a custom extraction step and a separate INSTALL command. ```cmake externalproject_add(sbcl URL "${SBCL_URL}" DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/downloads URL_MD5 ${SBCL_MD5} DOWNLOAD_NO_EXTRACT 1 CONFIGURE_COMMAND "" BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/sbcl && ${CMAKE_SOURCE_DIR}/sbcl.sh INSTALL_COMMAND "" ) ``` -------------------------------- ### Install Crosscompilation Tools on Ubuntu/Debian Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/README.txt Installs essential packages for crosscompiling Maxima to Windows on Ubuntu/Debian systems. Includes enabling 32-bit architecture support and common development tools like g++, cmake, and wine. ```bash dpkg --add-architecture i386 apt-get install g++-mingw-w64-x86-64 cmake nsis wine wine64 automake texlive texlive-plain-generic texlive-xetex rsync p7zip-full g++ gettext python3 tcl pandoc po4a wine32 libgcc-s1:i386 libstdc++6:i386 bsdutils ``` -------------------------------- ### Download VTK Installer using CMake Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/vtk/CMakeLists.txt This snippet uses CMake's ExternalProject_Add command to download the VTK installer. It dynamically selects the installer URL and MD5 checksum based on whether a 64-bit or 32-bit build is specified, ensuring the correct version is downloaded. ```cmake if(BUILD_64BIT) set(VTK_MD5 "f75e6f49c167c464192fbc8ef473954a") set(VTK_INSTALLERNAME "vtkpython-7.1.1-Windows-64bit.exe") set(VTK_URL "https://www.vtk.org/files/release/7.1/${VTK_INSTALLERNAME}") else() set(VTK_MD5 "8d8b0878be81a0ab471e929f828dfe9a") set(VTK_INSTALLERNAME "vtkpython-6.3.0-Windows-32bit.exe") set(VTK_URL "https://www.vtk.org/files/release/6.3/${VTK_INSTALLERNAME}") endif() externalproject_add(vtk URL "${VTK_URL}" DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/downloads DOWNLOAD_NO_EXTRACT 1 URL_MD5 ${VTK_MD5} CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" ) ``` -------------------------------- ### Installing SBCL Binaries in CMake Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/sbcl/CMakeLists.txt This CMake code installs the necessary SBCL executable and core file to the 'bin' directory, and also installs the 'contrib' subdirectory. This is part of the overall build process for Maxima/wxMaxima, ensuring the SBCL environment is correctly set up for the target Windows system. ```cmake install(FILES ${CMAKE_BINARY_DIR}/sbcl/sbcl.exe ${CMAKE_BINARY_DIR}/sbcl/sbcl.core DESTINATION bin COMPONENT SBCL) install(DIRECTORY ${CMAKE_BINARY_DIR}/sbcl/contrib DESTINATION bin COMPONENT SBCL) ``` -------------------------------- ### Invoking Maxima Console Source: https://github.com/calyau/maxima/blob/master/doc/intromax/intromax.html This snippet shows the command to start a Maxima session from the console. It is a basic command-line interaction. ```maxima maxima ``` -------------------------------- ### Basic Calculus Operations in Maxima Source: https://github.com/calyau/maxima/blob/master/interfaces/xmaxima/intro.html Demonstrates how to perform basic calculus operations such as integration and differentiation using Maxima. Includes examples for indefinite and definite integrals. ```maxima integrate(1/(1+x^3),x); diff(cos(x),x); integrate( x/(1+x^3),x ); integrate( 1/(1+x^2), x, 0, 1 ); ``` -------------------------------- ### Install VTK Binaries using CMake Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/vtk/CMakeLists.txt This CMake command installs the extracted VTK binaries to the appropriate location for the project. It copies the contents of the VTK 'bin/' directory to the 'vtk/' destination within the installation prefix, ensuring that necessary executables and libraries are available. ```cmake install(DIRECTORY "${CMAKE_BINARY_DIR}/vtk/bin/" DESTINATION vtk/ COMPONENT VTK) ``` -------------------------------- ### Download and Build wxWidgets for Windows (CMake) Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/wxwidgets/CMakeLists.txt This CMake snippet defines an external project to download, configure, build, and install the wxWidgets library. It specifies the URL, MD5 checksum, and configuration options for crosscompilation, including disabling shared libraries and enabling specific features. The build command uses 'make', and the install command is tailored to install locale files. ```cmake set(WXWIDGETSVERSION "3.2.6") set(WXWIDGETS_MD5 "41d54fffc953936bb92ae45d81ded60c") set(WXWIDGETS_URL "https://github.com/wxWidgets/wxWidgets/releases/download/v${WXWIDGETSVERSION}/wxWidgets-${WXWIDGETSVERSION}.tar.bz2") externalproject_add(wxwidgets URL "${WXWIDGETS_URL}" DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/downloads URL_MD5 ${WXWIDGETS_MD5} CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/wxwidgets/wxwidgets-prefix/src/wxwidgets/configure --disable-shared --disable-compat28 --with-zlib=builtin --with-libjpeg=builtin --without-libtiff --with-libpng=builtin --with-expat=builtin --build=${BUILDHOST} --host=${HOST} --enable-accessibility --enable-webview BUILD_COMMAND $(MAKE) INSTALL_COMMAND $(MAKE) locale_install "DESTDIR=${CMAKE_BINARY_DIR}/wxwidgets-installroot" ) ``` -------------------------------- ### Build 32-bit Maxima Installer Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/README.txt Crosscompiles a 32-bit installer for Maxima for Windows. Requires the 32-bit MinGW cross-compiler to be installed and configured for posix threads. ```bash cmake -DBUILD_64BIT=NO .. make make package ``` -------------------------------- ### Customize NSIS Installer Script with Command-Line Options Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/CMakeLists.txt Reads and modifies the NSIS template to include advanced installer functionalities. It adds logic for handling command-line parameters like silent installation, specifying installation directory, and excluding optional components (VTK, Gnuplot, wxMaxima), as well as displaying a help message. ```cmake find_file(NSISTEMPLATE_IN NAMES "NSIS.template.in" PATHS "${CMAKE_ROOT}/Modules/" "${CMAKE_ROOT}/Modules/Internal/CPack") file(READ "${NSISTEMPLATE_IN}" MYNSISTEMPLATE) string(REPLACE "RequestExecutionLevel admin" "RequestExecutionLevel admin !include FileFunc.nsh !include LogicLib.nsh " MYNSISTEMTemplate "${MYNSISTEMPLATE}") string(REPLACE "Function .onInit" "Function .onInit \${GetParameters} \$0 \${GetOptions} \$0 \"/no_vtk\" \$1 \${IfNot} \${Errors} !insertmacro UnselectSection \${vtk} \${EndIf} \${GetOptions} \$0 \"/no_gnuplot\" \$1 \${IfNot} \${Errors} !insertmacro UnselectSection \${gnuplot} \${EndIf} \${GetOptions} \$0 \"/no_wxmaxima\" \$1 \${IfNot} \${Errors} !insertmacro UnselectSection \${wxmaxima} \${EndIf} \${GetOptions} \$0 \"/?\" \$1 \${IfNot} \${Errors} MessageBox MB_OK \"Installer for Maxima\\n\\nThis installer allows the following command line options:\\n /S - silent install\\n /D= - select the install path\\n /no_vtk - do not select VTK\\n /no_gnuplot - do not select Gnuplot\\n /no_wxmaxima - do not select wxMaxima\\n /? - this help message\\n\\nMaxima Website: https://maxima.sourceforge.io\" Abort \${EndIf} " MYNSISTEMTemplate "${MYNSISTEMTemplate}") file(WRITE ${CMAKE_BINARY_DIR}/NSIS.template.in "${MYNSISTEMTemplate}") message(STATUS "Copied and patched ${NSISTEMTemplate_IN} to ${CMAKE_BINARY_DIR}/NSIS.template.in") ``` -------------------------------- ### Install Targets and Files (CMake) Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/CMakeLists.txt Configures the installation of various Maxima project components, including executables, libraries, Lisp files, TCL scripts, and documentation. It specifies destinations for runtime and library files on Windows. ```cmake install(TARGETS winkill winkill_lib maxima_longnames COMPONENT Maxima RUNTIME DESTINATION bin LIBRARY DESTINATION bin/) install(FILES "${CMAKE_SOURCE_DIR}/../interfaces/xmaxima/win32/win_signals.lisp" DESTINATION bin/ COMPONENT Maxima) install(FILES "${CMAKE_SOURCE_DIR}/xmaxima.bat" DESTINATION bin/ COMPONENT Maxima) install(FILES "${CMAKE_BINARY_DIR}/maxima-prefix/src/maxima/doc/info/maxima.pdf" DESTINATION share/doc/ COMPONENT Maxima) configure_file("${CMAKE_SOURCE_DIR}/lispselector.tcl" "${CMAKE_BINARY_DIR}/lispselector.tcl") install(FILES "${CMAKE_BINARY_DIR}/lispselector.tcl" DESTINATION bin/ COMPONENT Maxima) install(FILES "${CMAKE_SOURCE_DIR}/lispselector.bat" DESTINATION bin/ COMPONENT Maxima) ``` -------------------------------- ### Eulix Function Call Example (Maxima) Source: https://github.com/calyau/maxima/blob/master/share/contrib/Eulix/Eulix.html Demonstrates the basic syntax for calling the Eulix ODE solver in Maxima. It shows how to specify expressions, variables, initial conditions, the integration range, and optional parameters. ```maxima Eulix(Expressions, Vars, initials, range, [options]) ``` -------------------------------- ### Solving Equations in Maxima Source: https://github.com/calyau/maxima/blob/master/interfaces/xmaxima/intro.html Provides examples of solving systems of linear equations and quadratic equations using Maxima's 'solve' function. ```maxima solve([x+y+z=5,3*x-5*y=10,y+2*z=3],[x,y,z]); solve(x^2-5*x+6 =0,x); ``` -------------------------------- ### sfquery.py Action Examples: Print Summary and All Details Source: https://github.com/calyau/maxima/blob/master/admin/sfquery-docs.txt Illustrates common action commands for sfquery.py. 'artifact.print_summary()' displays a concise overview of matched bugs, while 'artifact.print_all()' shows the complete details of each matched artifact. ```bash # Action to print a summary of matched artifacts "artifact.print_summary()" # Action to print all details of matched artifacts "artifact.print_all()" ``` -------------------------------- ### MinGW libwinpthread Installation Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/wxmaxima/CMakeLists.txt This snippet locates and installs the `libwinpthread-1.dll` library, which is necessary for C++ threads in wxMaxima when cross-compiling with MinGW. It uses `execute_process` to find the DLL's path and then `install` to copy it to the appropriate destination directory. ```cmake execute_process(COMMAND "${CMAKE_CXX_COMPILER}" -print-file-name=libwinpthread-1.dll OUTPUT_VARIABLE MINGW_LIBWINPTHREAD OUTPUT_STRIP_TRAILING_WHITESPACE) message(STATUS "Found libwinpthread at ${MINGW_LIBWINPTHREAD}") # Include DLLs from the current Mingw environment. install(FILES "${MINGW_LIBWINPTHREAD}" DESTINATION bin/ COMPONENT wxMaxima) ``` -------------------------------- ### Maxima Function Naming Conventions Example Source: https://github.com/calyau/maxima/blob/master/share/contrib/sarag/readme.txt Illustrates the naming conventions for Maxima functions in the library, following a METHOD | WHAT IS TO BE COMPUTED | MODIFIER structure. Examples show how prefixes and suffixes are used to denote specific algorithms or versions of functions, such as 'tarskiQuery' and 'sRemTarskiQueryBetween'. ```maxima tarskiQuery(); sRemTarskiQueryBetween(interval); det(); bareissDet(matrix); sSubRes(polynomial); sSubResExt(polynomial); ``` -------------------------------- ### Configure and Build Tk for Windows Cross-compilation using CMake Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/tcltk/CMakeLists.txt This snippet outlines the process for configuring and building the Tk library for Windows cross-compilation using CMake's `externalproject_add`. It includes the Tk source URL and MD5 checksum, specifies download and build locations, and defines the cross-compilation settings. The configure command links Tk with the previously built Tcl and sets the installation prefix. Dependencies, build commands, and installation instructions for Tk are also included. ```cmake set(TKVERSION "9.0.1") set(TK_MD5 "66bff2d2a28f14949f4d605ac5dd2ae5") set(TK_URL "https://prdownloads.sourceforge.net/tcl/tk${TKVERSION}-src.tar.gz") externalproject_add(tk URL "${TK_URL}" DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/downloads URL_MD5 ${TK_MD5} DEPENDS tcl CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/tcltk/tk-prefix/src/tk/win/configure --build=${BUILDHOST} --host=${HOST} --disable-shared --enable-zipfs=no --with-tcl=${CMAKE_BINARY_DIR}/tcltk/tcl-prefix/src/tcl-build/${WINDOWS_DRIVELETTER}:/maxima-${MAXIMAVERSION}/lib --prefix=${WINDOWS_DRIVELETTER}:/maxima-${MAXIMAVERSION} BUILD_COMMAND $(MAKE) COMMAND $(MAKE) install ) install(DIRECTORY ${CMAKE_BINARY_DIR}/tcltk/tk-prefix/src/tk-build/${WINDOWS_DRIVELETTER}:/maxima-${MAXIMAVERSION}/ DESTINATION . COMPONENT TclTk) ``` -------------------------------- ### Unattended Maxima Installation on Windows Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/README.txt Installs Maxima on Windows silently using the '/S' command-line switch. Allows specifying a custom installation directory with '/D=directory'. ```powershell maxima-VERSION-win64.exe /S /D=C:\maxima ``` -------------------------------- ### Install Directories Conditionally (CMake) Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/CMakeLists.txt Installs directories from the build root, with conditional inclusion of specific binary subdirectories (e.g., 'binary-abcl', 'binary-ccl64') based on build options. This allows for platform-specific or component-specific installations. ```cmake install(DIRECTORY ${CMAKE_BINARY_DIR}/maxima-installroot/${WINDOWS_DRIVELETTER}:/maxima-${MAXIMAVERSION}/ DESTINATION . COMPONENT Maxima PATTERN "binary-abcl" EXCLUDE PATTERN "binary-ccl64" EXCLUDE) if(WITH_ABCL) install(DIRECTORY ${CMAKE_BINARY_DIR}/maxima-installroot/${WINDOWS_DRIVELETTER}:/maxima-${MAXIMAVERSION}/ DESTINATION . COMPONENT ABCL PATTERN "binary-abcl") endif() if(WITH_CCL64) install(DIRECTORY ${CMAKE_BINARY_DIR}/maxima-installroot/${WINDOWS_DRIVELETTER}:/maxima-${MAXIMAVERSION}/ DESTINATION . COMPONENT CCL64 PATTERN "binary-ccl64") endif() ``` -------------------------------- ### Load and Use gamma_simp Package Source: https://github.com/calyau/maxima/blob/master/share/gamma_simp/README.md Demonstrates how to load the 'gamma_simp' package in Maxima and use its primary simplification functions. It shows examples of simplifying gamma function products and expressions involving factorials and binomial coefficients. ```maxima load(gamma_simp) gamma_simp(gamma(z)*gamma(1-z)); gamma_simp(gamma(1/4)*gamma(3/4)); gamma_simp(gamma(z)*gamma(z + 1/2)); gamma_simp(x*gamma(x)+gamma(x+3)/(x+2)); gamma_simp(makegamma((k - n) *binomial(n,k) + n * binomial(n-1,k))); ``` -------------------------------- ### Install wxWidgets Locale Files (CMake) Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/wxwidgets/CMakeLists.txt This CMake command installs the locale files for wxWidgets into a specified destination. It targets the 'share' directory within the installation root, ensuring that the necessary language and localization data is available for wxMaxima. ```cmake install(DIRECTORY "${CMAKE_BINARY_DIR}/wxwidgets-installroot/usr/local/share/" DESTINATION share/ COMPONENT wxMaxima) ``` -------------------------------- ### Describing Maxima Functions Source: https://github.com/calyau/maxima/blob/master/interfaces/xmaxima/intro.html Shows how to use the 'describe' function in Maxima to get documentation on functions whose names contain a specified string. ```maxima describe("log"); ``` -------------------------------- ### sfquery.py Example: Find Specific Bug by ID and Print All Details Source: https://github.com/calyau/maxima/blob/master/admin/sfquery-docs.txt This example shows how to retrieve and display the full details of a single bug by querying its unique 'artifact_id'. It uses a precise query to match the ID and the 'artifact.print_all()' action to show all information. ```bash ./sfquery.py bugs-10-02-2003.xml \ "artifact.get('artifact_id') == '596204'" \ "artifact.print_all()" ``` -------------------------------- ### sfquery.py Example: Find Bugs by Submitter and Print Summaries Source: https://github.com/calyau/maxima/blob/master/admin/sfquery-docs.txt This example shows how to use sfquery.py to find all bugs submitted by a specific user ('amundson') and then print a summary for each. It combines a field-specific query with the print_summary action. ```bash ./sfquery.py bugs-10-02-2003.xml \ "artifact.get('submitted_by') == 'amundson'" \ "artifact.print_summary()" ``` -------------------------------- ### CTENSR Setup and Dependencies Source: https://github.com/calyau/maxima/blob/master/share/tensor/mail-archive.txt Shows the setup parameters for CTENSR on Multics, including dimension, coordinates, metric type, and dependencies. This is context for the 'undefined function 'true'' error. ```multics-lisp tsetup() dimension 4 coordinates [u,v,x,y] symmetric metric 1,2=a , 3,3=b , 4,4=b depends(a,[x,y],b,[x,y]) ``` -------------------------------- ### Build Maxima.app with Default Settings (Makefile) Source: https://github.com/calyau/maxima/blob/master/macosx/Readme.md This command builds the Maxima.app using the default configuration and settings defined in the Makefile. It assumes SBCL is installed at /usr/local/bin/sbcl. The resulting application will be placed on the Desktop. ```makefile make -f macosx/Makefile ``` -------------------------------- ### Extract VTK Installer with 7-Zip using CMake Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/vtk/CMakeLists.txt This CMake snippet defines a custom step to extract the downloaded VTK installer using 7-Zip. It handles potential variations in extraction paths between older and newer 7-Zip versions by checking and renaming directories to ensure a consistent 'bin/' directory within the VTK build output. ```cmake ExternalProject_Add_Step(vtk extract COMMENT "Performing extraction step for 'VTK'" COMMAND mkdir -p "${CMAKE_BINARY_DIR}/vtk" && cd "${CMAKE_BINARY_DIR}/vtk" && ${SEVENZIP_EXE} x -y "${CMAKE_SOURCE_DIR}/downloads/${VTK_INSTALLERNAME}" && test -d "${CMAKE_BINARY_DIR}/vtk/$_OUTDIR/bin/" && mv "${CMAKE_BINARY_DIR}/vtk/$_OUTDIR/bin/" "${CMAKE_BINARY_DIR}/vtk/bin/" || exit 0 DEPENDEES download DEPENDERS patch ) ``` -------------------------------- ### Definite Integration and Numerical Integration Source: https://github.com/calyau/maxima/blob/master/doc/share/brchre.txt This section shows an example of definite integration using INTEGRATE, which returns a symbolic representation when a closed-form solution is not found. For numerical results, the ROMBERG algorithm is demonstrated. ```maxima (C13) INTEGRATE(%E^X^3,X,1,2); (D13) For(INTEGRATE(%E^X^3,X,1,2)) (C14) ROMBERG(%E^X^3,X,1,2); (D14) 275.51098 ``` -------------------------------- ### Plotting Functions in Maxima Source: https://github.com/calyau/maxima/blob/master/interfaces/xmaxima/intro.html Shows how to generate 2D and 3D plots of functions using Maxima's plotting capabilities. Includes examples for plotting sine waves and a 3D surface. ```maxima plot2d(sin(x),[x,0,2*%pi]); plot3d(x^2-y^2,[x,-2,2],[y,-2,2],[grid,12,12]); ``` -------------------------------- ### Configure and Build Tcl for Windows Cross-compilation using CMake Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/tcltk/CMakeLists.txt This snippet defines the configuration and build process for the Tcl library using CMake's `externalproject_add` function. It specifies the URL and MD5 checksum for the Tcl source archive, sets download and build directories, and configures the build for cross-compilation to Windows. The configure command utilizes a Windows-specific configure script and sets installation prefixes. Dependencies and commands for building and installing Tcl are also defined. ```cmake set(TCLVERSION "9.0.1") set(TCL_MD5 "6bc27eaf8e152c9f0c7b489b73b89dda") set(TCL_URL "https://prdownloads.sourceforge.net/tcl/tcl${TCLVERSION}-src.tar.gz") externalproject_add(tcl URL "${TCL_URL}" DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/downloads URL_MD5 ${TCL_MD5} CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/tcltk/tcl-prefix/src/tcl/win/configure --build=${BUILDHOST} --host=${HOST} --disable-shared --enable-zipfs=no --prefix=${WINDOWS_DRIVELETTER}:/maxima-${MAXIMAVERSION} BUILD_COMMAND $(MAKE) COMMAND $(MAKE) install ) install(DIRECTORY ${CMAKE_BINARY_DIR}/tcltk/tcl-prefix/src/tcl-build/${WINDOWS_DRIVELETTER}:/maxima-${MAXIMAVERSION}/ DESTINATION . COMPONENT TclTk) ``` -------------------------------- ### Definite Integration with Maxima Source: https://github.com/calyau/maxima/blob/master/doc/intromax/intromax.html Illustrates computing definite integrals in Maxima. It shows an example of integrating 1/x^2 from 1 to infinity, yielding a finite result. It also demonstrates an attempt to integrate 1/x from 0 to infinity, which results in a 'divergent' error, highlighting Maxima's ability to identify improper integral issues. ```maxima (%i4) integrate (1/x^2, x, 1, inf); (%o4) 1 (%i5) integrate (1/x, x, 0, inf); defint: integral is divergent. -- an error. To debug this try: debugmode(true); ``` -------------------------------- ### Laurent Series Expansion with TAYLOR Source: https://github.com/calyau/maxima/blob/master/doc/share/brchre.txt Demonstrates the TAYLOR command's ability to handle functions with poles and branch points, automatically generating Laurent series when appropriate. This example expands a function with a pole at X=0. ```maxima (C18) TAYLOR(1/(COS(X)-SEC(X))^3,X,0,5); (D18)/T/ -1/X + 1/2 - 11*X^2/6 - 347*X^4/120 + 6767*X^6/5040 + 15377*X^8/362880 + . ``` -------------------------------- ### Build Maxima for Windows (64-bit) Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/README.txt Crosscompiles Maxima for Windows using CMake and Make. It assumes the source code is available and proceeds to build and package the application into a Windows installer. ```bash mkdir crosscompile-windows/build cd crosscompile-windows/build cmake .. make make package ``` -------------------------------- ### Load Maxima Dimensional Analysis Package Source: https://github.com/calyau/maxima/blob/master/share/physics/dimension.html Loads the 'dimension.mac' file for use in Maxima. Assumes the file is installed in a directory searchable by Maxima. ```maxima load("dimension.mac")$ ``` -------------------------------- ### Create a Matrix in Maxima Source: https://github.com/calyau/maxima/blob/master/doc/share/brchre.txt The MATRIX command is used to construct matrices in Maxima. This example shows how to create a 3x3 matrix with symbolic elements A through I. ```maxima MATRIX([A,B,C],[D,E,F],[G,H,I]); ``` -------------------------------- ### Limit Calculation with Maxima Source: https://github.com/calyau/maxima/blob/master/doc/intromax/intromax.html Demonstrates calculating the limit of a function as the variable approaches a specific value using Maxima's 'limit' function. The example computes the limit of the function 'g' as 'x' approaches 0. ```maxima (%i8) limit (g, x, 0); w (%o8) -- 4 k ``` -------------------------------- ### Configure Texinfo Build with CMake Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/texinfo/CMakeLists.txt This snippet demonstrates how to configure the build process for Texinfo using CMake's `externalproject_add` function. It specifies the URL, MD5 checksum, download directory, and commands for configuring, building, and installing Texinfo. This is crucial for ensuring Maxima has a sufficiently recent version of Texinfo, which might not be available on all build systems. ```cmake set(TEXINFOVERSION "7.1.1") set(TEXINFO_MD5 "e5fc595794a7980f98ce446a5f8aa273") set(TEXINFO_URL "https://ftp.gnu.org/gnu/texinfo/texinfo-${TEXINFOVERSION}.tar.xz") externalproject_add(texinfo URL "${TEXINFO_URL}" DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/downloads URL_MD5 ${TEXINFO_MD5} CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/texinfo/texinfo-prefix/src/texinfo/configure --prefix=${CMAKE_BINARY_DIR}/texinfo-installroot BUILD_COMMAND $(MAKE) INSTALL_COMMAND $(MAKE) install ) ``` -------------------------------- ### Differentiate Symbolic Integration Result with DIFF Source: https://github.com/calyau/maxima/blob/master/doc/share/brchre.txt This example shows how to differentiate the result of a symbolic integration using the DIFF command to verify the accuracy of the integration. If the result is not identical to the integrand, RATSIMP can be used for simplification. ```maxima (C11) DIFF(%,X); (D11) (2*X - 1)/(3*(X^3 - X + 1)) + (2*X - 1)/(6*(X^2 - X + 1)) - 1/(3*(X + 1)) ``` -------------------------------- ### Taylor Series Expansion with Maxima Source: https://github.com/calyau/maxima/blob/master/doc/intromax/intromax.html Shows how to compute the Taylor series expansion of a function 'g' around a point. The example defines 'g' in terms of a previously defined function 'f' and the hyperbolic sine function. It then uses the 'taylor' function to expand 'g' about x=0 up to the 3rd order term. ```maxima (%i6) g: f / sinh(k*x)^4; 3 k*x x *exp(k*x)*sin(w*x) (%o6) ----------------- 4 sinh (k*x) (%i7) taylor (g, x, 0, 3); 2 3 2 2 3 3 w w*x (w*k + w )*x (3*w*k + w )*x (%o7)/T/ -- + --- - -------------- - ---------------- + . . . 4 3 4 3 k k 6*k 6*k ``` -------------------------------- ### Controller Design Examples (Maxima) Source: https://github.com/calyau/maxima/blob/master/share/contrib/coma/COMA.txt Defines a plant transfer function and lists three types of controllers: I-, PI-, and PID-controllers. This serves as a starting point for designing controllers for a given plant. The snippet shows how to represent these controllers as transfer functions in Maxima. ```maxima /* Controller Design*/ /* Transfer function of a plant to be controlled: */ fs:2/((1+5*s)*(1+s)**2*(1+0.3*s)); /* List with three controllers: I-, PI- and PID-controller: */ [fri,frpi,frpid]:[1/(s*Ti), kr*(1+1/(s*Tn)),(1+s*Ta)*(1+s*Tb)/(s*Tc)]; ``` -------------------------------- ### Maxima LAMBDA Construct Examples Source: https://github.com/calyau/maxima/blob/master/doc/share/translation_hints.txt Demonstrates the usage of the LAMBDA construct in Maxima for defining lexical scopes and binding variables. It illustrates how variables within the first argument list of LAMBDA are bound within the scope of the subsequent arguments. ```maxima LAMBDA([U,[L]], A*U*L /* U and L are bound here, A is not */); F(X):= (/* X is bound here */, X^2); SUM(J^N, /* J is bound here */ J, J^2, /* J is not bound here */ 100); ``` -------------------------------- ### 2D and 3D Plotting in Maxima Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/README.txt Provides examples for generating 2D and 3D plots using Maxima's plotting functions. It covers basic plotting, specifying plot formats for xmaxima, and creating 3D surface plots. ```maxima plot2d(sin(x),[x,0,10]); plot2d(sin(x),[x,0,10],[plot_format,xmaxima]); plot3d(x*y,[x,-1,1],[y,-1,1]); plotdf([-y,x],[trajectory_at,5,0]); ``` -------------------------------- ### Build Maxima.app with Custom Lisp and Version (Makefile) Source: https://github.com/calyau/maxima/blob/master/macosx/Readme.md This command allows customization of the Maxima.app build process. You can specify a different Lisp implementation (LISP_NAME) and its program path (LISP_PROGRAM), as well as the Maxima version (VERSION). The application will be configured, built, and installed into Maxima.app. ```makefile make -f macosx/Makefile VERSION=5.24.0 LISP_NAME=cmucl \ LISP_PROGRAM=/usr/local/bin/lisp ``` -------------------------------- ### Load raddenest Package and Run Demos in Maxima Source: https://github.com/calyau/maxima/blob/master/share/raddenest/README.md Demonstrates how to set up Maxima's file search paths and load the raddenest package. It then shows how to execute a demo of the package's functionality. This requires the raddenest package files to be in a searchable directory. ```maxima file_search_demo: append(["~/.maxima/$$$.dem"],file_search_demo); demo(raddenest); ``` -------------------------------- ### Run Maxima from Terminal (Shell Script) Source: https://github.com/calyau/maxima/blob/master/macosx/Readme.md This command executes the Maxima shell script, which starts the Maxima application in a new Terminal window. This is useful for running Maxima directly from the command line after the application has been built. ```bash Maxima.app/Contents/Resources/maxima.sh ``` -------------------------------- ### Custom SBCL Extraction Step in CMake Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/sbcl/CMakeLists.txt This CMake snippet defines a custom step 'extract' for the 'sbcl' external project. It uses 7-Zip (SEVENZIP_EXE) to extract the downloaded SBCL MSI installer into a specific directory within the build environment. This step depends on the 'download' step and precedes the 'patch' step. ```cmake ExternalProject_Add_Step(sbcl extract COMMENT "Performing extraction step for 'SBCL'" COMMAND mkdir -p ${CMAKE_BINARY_DIR}/sbcl && cd ${CMAKE_BINARY_DIR}/sbcl && ${SEVENZIP_EXE} x -y ${CMAKE_SOURCE_DIR}/downloads/${SBCL_INSTALLERNAME} DEPENDEES download DEPENDERS patch ) ``` -------------------------------- ### sfquery.py Example: Find Open Bugs by Submitter Source: https://github.com/calyau/maxima/blob/master/admin/sfquery-docs.txt This command demonstrates how to filter bugs based on multiple criteria: the submitter's name and the bug's status. It uses a combined Python query with 'and' to find open bugs submitted by 'amundson' and prints their summaries. ```bash ./sfquery.py bugs-10-02-2003.xml \ "artifact.get('submitted_by')=='amundson' and artifact.get('status')=='Open'" \ "artifact.print_summary()" ``` -------------------------------- ### Loading and Executing ITENSR Demos on Multics Source: https://github.com/calyau/maxima/blob/master/share/tensor/mail-archive.txt Demonstrates the commands used to load the ITENSR package and execute its demo files on Multics. It highlights potential issues with demo files referencing missing compiled code. ```multics-lisp LOADFILE(">udd>Mathlab>macsyma>share>itensr") BATCH(">udd>Mathlab>macsyma>share>itensr.demo1") ``` -------------------------------- ### Load and Use pslq Package in Maxima Source: https://github.com/calyau/maxima/blob/master/share/pslq/README.md Demonstrates loading the 'pslq.mac' package in Maxima and using its functions to find integer relations. This involves defining a numerical root, guessing its exact value, generating a list of its powers, and then applying the `pslq_integer_relation` function. ```maxima load("pslq.mac")$ ``` ```maxima root: float(sin(%pi/12))$ ``` ```maxima guess_exact_value(root); ``` ```maxima makelist(root^i, i, 0, 4)$ ``` ```maxima pslq_integer_relation(%); ``` ```maxima makelist(x^i, i, 0, 4).%; ``` ```maxima solve(%); ``` -------------------------------- ### Defining and Using Functions in Maxima Source: https://github.com/calyau/maxima/blob/master/interfaces/xmaxima/intro.html Explains how to define functions in Maxima, both simple and those using local variables and control structures like 'block', 'if', and 'for'. ```maxima f(x):=x+2; f(3); g(x):=block([u:x+3,w], u:u^2, w:(y+2)^2, u+w); g(2); h(x):=block([u:x+3,w], u:u^2, if (u<3) then w:(y+2)^2 else w:(y+2)^2+1, u+w); [h(3),h(2)]; block([w:0], for i:1 thru 10 do (w:w+i^2)); block([w:0], for i:1 thru 10 do (w:w+i^2),w); ``` -------------------------------- ### Arbitrary Precision Arithmetic in Maxima Source: https://github.com/calyau/maxima/blob/master/interfaces/xmaxima/intro.html Demonstrates how to perform calculations to arbitrary precision in Maxima, specifically showing how to compute Pi to 100 decimal places and the sine of that value. ```maxima block([fpprec:100],bfloat(%pi)); block([fpprec:100],sin(bfloat(%pi))); ``` -------------------------------- ### Unattended Maxima Installation with Component Exclusion Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/README.txt Performs a silent installation of Maxima on Windows while excluding specific components like VTK, Gnuplot, or wxMaxima using command-line switches. ```powershell maxima-VERSION-win64.exe /S /no_vtk /no_gnuplot /no_wxmaxima ``` -------------------------------- ### Demonstrate TRIGSUM Functionality (Maxima) Source: https://github.com/calyau/maxima/blob/master/share/tensor/mail-archive.txt This code snippet demonstrates how to view a demonstration of the TRIGSUM function's capabilities by printing a writefile. Alternatively, the demo can be executed directly, which takes approximately 5 CPU minutes to complete. This showcases the function's power in simplifying complex trigonometric expressions. ```maxima :PRINT LSH;TRGSUM DEMOUT ``` ```maxima DEMO(TRGSUM,DEMO,DSK,LSH)$ ``` -------------------------------- ### Build Maxima Including ABCL Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/README.txt Configures the CMake build process to include ABCL (ArmedBear Common Lisp), a Java-based Lisp compiler. Note that a Java installation is required on the build system but not included in the installer. ```bash cmake -DWITH_ABCL=YES .. make make package ``` -------------------------------- ### CTENSR Package Initialization on Multics Macsyma Source: https://github.com/calyau/maxima/blob/master/share/tensor/mail-archive.txt This demonstrates the necessary commands to initialize the CTENSR package after loading it. It includes the 'KILL(ALL)' command and a specific 'TENSORKILL' variable setting, which were required to enter a new metric. ```macsyma KILL(ALL); TENSORKILL:TRUE$ ``` -------------------------------- ### Call Maxima Solver with Equations and Variables Source: https://github.com/calyau/maxima/blob/master/share/algebra/solver/solver1-en.html This snippet demonstrates the basic syntax for calling the Maxima Solver. It takes a list of equations and a list of variables to solve for as input. The equations must have EquationP equal to TRUE. ```macsyma Solver(Equations, [ x, y, z ]); ``` -------------------------------- ### Define Recursive Factorial Function in MACSYMA Source: https://github.com/calyau/maxima/blob/master/doc/share/brchre.txt This example shows how to define a recursive factorial function named FAC in MACSYMA using the ':=' operator. It includes the base case (N=0) and the recursive step (N*FAC(N-1)), along with an example of calculating FAC(5). ```macsyma (C44) 100!; (D44) 933262154439441526816992388562667004907159682643816214# (C45) FAC(N):=IF N=0 THEN 1 ELSE N*FAC(N-1); (D45) FAC(N) := IF N = 0 THEN 1 ELSE N FAC(N - 1) (C46) FAC(5); (D46) 120 ``` -------------------------------- ### Hodge Star Operator Examples in Maxima Source: https://github.com/calyau/maxima/blob/master/share/diff_form/lorentz_example.txt Demonstrates the usage of the `h_st` function, likely implementing the Hodge star operator, on various bivectors in a geometric algebra context. The examples show how the operator transforms basis vectors based on the defined metric. ```maxima h_st(Dx@c*Dt) h_st(Dx@Dy) h_st(Dz@c*Dt) h_st(Dy@c*Dt) h_st(Dz@Dx) h_st(Dy@Dz) ``` -------------------------------- ### Compile and Match Regular Expressions in Maxima Source: https://github.com/calyau/maxima/blob/master/share/stringproc/len-897-md5-f353a8.txt Compiles a regular expression pattern and then finds all occurrences within a string. The `regex_compile` function creates a regex object, while `regex_match_pos` returns the start and end positions of matches. It supports optional start and end indices for searching within a substring. ```maxima ( kill (all), 0); regex : regex_compile("ne{2}dle"), str : "his hay needle stack -- my hay needle stack -- her hay needle stack"; regex_match_pos(regex, str); regex_match_pos(regex, str, 25, 44); regex_match_pos(regex, str, 25); regex_match("ne{2}dle", "hay needle stack"); ``` -------------------------------- ### sfquery.py Command-line Usage and Query Examples Source: https://github.com/calyau/maxima/blob/master/admin/sfquery-docs.txt Demonstrates the basic command-line structure of sfquery.py and provides examples of Python query expressions to filter bug artifacts. These queries can check specific field values or search for strings within all fields using the 'contains' function. ```bash sfquery.py # Query to search for a specific field value "artifact.get('foo') == 'bar'" # Query to search all field values for a string or regex "contains(artifact,'foobar')" ``` -------------------------------- ### Compile Winkill Helper Program (CMake) Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/CMakeLists.txt Compiles the 'winkill' helper program and its associated library 'winkill_lib' using CMake. This is done separately because the standard autoconf method does not work for cross-compiling 'winkill'. The output library 'winkill_lib' has its 'lib' prefix removed to produce a DLL. ```cmake option(STRIP_HELPERPROGRAMS "Strip the included helper programs (winkill, winkill_lib, maxima_longnames)." YES) # crosscompiling winkill with autoconf does not work, compile it using CMake. add_library(winkill_lib SHARED ${CMAKE_SOURCE_DIR}/../interfaces/xmaxima/win32/winkill_lib.c) add_executable(winkill ${CMAKE_SOURCE_DIR}/../interfaces/xmaxima/win32/winkill.c) set_target_properties(winkill_lib PROPERTIES PREFIX "") # remove 'lib' prefix from libwinkill_lib.dll target_link_libraries(winkill winkill_lib) ``` -------------------------------- ### sfquery.py Example: Find Bugs Containing Text and Print Specific Fields Source: https://github.com/calyau/maxima/blob/master/admin/sfquery-docs.txt This example demonstrates searching for bugs containing a specific string ('plot') using the 'contains' function. The action part uses Python's 'sys.stdout.write' to print only the submitter and status of each matched bug, showing custom output formatting. ```bash ./sfquery.py bugs-10-02-2003.xml \ "contains(artifact,'plot')" \ "sys.stdout.write('%s\n' % artifact.get('submitted_by'));sys.stdout.write('%s\n\n' % artifact.get('status'))" ``` -------------------------------- ### Maxima: Get right-hand side of an equation Source: https://github.com/calyau/maxima/blob/master/doc/intromax/intromax.html The 'rhs' function returns the expression on the right-hand side of an equation. ```maxima rhs(equation); ``` -------------------------------- ### Evaluating Limits in Maxima Source: https://github.com/calyau/maxima/blob/master/interfaces/xmaxima/intro.html Illustrates how to compute limits of functions as variables approach a certain value, including infinity, using Maxima. ```maxima limit( (2*x+1)/(3*x+2), x,inf ); limit( sin(3*x)/x, x,0); ``` -------------------------------- ### Maxima: Get real part of an expression Source: https://github.com/calyau/maxima/blob/master/doc/intromax/intromax.html The 'realpart' function extracts and returns the real component of a given expression. ```maxima realpart(expression); ``` -------------------------------- ### Modifying Operator Evaluation Quality Factors in Maxima Source: https://github.com/calyau/maxima/blob/master/share/algebra/solver/solver1-en.html This code demonstrates how to set and query the 'Valuation' property for operators in Maxima. The 'Valuation' property acts as a quality factor for evaluating algebraic expressions. This allows users to influence the heuristic complexity evaluation of algebraic printouts. The SetProp function is used to assign a quality factor, and Get is used to retrieve it. If Get returns FALSE, it means no quality factor has been defined for the operator. ```maxima SetProp(' sin, ' Valuation, 10) $ SetProp(' cos, ' Valuation, 10) $ SetProp(' tan, ' Valuation, 10) $ SetProp(' asin, ' Valuation, 12) $ SetProp(' acos, ' Valuation, 12) $ SetProp(' atan, ' Valuation, 12) $ SetProp(' sinh, ' Valuation, 12) $ SetProp(' cosh, ' Valuation, 12) $ SetProp(' tanh, ' Valuation, 12) $ SetProp(' asinh, ' Valuation, 12) $ SetProp(' acosh, ' Valuation, 12) SetProp(' tanh, ' Valuation, 20) $ Get('* ', ' Valuation); ``` -------------------------------- ### Compile and Execute a Simple Function in Maxima Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/README.txt Demonstrates how to define, compile, and execute a simple function in Maxima. This test helps verify the basic compilation and execution pipeline. ```maxima f(x):=x+2; compile(f); f(2); ``` -------------------------------- ### Fibonacci Sequence Definition in Maxima Source: https://github.com/calyau/maxima/blob/master/interfaces/xmaxima/intro.html Defines the Fibonacci sequence recursively in Maxima and shows how to call it to get a specific term. ```maxima Fib[0] : 0; Fib[1] : 1; Fib[n] := Fib[n-1] + Fib[n-2]; Fib[8]; ``` -------------------------------- ### Solving Ordinary Differential Equations in Maxima Source: https://github.com/calyau/maxima/blob/master/interfaces/xmaxima/intro.html Demonstrates solving ordinary differential equations (ODEs) analytically using Maxima's 'ode2' function for first and second-order ODEs. ```maxima ode2('diff(y,x)+3*x*y = sin(x)/x, y,x); ode2('diff(y,x) -y = 1, y,x); ode2('diff(y,x,2) - y = 1, y,x); ``` -------------------------------- ### Linear Algebra Operations in Maxima Source: https://github.com/calyau/maxima/blob/master/interfaces/xmaxima/intro.html Shows how to define, add, multiply, and find the inverse and determinant of matrices using Maxima. ```maxima A:matrix([1,2],[3,4]); B:matrix([1,1],[1,1]); A + B ; A . B ; A^^-1 ; determinant(matrix([a,b],[c,d])); ``` -------------------------------- ### Drawing Multivariate Certificates (Maxima) Source: https://github.com/calyau/maxima/blob/master/share/contrib/sarag/readme.txt Visualizes the subdivision corresponding to a multivariate certificate. Takes the output of `multiCertificate` and a scaling factor as input. Dependencies: `multiCertificate`. -------------------------------- ### Get Dimension as List of Exponents in Maxima Source: https://github.com/calyau/maxima/blob/master/share/physics/dimension.html Uses the 'dimension_as_list' function to return the dimension of an expression as a list of exponents corresponding to the 'fundamental_dimensions'. ```maxima dimension_as_list('diff(x,t,3)); ``` -------------------------------- ### Maxima: Polynomial Expansion and Substitution Source: https://github.com/calyau/maxima/blob/master/doc/intromax/intromax.html Shows how to expand a polynomial and perform substitutions within an expression using Maxima. The `expand` function simplifies the polynomial, and substitution is done by providing a comma-separated list of variable assignments. ```maxima (x + 3*y + x^2*y)^3; expand (%); %o2, x=5/z; ``` -------------------------------- ### Load and Solve NETLIB Linear Programming Problems (Maxima) Source: https://github.com/calyau/maxima/blob/master/share/simplex/Tests/Readme.txt This code demonstrates loading smaller problems from the NETLIB test suite into Maxima. It uses the 'numericalio' library to read matrix A and vectors b and c from CSV files and then solves the linear program using the 'linear_program' function. The example shows reading the 'adlittle' problem. ```Maxima load("numericalio/numericalio"); A : read_matrix("adlittle_A.csv", 'csv) $ b : read_list("adlittle_b.csv", 'csv) $ c : read_list("adlittle_c.csv", 'csv) $ linear_program(A, b, c)$ ``` -------------------------------- ### wxMaxima Tarball Download and Build Source: https://github.com/calyau/maxima/blob/master/crosscompile-windows/wxmaxima/CMakeLists.txt This snippet manages the download and build process for wxMaxima using a tarball archive. It specifies the URL, download directory, filename, and MD5 checksum for verification. Similar to the Git method, it uses `externalproject_add` to define the build target and includes cross-compilation specific CMake arguments. ```cmake set(WXMAXIMAVERSION "24.11.0") set(WXMAXIMA_MD5 "d2ddc348428330042720b5a359d0f409") set(WXMAXIMA_URL "https://github.com/wxMaxima-developers/wxmaxima/archive/refs/tags/Version-${WXMAXIMAVERSION}.tar.gz") externalproject_add(wxmaxima URL "${WXMAXIMA_URL}" DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/downloads DOWNLOAD_NAME wxmaxima-${WXMAXIMAVERSION}.tar.gz URL_MD5 ${WXMAXIMA_MD5} DEPENDS wxwidgets CMAKE_CACHE_ARGS "-DCMAKE_PROGRAM_PATH:PATH=${CMAKE_BINARY_DIR}/wxwidgets/wxwidgets-prefix/src/wxwidgets-build" CMAKE_ARGS -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_RC_COMPILER=${CMAKE_RC_COMPILER} -DCMAKE_LIBRARY_PATH=/usr/${HOST}/lib -DCMAKE_INSTALL_PREFIX=${WINDOWS_DRIVELETTER}:/maxima-${MAXIMAVERSION} -DCMAKE_BUILD_TYPE=Release BUILD_COMMAND $(MAKE) ) install(DIRECTORY ${CMAKE_BINARY_DIR}/wxmaxima/wxmaxima-prefix/src/wxmaxima-build/${WINDOWS_DRIVELETTER}\:/maxima-${MAXIMAVERSION}/ DESTINATION . COMPONENT wxMaxima) ```