JamesK

15 Reputation

5 Badges

9 years, 275 days

MaplePrimes Activity


These are replies submitted by JamesK

@CarlLove Also can I extent your scheme to abbreviate the vertex labels in such a way what integrals and diff equations are also processed?

@Carl Love Yes you are right.Silly me
Once I remove the output from the file when I try to generate the graph I get this
G:= FunctionToTree(Func, Labels= Abbrs, Prefix= 7);
Error, (in ModuleApply) module does not export `Prefix`


@Carl Love Yes you are right.Silly me
Once I remove the output from the file when I try to generate the graph I get this
G:= FunctionToTree(Func, Labels= Abbrs, Prefix= 7);
Error, (in ModuleApply) module does not export `Prefix`


@Carl Love I wanted to see how the code works so I started on a new file but apparently I cannot generate a graph because of the above error.

@Carl Love I wanted to see how the code works so I started on a new file but apparently I cannot generate a graph because of the above error.

@Carl Love
FunctionToTree := module ()
local Vertices::table, VertexLabels::table, Vertex_index::nonnegint, Edges::table, Edge_index::nonnegint, AddEdge, AddVertex, AddSubTree, Prefix::nonnegint, Labels::table, StripName, ShortenLabels, ModuleInits, ModuleApply; export VertexMap::table;
end module:

Func:= ToInert(x+2*y*z^2);
     _Inert_SUM(_Inert_NAME("x"), _Inert_PROD(_Inert_PROD(  _Inert_NAME("y"),   _Inert_POWER(_Inert_NAME("z"), _Inert_INTPOS(2))),  _Inert_INTPOS(2)))

Abbrs:= table(["SUM"= `+`, "PROD"= `*`, "INTPOS"= ``, "NAME"= ``, "POWER"= `^`]):
G:= FunctionToTree(Func, Labels= Abbrs, Prefix= 7);
ModuleApply(_Inert_SUM(_Inert_NAME("x"), _Inert_PROD(_Inert_PROD( _Inert_NAME("y"),   _Inert_POWER(_Inert_NAME("z"), _Inert_INTPOS(2))),  _Inert_INTPOS(2))), Labels = Abbrs, Prefix = 7)  _Inert_POWER(_Inert_NAME("z"), _Inert_INTPOS(2))),
  _Inert_INTPOS(2))), Labels = Abbrs, Prefix = 7)

GraphTheory:-DrawNetwork(G);

   

@Carl Love
FunctionToTree := module ()
local Vertices::table, VertexLabels::table, Vertex_index::nonnegint, Edges::table, Edge_index::nonnegint, AddEdge, AddVertex, AddSubTree, Prefix::nonnegint, Labels::table, StripName, ShortenLabels, ModuleInits, ModuleApply; export VertexMap::table;
end module:

Func:= ToInert(x+2*y*z^2);
     _Inert_SUM(_Inert_NAME("x"), _Inert_PROD(_Inert_PROD(  _Inert_NAME("y"),   _Inert_POWER(_Inert_NAME("z"), _Inert_INTPOS(2))),  _Inert_INTPOS(2)))

Abbrs:= table(["SUM"= `+`, "PROD"= `*`, "INTPOS"= ``, "NAME"= ``, "POWER"= `^`]):
G:= FunctionToTree(Func, Labels= Abbrs, Prefix= 7);
ModuleApply(_Inert_SUM(_Inert_NAME("x"), _Inert_PROD(_Inert_PROD( _Inert_NAME("y"),   _Inert_POWER(_Inert_NAME("z"), _Inert_INTPOS(2))),  _Inert_INTPOS(2))), Labels = Abbrs, Prefix = 7)  _Inert_POWER(_Inert_NAME("z"), _Inert_INTPOS(2))),
  _Inert_INTPOS(2))), Labels = Abbrs, Prefix = 7)

GraphTheory:-DrawNetwork(G);

   

First,thank you very much for your assitance.
When I tried to see how the functions work and generate a graph I get this error
"Error, invalid input: GraphTheory:-DrawNetwork expects its 1st argument, G, to be of type GRAPHLN, but received ModuleApply(_Inert_SUM(_Inert_NAME("x"), _Inert_PROD(_Inert_PROD(_Inert_NAME("y"), _Inert_POWER(_Inert_NAME("z"), _Inert_INTPOS(2))), _Inert_INTPOS(2))), Labels = Abbrs, Prefix = 7)"

First,thank you very much for your assitance.
When I tried to see how the functions work and generate a graph I get this error
"Error, invalid input: GraphTheory:-DrawNetwork expects its 1st argument, G, to be of type GRAPHLN, but received ModuleApply(_Inert_SUM(_Inert_NAME("x"), _Inert_PROD(_Inert_PROD(_Inert_NAME("y"), _Inert_POWER(_Inert_NAME("z"), _Inert_INTPOS(2))), _Inert_INTPOS(2))), Labels = Abbrs, Prefix = 7)"

I've looked in the Graph Theory package but I can't see any function that will help to convert the output of ToInert to a graph/tree and preserve the relationships between the operands in order to use the DrawNetwork command.I've tried again using 'op' on the output created by ToInert but that didn't work.Any suggestions?

I've looked in the Graph Theory package but I can't see any function that will help to convert the output of ToInert to a graph/tree and preserve the relationships between the operands in order to use the DrawNetwork command.I've tried again using 'op' on the output created by ToInert but that didn't work.Any suggestions?

I didn't see your final answer....ok I will try that.

I didn't see your final answer....ok I will try that.

Thank you for the reply but I'm looking to take an expression in my procedure and output an informative representation of it as a graph, using the GraphTheory package.The trees were just examples on how the graph should look like.
I've read the documentation on both functions right now I'm trying to figure it out how to implement them in my procedure.

Thank you for the reply but I'm looking to take an expression in my procedure and output an informative representation of it as a graph, using the GraphTheory package.The trees were just examples on how the graph should look like.
I've read the documentation on both functions right now I'm trying to figure it out how to implement them in my procedure.

1 2 Page 2 of 2