Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Last week, DeepMind announced their new AlphaEvolve software along with a number of new results improving optimization results in a number of areas. One of those results is a new, smaller, tensor decomposition for multiplying two 4 × 4 matrices in 48 scalar multiplications, improving on the previous best decomposition which needed 49 multiplications (Strassen 1969). While the DeepMind paper was mostly careful about stating this, when writing the introduction, the authors mistakenly/confusingly wrote:

For 56 years, designing an algorithm with rank less than 49 over any field with characteristic 0 was an open problem. AlphaEvolve is the first method to find a rank-48 algorithm to multiply two 4 × 4 complex-valued matrices

This gives the impression that this new result is the way to multiply 4 × 4 matrices over a field with the fewest number of field multiplications. However, it's not even the case that Strassen's 1969 paper gave a faster way to multiply 4 × 4 matrices. In fact, Winograd's 1968 paper on computing inner products faster could be applied to 4 × 4 matrix multiplication to get a formula using only 48 multiplications. Winograd uses a trick 

which changes two multiplications of ab's into one multiplication of ab's and two multiplications involving only a's or only b's. The latter multiplications can be pre-computed and saved when calculating all the innerproducts in a matrix multiplication

    # i=1..4, 4*2 = 8 multiplications
    p[i] := -A[i, 1]*A[i, 2] - A[i, 3]*A[i, 4];
    # 4*2 = 8 multiplications
    q[i] := -B[1, i]*B[2, i] - B[3, i]*B[4, i];
    # i=1..4, j=1..4, 4*4*2 = 32 multiplications
    C[i,j] = p[i] + q[j] 
            + (A[i,1]+B[2,j])*(A[i,2]+B[1,j])
            + (A[i,3]+B[4,j])*(A[i,4]+B[3,j])

It is simple to verify that C[i,j] = A[i,..] . B[..,j] and that the above formula calculates all of the entries of C=A.B with 8+8+32=48 multiplications.

So, if Winnograd achieved a formula of 48 multiplications in 1968, why is the DeepMind result still interesting? Well, the relative shortcoming of Winograd's method is that it only works if the entries of A and B commute, while tensor decomposition formulas for matrix multiplication work even over noncommutative rings. That seems very esoteric, but everyone's favorite noncommutative ring is the ring of n × n matrices. So if a formula applies to a matrix of matrices, that means it gives a recursive formula for matrix multiplication - an tensor decomposition formulas do just that.

The original 1969 Strassen result gave a tensor decomposition of 2 × 2 matrix multiplication using only 7 scalar multiplications (rather than the 8 required by the inner product method) and leads to a recursive matrix multiplication algorithm using O(N^log[2](7)) scalar multiplications. Since then, it has been proved that 7 is the smallest rank tensor decompostion for the 2 × 2 case and so researchers have been interested in the 3x3 and larger cases. Alexandre Sedoglavic at the University of Lille catalogs the best tensor decompositions at https://fmm.univ-lille.fr/ with links to an Maple file with an evaluation formula for each.

