MaplePrimes Questions

I am trying to give an input to an R program from an output the edge set of maple code 

Now how to Build a function which takes a list of edge sets as inputs and returns a list on the below format

Show I want for one edge set of the list

Now I have edge set of a Graph G say {{1,2},{2,3},{3,4},{4,5}}

Now want to pick the first values of each index make one set 

from<-c(1,2,3,4)

Similiarly first values of each index make one more set 

to<-c(2,3,4,5)

Then I want to form a list [from<-c(1,2,3,4),to<-c(2,3,4,5),ft <- cbind(from, to),Graph1<-ftM2graphNEL(ft)]

Now it will take second graph in the Edge list say {{1, 2}, {1, 7}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}}

It will append to the previous list like

[from<-c(1,2,3,4),to<-c(2,3,4,5),ft <- cbind(from, to),Graph1<-ftM2graphNEL(ft),from<-c(1,1,2,3,4,5,6),to<-c(2,7,3,4,5,6,7),ft <- cbind(from, to),Graph2<-ftM2graphNEL(ft)]

This time Graph1 is changed to Graph2 to be observed.

Like that it will need  increase graph number based on the number of edge sets in the list of edges.

To be done all edge sets in list

As then I can copy the entire contents in the list and paste in R so that i can run 

As I can have 100 or more graphs done in maple doing for each of them manually typing may be difficult.

Kind help please

Your help will be surely Acknowledged 

Kind help

A toy code i simply tried for graph attached

But I have errors some come with double quotes can something be done if possible please guide

Kind help

As with 100 of lines it will easy to copy paste 

If the contents of the list can be written to txt file it would be helful 

please help

toy_try.mw

I have tried something to my knoewledge please help

Someone added "Duplicate question" tag on this question.

How is this duplicate question? Where is the duplicate question? 

Is this a bug?

Accoding to this help page 

A derived class must not redeclare (via a local or export declaration) any members inherited from the base class

this example does not do this. But derived class gets an error when using ::static on a method declared in base class and this only shows up when using kernelopts('assertlevel'=2):

So it is either kernelopts('assertlevel'=2): is wrong or help is wrong.  Here is example

972100

restart;

972100

interface(version);

`Standard Worksheet Interface, Maple 2023.0, Windows 10, March 6 2023 Build ID 1689885`

interface(warnlevel=4);
kernelopts('assertlevel'=2):

3

module bank_account()
  option object;
  local account_id::integer:=0;
  
  export ModuleCopy::static:=proc(_self, proto::bank_account, account_id::integer,$)
         if nargs=2 then
            _self:-account_id := proto:-account_id;
         else
            _self:-account_id := account_id;
         fi;
  end proc;
end module;

module bank_account () local account_id::integer; option object; end module

module saving_account()
  option object(bank_account);

  ModuleCopy::static := proc(_self, proto::saving_account, account_id::integer,$)
         if nargs=2 then
            _self:-account_id := proto:-account_id;
         else
            _self:-account_id := account_id;
         fi;
  end proc;
end module;

Error, (in saving_account) type `static` does not exist

 


Download static_error.mw

Removing the line kernelopts('assertlevel'=2): the error goes away. Also keeping kernelopts('assertlevel'=2): but removing the ::static from the derived class the error goes way.

What is going on?

Maple 2023 on windows 10.

Does anyone know how to remove this boring notation? I would like to know why Maple does not give me "± 2x". Thanks in advance.

 

I am trying to define a Tensor expression in the physics package but it seems to be taking eons to do so, it has been running for quite some time but still no result to the point where I halt the computation. 

Does anyone have any ideas on how I could accelerate the process? 

I have attached the file I am working with. 

Define.mw

If in a .mw file I have a Document Block with about 10 statements in it, what is a way to split it into two blocks that execute seperately? Currently, hitting enter all statements execute.

("Document Block" is the term that shows up when I hover to the left of the text of interest.)

(I know I can cut and paste the last five statements into a new document block, but it seem that there may be an easier way.)

Thanks and Cheers in advance . . .

