MaplePrimes Questions

Let x, y, z be nonnegative real numbers. Obviously, x3+y3+z3-4xyz is not always nonnegative, since its value is -1 when x=y=z=1. But why Maple's minimize gives wrong result? 

minimize(x^3 + y^3 + z^3 - 4*x*y*z, x = 0 .. infinity, y = 0 .. infinity, z = 0 .. infinity);

Attachment: MinValue.mws.

MMA's Minimize finds correct infimum: 
So, can Maple always find correct exact (i.e., not just numerical) global minima (or maxima) at least for such problems with a small number of variables as well?

When you use

restart:
with(Physics):
Setup(mathematicalnotation=true):
diff(x(t), t)

the output is $\dot{x}(t)$
When you write 

restart:
alias(x=x(t)):
diff(x, t)

the output is $\frac{\partial}{\partiall t} x$

Is it possible to "mix" these two in such a way that diff(x, t) appears as $\dot{x}$ ?
Notation.mw

Thanks in advance

Wanted to plot a vector with the arrow function

for some reason the arrow head was not created. tried changing the input so the resulting coordinat would be [10,10] insted of [725,350] this created an arrowhead on the line.

with(plots):
with(plottools):
l1 := arrow([0, 0], [725, 350], 0.1, 0.4, 0.1, arrow, color = red, legend = "Vector v");
display(l1, axes = frame, view = [0 .. 900, 0 .. 500]);

Why does it not create the arrow head happen???

Either I am clueless (or very tired) or StringTools:-Remove is not behaving as it should (document attached)

IsThisABug.mw

Suppose a have a file "test.txt" with the following single line of code (intentionally missing the "end if"):

When I run "maple test.txt" from the command line, it shows the following and quits:

> if x = 1 then print("hi");
> quit
> quit
on line 3 of "test.txt", syntax error, reserved words `quit`, `done`, or `stop` unexpected
> quit

But it quits with exit code 0, despite the syntax error. Is there a way to get Maple to quit with a nonzero exit code when there is a syntax error?

What I would actually like is that if Maple encounters any error at all (syntax or otherwise), the script immediately ceases execution and exits with a nonzero error code. When the error is NOT a syntax error, I can at least accomplish this by wrapping the entire script in a try/catch block. But I'm hoping there's a better way.

