Maple Questions and Posts

These are Posts and Questions associated with the product, Maple
solve({sigma*E-(mu+alpha+gamma)*I = 0, gamma*E+Lambda*N*P-(mu+alpha)*R = 0, Beta__1*S*E+Beta__2*S*I/(I*M+1)-(mu+sigma)*E = 0, Lambda(1-p)*N-mu*S-Beta__1*S*E-Beta__2*S*I/(I*M+1) = 0}, {E, I, R, S}, explicit)

I'm not sure if there's something on the page I'm not seeing but even  https://www.maplesoft.com/support/help/Maple/view.aspx?path=Optimization/Minimize#examples

 

Maximize(2*x^2 + 2*y^2 + y, {2*x + y <= 6, y^2 - x <= 2})

a literal copy-paste of the posted example maple just repeats what I posted Idk whats wrong. btw is there some way to read the maple documentation pages?

 

Wis_BS2_Taak2_2019-2020_20200323-1.mw

Hello,

I have some huge troubble with making sure all formula's wont be forgotten by Maple.

For example:

f(x):=a+b;
a:=5;
b:=2;
f(x):=f(x);  --> gives me f(x):=f(x) instead of saying f(x):=7

In my document the naming is a bit more complex.

I have a variable named "M_Inwendig2[y]" in the uploaded document. When i name it "M_Inwendig2(y)" (notice [-->( )
maple refuses to use the previous filled/calculated variables.

Due to this error i have copy and pasted the answer to a new formula to continue my work, therefor it becomes quite messy... Now i am trying to fix this.

Ideal all names will be M[inwendig2](y). So the first letter will tell the kind of variable (Moment) the subscript will tell the part (inside) and the depending variable will be between ().

In the document i have marked all error's and copy's RED.

Anyone can advice me? i have named variables the same way in the past, but now it doesnt work.

Regards,


 

I am interested in how easy it is to work with formulae in the Maple language.  For example, you can easily add two equations together with '+'.

 

e1:=x^2+1=2*x;

x^2+1 = 2*x

(1)

e2:=x^3+x=5;

x^3+x = 5

(2)

e1+e2;

x^3+x^2+x+1 = 2*x+5

(3)

 

I was pleased when the following example added (x+1) to both sides of an equation,

 

e3:=x+1;

x+1

(4)

e1+e3;

x^2+x+2 = 3*x+1

(5)

Some other algebraic operations work.

e1-e3;

x^2-x = x-1

(6)

e1*e3;

(x+1)*(x^2+1) = 2*(x+1)*x

(7)

e1/e3;

(x^2+1)/(x+1) = 2*x/(x+1)

(8)

e1^(1/2);

(x^2+1)^(1/2) = 2^(1/2)*x^(1/2)

(9)

 

Build-in functions do not work, though, but there is a simple solution.

exp(e1);

Error, invalid input: exp expects its 1st argument, x, to be of type algebraic, but received x^2+1 = 2*x

 

exp(rhs(e1))=exp(lhs(e1));

exp(2*x) = exp(x^2+1)

(10)

map(exp,e1);

exp(x^2+1) = exp(2*x)

(11)

 

The methods also apply to inequality formulae.  I'm not as pleased about how it does '*' and '/' for inequalities.  You can get more control using rhs and lhs functions.  Here are some examples:  

e4:=x^3<5*(x+1);

x^3 < 5*x+5

(12)

e4+e3;

x^3+x < 6*x+5

(13)

e4-e3;

x^3-x < 4*x+5

(14)

e4*e3;

(x^3 < 5*x+5)*(x+1)

(15)

e4/e3;

(x^3 < 5*x+5)*(1/(x+1))

(16)

eval(%,x=4);

64/5 < 5

(17)

evalb(%);

false

(18)

(16)/x^2;

((x^3 < 5*x+5)*(1/(x+1)))/x^2

(19)

simplify(%);

((x^3 < 5*x+5)*(1/(x+1)))/x^2

(20)

lhs(e4)/e3/x^2 < rhs(e4)/e3/x^2;

x/(x+1) < (5*x+5)/((x+1)*x^2)

(21)

simplify(%);

x/(x+1) < 5/x^2

(22)

 


 

Download equations.mw

Any  idea is good for me !

 

According to Wikipedia  https://www.wikidata.org/wiki/Q3115604 ,

Outerplanar graph  is a graph that can be drawn without crossings in the plane (means it is planar graph) with all vertices on the outer face.  

For example 

 

Recently  in my project, I  need to judge whether a planar graph is a  outerplanar graph.

I tried to find some algorithms but failed. 

Maple  only considers how to test wheather a graph is  planar.

like following:

with(GraphTheory):
with(SpecialGraphs)
K4 := CompleteGraph(4)
IsPlanar(K4, 'F')

   Dear friends,on the left I created two Tasks named a and aa.However,I do not know how to delete these two Tasks.Then I refer to the help pages below.

The text I marked says I should enter full filename.I do not know the fullfile name of customized Tasks.So does anyone know how to delete them?

 

I am exploring the idea of porting some of my functions to Maple from Mathematica. But I just found a big problem in importing comma delimited data that contains a string within a string. This is not a problem being imported in Mathematica, but I need help to do same thing in Maple.

I tried ImportMatrix (as suggested in https://www.mapleprimes.com/questions/221509-How-To-Read-Lines-From-File-With-Quoted-Strings and also tried Import then convert and in both cases Maple does not read the full string in the field. I will show simple example

This file, called data.txt

1,2,3,"x+y, algorithm=["123"]","OK",5

It has 6 fields (since comma seperated.

But when importing it, Maple reads the 4th field above as "x+y, algorithm=[" and drops the rest 123"]"

Here is the code

#currentdir("C:\\bug"); #change as needed
data:=ImportMatrix("data.txt", source=csv);
print(data(4));
print(data(5));

This is the output

I also tried

data := Import("data.txt",format="CSV");
data := convert(data,Matrix):
print(data(4));
print(data(5));

Same output as above.

Compare the output in Mathematica. Using the same file as input. It automatically escapes the embedded strings and reads the full field OK

SetDirectory[NotebookDirectory[]];
data = First@Import["data.txt", "Table", "FieldSeparators" -> {","}, "Numeric" -> True]

               {1, 2, 3, "x+y, algorithm=[\"123\"]", "OK", 5}

data[[4]]

              "x+y, algorithm=[\"123\"]"

What would be the right way in Maple to import such files without losing part of the field?

The file has mixed strings and non strings, just like this example shows, and each file fields are seperated by comma, but I need to be able to read fields that can contain embedded strings in them automatically.

I am using Maple 2020. I think I might have to forget about import and try to do it using lower level code using scanf, or may be there is better method using Filetools package? but thought to check first if I am overlooking some option.

I depend alot on bracket matching to help me during writing code.

Maple suddenly losses bracket matching at some lines. I think it related to using strings with "\\" in them.

I make sure I have bracket matching on

 

I use worksheet mode (corrected), Maple 2020 under windows 10.

I made small video. Notice how the brackets do not match on the second line there.

Do you see how the brackets do not match on that second line there? This movie below shows what happens when I remove "\\string" from the line. Now bracket match starts to work again.

This is a serious problem for me. Any suggestions what to try to fix it and what can cause it?. Once bracket matching is lost, it is lost all the way to the rest of the code below the location where it started to lose first time.

restart;
if length(data_last(k,8))>300 then
   fprintf(file_id,"%s\n","\\footnotesize");
fi;

I think I have to find different editor to use and write the code to .mpl file since I have lots of such code and I need to have bracket matching working.

I am interested in trying to find the Kretschmann Scalar of certain metric, where the line element in given bellow as well as conditions on the indices. 

I am wondering if there is any possible way to compute the Riemann tensor components just using indices with the physics package or the tensor package. I have used them both before but for metrics which are explicitly defined. 

 

Thank you. 

 

 

Hello,

 

 

 

restart; with(Physics); Setup(mathematicalnotation = true); Setup(dimension = 3, metric = Euclidean, spacetimeindices = lowercaselatin); g_[]; Define(X[i], P[k]); Setup(quantumop = {P, X}, algebrarules = {%Commutator(P[i], P[j]) = 0, %Commutator(X[i], X[j]) = 0, %Commutator(X[j], P[k]) = Physics:-`*`(I, g_[j, k])}); L2 := Simplify(Physics:-`^`(Physics:-`*`(Physics:-`*`(LeviCivita[i, j, k], X[j]), P[k]), 2)); L2X := Simplify(Commutator(L2, X[k])); L2L2X__1 := Simplify(Commutator(L2, L2X)); L2L2X__2 := Simplify(Expand(AntiCommutator(Physics:-`*`(2, L2), X[k]))); Simplify(L2L2X__1-L2L2X__2)

[mathematicalnotation = true]

 

`The dimension and signature of the tensor space are set to `[3, `- - +`]

 

`The Euclidean metric in cartesian coordinates`

 

`Changing the signature of the tensor spacetime to: `*`+ + +`

 

[dimension = 3, metric = {(1, 1) = 1, (2, 2) = 1, (3, 3) = 1}, spacetimeindices = lowercaselatin]

 

Physics:-g_[a, b] = Matrix(%id = 18446746397905475934)

 

`Defined objects with tensor properties`

 

{Physics:-Dgamma[a], P[k], Physics:-Psigma[a], X[i], Physics:-d_[a], Physics:-g_[a, b], Physics:-LeviCivita[a, b, c]}

 

`* Partial match of  '`*quantumop*`' against keyword '`*quantumoperators*`' `

 

_______________________________________________________

 

[algebrarules = {%Commutator(P[i], P[j]) = 0, %Commutator(X[i], X[j]) = 0, %Commutator(X[j], P[k]) = I*Physics:-g_[j, k]}, quantumoperators = {P, X}]

 

(2*I)*Physics:-`*`(X[j], P[j])+Physics:-`*`(Physics:-`^`(X[j], 2), Physics:-`^`(P[k], 2))-Physics:-`*`(X[j], X[k], P[j], P[k])

 

2*X[k]-(2*I)*Physics:-`*`(Physics:-`^`(X[b], 2), P[k])+(2*I)*Physics:-`*`(X[c], X[k], P[c])

 

(12*I)*Physics:-`*`(X[c], X[k], P[c])-(4*I)*Physics:-`*`(Physics:-`^`(X[b], 2), P[k])+4*X[k]+4*Physics:-`*`(Physics:-`^`(X[b], 2), X[k], Physics:-`^`(P[h], 2))-4*Physics:-`*`(X[a], Physics:-`^`(X[b], 2), P[a], P[k])+4*Physics:-`*`(Physics:-`^`(X[b], 2), X[f], P[f], P[k])-4*Physics:-`*`(X[f], X[i], X[k], P[f], P[i])

 

4*X[k]+(12*I)*Physics:-`*`(X[c], X[k], P[c])+4*Physics:-`*`(Physics:-`^`(X[b], 2), X[k], Physics:-`^`(P[d], 2))-(4*I)*Physics:-`*`(Physics:-`^`(X[b], 2), P[k])-4*Physics:-`*`(X[e], X[f], X[k], P[e], P[f])

 

0

(1)

NULL

 

 

 

 

Download Commutator_Algebra_with_L2.mw

 

 

 

I have the following issue.

The way it is set at the moment, works kinda in that the final result is 0, which I tried to check.

However, the expression L2L2X[1] is not fully Simplified, since the term

-(4*X[a])*X[b]^2*P[a]*P[k] + (4*X[b]^2)*X[f]*P[f]*P[k]

is actually zero. I suppose that he doesn't manage because of the different indices "a" and "f" here. How can this be fixed?

 

When I comment out "Define" and use "Coordinates(X,P)" instead, it doesn't work. Seems to give the wrong result (Difference is not zero).

 

Hey,

I'm trying to differentiate a function but whenever I do so, it adds new variables for some reason. I think I might be able to copy the new function and just delete the extra but it is not a good solution.

 

So I'm hoping someone could help me to figure out how to remove all this extra that Maple adds to my equation. Thanks in advance.

 

If I have v = 2400000 m/s as a a result. 

 

How do I convert this with units to 2.4*10 m/s in maple. 

Any idea on howto do this?

 

Best Regards. 

Using mode with axis we can choose linear or log.  But what if we want some other custom scaled axis?

Seems if we want a y^3 y-axis, we'll have to cube root the data then use plottools to form our own scale.  Unless there's some other way I don't know. 

f:= 2*x^5-x^3*y+2*x^2*y^2-x*y^3+2*y^5;

This is symetrical in x and y.  subs(x=1,f) and  subs(y=1,f) are identical in form.

for idx to 10 do
    lim:=1/idx:
    plots[implicitplot](f,x=-lim..lim,y=-lim..lim,numpoints=1000000);
end do;

This shows a curve to (0,0) in quadrant 2, rabit ears in quadrant 1, and a curve from (0,0) in quadrant 4.

Plotting this with python matplotlib shows values in quadrant 3.  I assume that matplotlib plots only the real zeros of the polynomial.  Looks like it, the plotted values match the real zeros in maple.

use RealDomain in
    for idx from -1/100 to 1/100 by 1/1000 do
        lprint(idx,evalf(solve(subs(x=idx,f)=0)));
    end do;
end use;

This shows no values in quadrant 3.

How do I show/prove no zeros in quadrant 3?

First 450 451 452 453 454 455 456 Last Page 452 of 2097