There appears to be a bug in Maple 2023.0 (Build ID 1689885)  that does not allow you to access submenus when the window is maximized.  For example, trying to select "Insert --> Execution Group" does not work, nor does any other submenu (the submenu will not display and is not accessible).  The only workaround is to un-maximize the window, select the submenu (for example "Insert --> Execution Group --> Before Cursor"), and then re-maximize the window.  Everything works as it should as long as the window is not maximized.  This is on Microsoft Windows 11 with a 2160p monitor.  Any suggestions on how to fix this are appreciated.

I dont know if this is a well formulated question but if I had a set of PDES that have a constant appearing in them (say alpha), would there be a way to solve for the PDE such that the right had side is not zero but just has higher order order terms (say alpha^3 and higher).

For example consider (the random set of equations)
 

eq1 := alpha*diff(f(t, r), r,r) + diff(g(t, r), t) + alpha*g(t, r) = 0;
           

eq2 := alpha*diff(g(t, r), r) + diff(f(t, r), t,t) + f(t, r) = 0;

Is there a way to solve for the system of pde such that the right hand side is only terms of order alpha^3 and higher?
 

Example

diff(w(x), x, x) = F*((6*(-a^2/(2*L^2)+a^3/(3*L^3)))*x+2*a^2/L-a^3/L^2)/EI

diff(diff(w(x), x), x) = F*(6*(-(1/2)*a^2/L^2+(1/3)*a^3/L^3)*x+2*a^2/L-a^3/L^2)/EI

(1)

Eval(lhs(diff(diff(w(x), x), x) = F*(6*(-(1/2)*a^2/L^2+(1/3)*a^3/L^3)*x+2*a^2/L-a^3/L^2)/EI), x = L) = (`@`(simplify, eval))(rhs(diff(diff(w(x), x), x) = F*(6*(-(1/2)*a^2/L^2+(1/3)*a^3/L^3)*x+2*a^2/L-a^3/L^2)/EI), x = L)

Eval(diff(diff(w(x), x), x), x = L) = -F*a^2*(L-a)/(L^2*EI)

(2)

Can the expression above be further shortened by function composition and function application (to a single group of arguments)? I tried

(`@`(Eval, lhs) = `@`(`@`(simplify, eval), rhs))(diff(diff(w(x), x), x) = F*(6*(-(1/2)*a^2/L^2+(1/3)*a^3/L^3)*x+2*a^2/L-a^3/L^2)/EI, x = L)

Error, (in evalapply) invalid input: lhs expects 1 argument, but received 2

 

which does not work.
Since the error message is clear I am looking for a single argument command that could replace lhs and rhs.  

Analog to evalf, which accepts an index, I tried to replace lhs by

op[1](diff(diff(w(x), x), x) = F*(6*(-(1/2)*a^2/L^2+(1/3)*a^3/L^3)*x+2*a^2/L-a^3/L^2)/EI)

diff(diff(w(x), x), x), F*(6*(-(1/2)*a^2/L^2+(1/3)*a^3/L^3)*x+2*a^2/L-a^3/L^2)/EI

(3)

to do the same as

op(1, diff(diff(w(x), x), x) = F*(6*(-(1/2)*a^2/L^2+(1/3)*a^3/L^3)*x+2*a^2/L-a^3/L^2)/EI)

diff(diff(w(x), x), x)

(4)

Unfortuenatly this does not work. Are there any other options or have I reached an end point?

Would a single argument variant of op make sense for other purposes than the example above?


Download replacement_of_lhs_and_rhs_by_single_argument_function.mw

I have been using the RaiseLowerIndices to go from covectors to contravariant vectors.

RaiseLowerIndices(Contravariant_form_of _metric, One_Form, [1])

The above gives me the right answer.
But the following also gives me an answer which is different. I just dont know what it is calculating.

RaiseLowerIndices(Contravariant_form_of _metric, One_Form, [1,1]).

Could someone tell me what it is calculating?

将枫叶文档传输到手机后如何打印?

Dear all