Not the first time that a question (OP's name  PhearunSeng ) is removed as I am writing an answer (I guess other people have already faced the same inconvenience). 
Why doesn't exist a mechanism which prevents removing, deleting, displacing a question where someone (here Carl) has akready given an answer ???

Whatever the reason, here is my answer

Title: Can be done quickly if you write the matrix in a more abstract form

MyKGff := Matrix(5, 5, 
  {
    (1, 1) = A+(1/63368)*B, 
    (1, 2) = -(1/63368)*B, 
    (1, 3) = -(1/39605)*B, 
    (1, 4) = 0, 
    (1, 5) = 0, 
    (2, 1) = -(1/63368)*B, 
    (2, 2) = (1/63368)*B+C, 
    (2, 3) = (1/39605)*B, 
    (2, 4) = -C, 
    (2, 5) = 0, 
    (3, 1) = -(1/39605)*B, 
    (3, 2) = (1/39605)*B, 
    (3, 3) = (8/198025)*B, 
    (3, 4) = 0, 
    (3, 5) = 0, 
    (4, 1) = 0, 
    (4, 2) = -C, 
    (4, 3) = 0, 
    (4, 4) = C+(1/63368)*F, 
    (4, 5) = -(1/39605)*F, 
    (5, 1) = 0, 
    (5, 2) = 0, 
    (5, 3) = 0, 
    (5, 4) = -(1/39605)*F, 
    (5, 5) = (8/198025)*F
  }
);

Then (Maple 2015.2)

PseudoInverse := CodeTools:-Usage( LinearAlgebra:-MatrixInverse(MyKGff, method=pseudo) ):
memory used=28.38MiB, alloc change=68.00MiB, cpu time=312.00ms, real time=314.00ms, gc time=24.90ms

To recover the pseudo inverse with original data do

Rewrite := [
             A = (D__pile*W[1] . E__c)/3000, 
             B = (D__pile*W[2] . E__c)*89^(1/2), 
             C = (D__pile*W[3] . E__c)/1000, 
             F = (D__pile*W[4] . E__c)*89^(1/2)
           ]:

eval(PseudoInverse, Rewrite):

InverseMatrix_mmcdara.mw

I would like to be able to use python's matplotlib from Maple. I am doing the following currently

with(Python)
Start('home' = "/opt/anaconda3/lib/python3.9", 'path' = "/opt/anaconda3/lib/python3.9/site-packages")
ImportModule("matplotlib as mpl")

and the error I get back is

Error, (in Python:-ImportModule) ModuleNotFoundError: No module named 'matplotlib'
['Traceback (most recent call last):\n', '  File "<string>", line 1, in <module>\n', "ModuleNotFoundError: No module named 'matplotlib'\n"]

The string I passed into path is the directory where matplotlib seems to be located as far as I can tell. I looked this up in my IDE Spyder, but using the command print(matplotlib__file__).

UPDATE: but actually if I open a new worksheet and execute 

with(Python)
Start('home' = "/opt/anaconda3/lib/python3.9", 'path' = "/opt/anaconda3/lib/python3.9/site-packages")

The error is that 

Error, (in Python:-Start) unable to start Python: could not create process, mpython

So Maple isn't finding Python apparently.

I tried for 'home' also "/opt/anaconda3/bin", did not work.
 

Hello guys.

How to determine the gradient of the following vector field below:

with(VectorCalculus):

with(Student[VectorCalculus]):

SetCoordinates('cylindrical'[r, theta, z]):

V:=VectorField(<omega*r, 0, z*r>)

Gradient(V, [r, theta, z]);

Error, invalid input: too many and/or wrong type of arguments passed to Student:-VectorCalculus:-Gradient; first unused argument is Vector(3, [omega*r,0,z*r], attributes = [vectorfield, coords = cylindrical[r,theta,z]])

Regards,

Oliveira

Working with a Document, I have a procedure which plots a graph and part of the procedure code looks like this:

with(plots)
A := Array(1)
A := plot(...plots two series...):
display(A)

The first time the procedure is called everything is as expected.  The second time the procedure is called (with different values to be plotted), the graph is not updated and therefore does not reflect the changed data

I am thinking that maybe, each time I call the procedure, I need to somehow "reset" or "release" something at the beginning of the procedure so that the plot is recreated? 

I was working on a document to which I had made some changes which had not been saved.  When running Evaluate Worksheet I had to end the task because I couldn't stop the evaluation.  On re-opening the document my changes were lost, not surprisingly.

Does Maple keep any temporary files anywhere from which I might be able to salvage my changes?

Hello guys.
Is there any way to frame the styles: Input 2D, Output 2D and Text?

Oliveira.

Hello,

I am collecting my coefficients with the below code. Since it is a huge data, i just give a some partion. So I want to write u11 to a text file. But when i use this command  save u11, "u111.txt" . It is writing to text but with big blanks. I show you at the below picture. So when i put it to matlab, it is again with spaces and matlab giving errors. So how can i save my long symbolic output (you can see in picture)  to a text file without spaces. I used 

fd := "C:/double/u11.txt"

fprintf(fd, "%s", u11)

fclose(fd)

But it did not work. So if you could help me, i really appreciate. My best regards. 

A robust largescale index-1 DAE (and stiff ODE) solver has been developed in Maple.

PS: These codes run only with the Java version of Maple. Codes are saved as *.mws for the ease of typing. One can download the files and save them as *.mw as well.
Details about our approach are provided in a paper just submitted. 
See arxiv at
https://arxiv.org/abs/2212.02630

We encourage everyone to test these codes and report bugs. All the examples can be run with Intel's Pardiso (provided users have access to libraries) by calling DAESolverP.txt and by calling "IMPDAEP" instead of "IMPDAE". This is useful for large-scale problems. The symbolic capability and ListTools search capability of Maple are very good and can be used for developing optimization solvers as well.

I would like to know if CPU time/memory usage can be reduced significantly. In particular,  for examples 5 and 6. Some ways to contribute include

(1) Running the code in evalhf or compiled form. This may be hard.
(2) Providing options to run other parallel open-source linear solvers (eg., MUMPS).

(3) Other examples that show the use of the developed solver. We are able to solve > 100,000 DAEs.

(4) Helping in converting the code to Maple 14 or earlier (by doing sparse LU Decomposition. Just using LinearSolve will slow down the code).

 

Please avoid ~,*, etc (shortcuts) unless it improves the speed of calculation.
Thanks 
Dr. Venkat Subramanian

Download examples_1_3.mws

Download example_4.mws

Download example_5.mws

Download example_6.mws

 

mw format files are given below
Download examples_1_3.mw

Download example_4.mw

Download example_5.mw

Download example_6.mw

DAESolver.txt

DAESolverP.txt

With  
DrawGraph(G, stylesheet = [vertexpadding = 35], showlabels = false)
I get this

But if I wish emphasize the chromatic number, with
COLORS := [red, yellow, cyan, green, coral, blue, magenta, navy, orange, pink, plum, khaki, turquoise];
cn := ChromaticNumber(G, 'col');
for i to cn do
    HighlightVertex(G, col[i], COLORS[i]);
end do;
DrawGraph(G, stylesheet = [vertexpadding = 35], showlabels = false);
I get this

I want bigger vertices, any suggestions? Thanks

> expr[[(-.684-1.08*r+6.1*r^2-2*r^3+0.36e-1*ln(10.*r)-.3*r^2*ln(10.*r))/(-1.14+1.2*r+0.6e-1*ln(10.*r)), 1.290994449*sqrt((-.1296*r+1.512*r^2-.36*r^3+6.1*r^4-2*r^5-0.72e-1*r^2*ln(10.*r)-.3*r^4*ln(10.*r)+(-.684-1.08*r+6.1*r^2-2*r^3+0.36e-1*ln(10.*r)-.3*r^2*ln(10.*r))*(.216*r-2.52*r^2+.12*r^2*ln(10.*r))/(-1.14+1.2*r+0.6e-1*ln(10.*r)))/(-1.14+1.2*r+0.6e-1*ln(10.*r)))], [(-.684-1.08*r+6.1*r^2-2*r^3+0.36e-1*ln(10.*r)-.3*r^2*ln(10.*r))/(-1.14+1.2*r+0.6e-1*ln(10.*r)), -1.290994449*sqrt((-.1296*r+1.512*r^2-.36*r^3+6.1*r^4-2*r^5-0.72e-1*r^2*ln(10.*r)-.3*r^4*ln(10.*r)+(-.684-1.08*r+6.1*r^2-2*r^3+0.36e-1*ln(10.*r)-.3*r^2*ln(10.*r))*(.216*r-2.52*r^2+.12*r^2*ln(10.*r))/(-1.14+1.2*r+0.6e-1*ln(10.*r)))/(-1.14+1.2*r+0.6e-1*ln(10.*r)))]];
> plot([seq([expr[j][], r = 0 .. 1], j = 1 .. 2)], -6 .. 6, -10 .. 10, color = [blue, blue]);
 why I am getting error in this, please help

First 132 133 134 135 136 137 138 Last Page 134 of 2308