The previous best 4 × 4 tensor decomposition was based on using the 2 × 2 Strassen decomposition recursively (2 × 2 matrix of 2 × 2 matrices) which led to 7 2 × 2 matrix multiplications each requiring 7 scalar multiplications, for a total of 49. The new DeepMind result reduces that to 48 scalar multiplications, which leads to a recursive algorithm using O(Nlog[4](48)) scalar multiplications: O(N2.7925) vs. O(N2.8074) for Straussen. This is a theoretical improvment over Strassen but in 2024 the best known multiplication algorithm has much lower complexity: O(N2.3713) (see https://arxiv.org/abs/2404.16349). Now, there might be some chance that the DeepMind result could be used in practical implementations, but its reduction in the number of multiplications comes at the cost of many more additions. Before doing any optimizations I counted 1264 additions in the DeepMind tensor, compared to 318 in the unoptimized 4×4 Strassen tensor (which can be optimized to 12*7+4*12=132). Finally, the DeepMind tensor decomposition involves 1/2 and sqrt(-1), so it cannot be used for fields of characteristic 2, or fields without sqrt(-1). Of course, the restriction on characteristic 2 is not a big deal, since the DeepMind team found a 4 × 4 tensor decomposition of rank 47 over GF2 in 2023 (see https://github.com/google-deepmind/alphatensor).

Now if one is only interested in 4 × 4 matrices over a commutative ring, the Winograd result isn't even the best possible. In 1970, Waksman https://ieeexplore.ieee.org/document/1671519 demonstrated an improvement of Winograd's method that used only 46 multiplications as long as the ring allowed division by 2. Waksman's method has since been improved by Rosowski to remove the divisions see https://arxiv.org/abs/1904.07683.

Attached are Maple worksheets that create the explicit formulas for the 4 × 4 matrix methods mentioned in this post, and verify their operation count, and that they are correct.

Strassen_444.mw  Winograd.mw  DM_444.mw Waksman.mw Rosowski.mw

If you are interested in some of the 2023 results, I posted some code to my GitHub account for creating formulas from tensor decompositions, and verifying them on symbolic matrix multiplications: https://github.com/johnpmay/MapleSnippets/tree/main/FastMatrixMultiplication

The clear followup question to all of this is:  does Maple use any of these fast multiplication schemes?  And the answer to that is mostly hidden in low level BLAS code, but generally the answer is: No, the straightforward inner-product scheme for multiplying matrices optimized memory access thus usually ends up being the fastest choice in most cases.

I have just started to use Maple workbook (*.maple). In the workbook, there are 4 worksheets: "main.mw","calc1.mw","calc2.mw","calc3.mw". In "main.mw", I plot variables saved from "calc?.mw". This works. However, when I make changes in one of the worksheet "calc?.mw" and get the new expressions for the variables, they are not updated in "main.mw". I deleted the variables being changed but "main.mw" still run and show the old expressions of these variables.

How do I refresh so that "main.mw" will show the updated variables from "calc?.mw"?

Thanks.

Hi,

I’ve [K] & [M] matrices in sparse format for FE code. How do I convert them to be able to do eigensolution?

restart;

with(LinearAlgebra);

stiffness_data := ImportMatrix("d:/Simulation_1_STIF1.csv");

stiffness_matrix := Matrix(max(stiffness_data[() .. (), 1]), max(stiffness_data[() .. (), 2]), sparse = [seq([stiffness_data[i, 1], stiffness_data[i, 2], stiffness_data[i, 3]], i = 1 .. nops(stiffness_data))]);

Error, (in Matrix) argument `sparse = [[1, 1, 328.0000000], [1, 5, -20434.40000], [5, 1, -20434.40000]]` is incorrect or out of order

Even if I try with a simple matrix example it gave an error.

with(LinearAlgebra);

A := Matrix(5, 5, sparse = [[1, 1, 328.0], [1, 5, -20434.4], [5, 1, -20434.4]]);

Error, (in Matrix) argument `sparse = [[1, 1, 328.0], [1, 5, -20434.4], [5, 1, -20434.4]]` is incorrect or out of order

Please help.

Thanks,

Shashi

Trying to produce two different font sizes within a plot title.  I can achieve it with Typesetting but I'm getting brackets and fluff I don't want.  Any other ideas?

For example

with(Typesetting):
plot(x^2, title = [cat(mtext("sort of", font = "TimesNewRoman", size = 30), mtext("works", size = 10))])

Dear Power Users,

This is probably a simple question for you but I am stuck. In the attached worksheet I would like to plot (the plot is called P5) a vector with units (mm) against a vector without units. This didn't work out, so I removed the units from the vector with units, and this plotted but after the conversion the numeric values are no longer in mm but inches. How can I correct this?

Thank you in advance for your time and willingness to help.

testSheetHorseShoe.mw

Hello,

I have a few questions.

  1. When using ordered list, it keeps getting out of order. It will do 1, 2, then 5, 6 sometimes. If I tried to delete incorrectly numbered list, instead of restarting from the correct order, it will keep incrementing.
  2. How do I create a indented bullet list?
  3. Documentation for Maple 2025 doesn't seem to be up to date. I am looking to use "Tabkey" to indent text. It seems really difficult to get it done. Where do I find "Format>Tab Navigation"?
    1. https://www.maplesoft.com/support/help/Maple/view.aspx?path=worksheet/documenting/tabkey

Thanks for the help.

in some of my function i have a big problem which i can't plot thus function even i know what is the shape of plot, i have two type of ploting directly giving parameter and using explor but for this kind of plot we can't use explor so i have to give the function directly parameter but is wasting my time a lot and i can't get my plot even spending a days by changing parameter one by one, my questions is this how i can plot this kind of function without bieng a singular i need this function to be non singular is not importan about the parameter can be any number 
thanks for any help 

plots-long_term_.mw

the shape of plot must be like this but must have two of them 

Dear all

I get error when solving Riccati equation. I want to get six different solution. 

ricatti_equation.mw

thank you for your help

In the attached file, I want to restrict the indices of the summation to gcd(m,n)=1. How does this work?

test.mw

I’m trying to plot a 3D surface in Maple with variables l and m. I used numerical substitution to evaluate the function and the results are real and positive. However, when I plot the function over a range of l and m, the graph shows complex (imaginary) values instead.

This seems very strange to me and has been quite frustrating. I’ve tried many different approaches to resolve the issue, but nothing has worked so far.

Why is this happening? How can the function evaluate to real numbers with direct substitution, but show complex values during plotting?

Any suggestions or explanations would be greatly appreciated. Thank you!
gra423_Omega.mw

This seems rediculous to have to ask. I just want to display a plane. The plot is used in other plots so I gave it a name. I get "length of output exceed 1000000" and the plot does not display. I then have to "display" the plot name "display(plt0)" to see it. I had tried geom3d but found if infuriating, (maybe I am missing something there).

An I missing something simple here?

restart

NULL

with(plots)

pln := x-2*y+3*z

x-2*y+3*z

(1)

NULL

display(implicitplot3d(pln, x = -3 .. 3, y = -3 .. 3, z = -3 .. 3, style = patchnogrid, transparency = .6))

 

NULL

NULL

plt0 := display(implicitplot3d(pln, x = -3 .. 3, y = -3 .. 3, z = -3 .. 3, style = patchnogrid, transparency = .6))

`[Length of output exceeds limit of 1000000]`

(2)

display(plt0)

 

Intended use

NULL

Download 2025-05-18_Q_display_a_simple_plane.mw

In the attached file, I was unable to calculate the limit values ​​L and M. Please help me.

test.mw

Same exact code. When adding Physics:-Setup(assumingusesAssume = true):  before, now pdsolve do not give solution.

Removing Physics:-Setup(assumingusesAssume = true): now it works.

Why? Should not solution be returned in both cases?

interface(version);

`Standard Worksheet Interface, Maple 2025.0, Linux, March 24 2025 Build ID 1909157`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1872 and is the same as the version installed in this computer, created 2025, May 17, 22:58 hours Pacific Time.`

SupportTools:-Version();

`The Customer Support Updates version in the MapleCloud is 17 and is the same as the version installed in this computer, created May 5, 2025, 12:37 hours Eastern Time.`

restart;

Example 1. Adding Physics:-Setup(assumingusesAssume = true): makes pdsolve fail

 

Physics:-Setup(assumingusesAssume = true):

pde := diff(u(r, t), t) = k*diff(u(r, t), r$2):
ic  := u(r,0)=r*f(r):
bc  := u(0,t)=0,u(a,t)=a*phi(t):
sol:= pdsolve({pde, ic, bc}, u(r, t));

 

 

Example 2. Same code but removing Physics:-Setup(assumingusesAssume = true): makes it work

 

restart;

pde := diff(u(r, t), t) = k*diff(u(r, t), r$2):
ic  := u(r,0)=r*f(r):
bc  := u(0,t)=0,u(a,t)=a*phi(t):
sol:= pdsolve({pde, ic, bc}, u(r, t));

u(r, t) = Sum(2*sin(n*Pi*r/a)*exp(-k*Pi^2*n^2*t/a^2)*(Int(r*(-phi(0)+f(r))*sin(n*Pi*r/a), r = 0 .. a))/a, n = 1 .. infinity)+Int(Sum(2*sin(n*Pi*r/a)*exp(-k*Pi^2*n^2*(t-tau)/a^2)*(diff(phi(tau), tau))*a*(-1)^n/(n*Pi), n = 1 .. infinity), tau = 0 .. t)+r*phi(t)

 


 

Download pdsolve_fail_when_adding_assuming.mw

I'm currently working on applying a specific method to solve a nonlinear equation. However, I've encountered a recurring issue: during the process, I often cannot determine certain parameters, which forces me to abandon the solution or switch to a different method. This has happened multiple times and is disrupting my goal of applying all intended methods consistently to a single equation.

In particular, I’m struggling to identify the correct parameters for U(ξ), which are essential for the solution. This challenge is not limited to one method I’ve faced similar problems in previous attempts, and I’m unsure why these parameters cannot be derived in some cases.

My question is: How can I manage this issue effectively? Is there a reliable way to predict or determine whether the necessary parameters will emerge correctly before fully applying a method?

I would greatly appreciate any insights or strategies you could share to help me handle this problem more systematically.

Thank you in advance for your support.

runing.mw

I was investigating a bug and repeatedly opened worksheets. In one of the former worksheets I used the debugger and closed it. In the below case there was no debugger running in the worksheet and also no debugger was visible as a separate Windows task in the task bar.

In this case below the message from the debugger is displayed delayed (i.e. when a new statement is entered).

For comparision: No delay with Maple 2025 screen reader

Could it be that the new GUI mixes up mservers?

Is the above reproducible?

1 2 3 4 5 6 7 Last Page 1 of 2205