Can I compute using maple intersection between discrete sets

intersection_sets.mw

thank you for your help 

I compute some properties of some graphs and try to store their edge sets and their corresponding properties. I stored them using matrices, but now I want to export them to a file (csv format).

with(GraphTheory):
graphs := [seq(RandomGraphs:-RandomGraph(8, 9), 1 .. 10)]:
M0:=Edges~(graphs):
M1:=Girth~(graphs):
M2:=Diameter~(graphs):
B := Matrix(1..3,[M0,M1,M2]);
Export("E:/B.csv", B):

 

he exported file's data is messy, and it is difficult for me to observe the corresponding properties of the graphs.  I hope they can be sorted into three columns as shown below.

PS: I know that if the data has only one column, it can be done as discussed earlier

Export("E:/M.csv", M):

To make the data appear clearer, it is best to keep suitable spacing between columns.

multi_dimensional_data.mw

When making a module with option object, help says 

To create a new class of objects, use the named module declaration syntax with option object.

and it gives an example.  But what is the difference from using the standard module syntax?

This seems to work the same but may be there are cases where it makes a difference?  Here is an example. second case below is what help says to use. But first case is the original module syntax. Both work the same in this simple example.

Can one use either syntax, or is there any subtle difference in semantics that will show under more complicated setup?

interface(version);

`Standard Worksheet Interface, Maple 2023.0, Windows 10, March 6 2023 Build ID 1689885`

restart;

1421372

person_class:=module()
  option object;
  export foo::static:=proc(_self,$)
    print("in foo");
    NULL;
  end proc;
end module;

o:=Object(person_class);
o:-foo();

_m2325067887584

_m2325067872032

"in foo"

restart;

1421372

module person_class()
  option object;
  export foo::static:=proc(_self,$)
    print("in foo");
    NULL;
  end proc;
end module;
o:=Object(person_class);
o:-foo();

module person_class () option object; end module

module person_class () option object; end module

"in foo"

 


Download syntax_of_OOP_module.mw

Hello,

is there a limit to the matrix size on which the Determinant(A) can operate? I am working on a project that generates a 22x22 matrix of coefficients of unknowns, which I built out of the GenerateMatrix() function.  If I use subs(omega=1, AA), the determinant is calculated. Still, I want the determinant in terms of omega so I can solve for Determinant(A)=0 in order to find the natural frequencies and then find my unknown coefficients.

When I use the Determinant function on my symbolic matrix is always returns 0. I know from using smaller matrices that it can do symbolic determinants. If there is a better way to do what I am trying to do, please let me know!

Thanks!

Is it possible to use the ~ when using Matrix multiplications, where the second part of the operand are list elements?

The first part of the matrix multiplication remains unchanged, while the second one should be each element of the list.

The result should be a list of vectors / matrices again.

with(Units:-Simple)

alpha := 20*Unit('arcdeg')

20*Units:-Unit(arcdeg)

(1)

TransMatrix := Matrix([[cos(alpha), sin(alpha)], [-sin(alpha), cos(alpha)]])

Matrix(%id = 36893490153509525972)

(2)

pt := Vector(2, {(1) = -25.0, (2) = 0.})

Vector[column](%id = 36893490153504789076)

(3)

ptlist := [Vector(2, {(1) = -25.0, (2) = 0.}), Vector(2, {(1) = 25.0, (2) = 0.})]

[Vector[column](%id = 36893490153504761724), Vector[column](%id = 36893490153504761844)]

(4)

pt_trans := evalf(TransMatrix.pt)

Vector[column](%id = 36893490153514236012)

(5)

pl_translist := evalf(TransMatrix.ptlist)

Matrix(%id = 36893490153509525972).[Vector[column](%id = 36893490153504761724), Vector[column](%id = 36893490153504761844)]

(6)

TransMatrix.ptlist

Error, number of dimensions must be the same for all container objects in an elementwise operation

 

NULL

Download MatrixMultiplicate.mw

First 205 206 207 208 209 210 211 Last Page 207 of 2427