MaplePrimes Questions

In a video (watch from 7 min onwards) I have seen the definition of solution types in custom components. Is this possible in newer versions of MapleSim using the custom component app? If yes, how?

The Dates are not ordered in a timeseries. The Dates are random variables coming from a dataFrame

How can I write a formula for odd numbers?
Such that :
Show each odd number from the sum of two numbers: even + odd, except for one

The IsSubgraphIsomorphic command accepts either two undirected graphs or two directed graphs as input.  It returns true if G1 is isomorphic to some subgraph of G2. The GraphTheory [IsSubgraphIsomorphic] command was introduced in Maple 2021.

If a graph T is isomorphic to some subgraph T' of  a graph GIsSubgraphIsomorphic(T,G)  will  return true. But there is no option to return T'. That makes it hard to check manually.

I've seen  IsSubgraphIsomorphic behaving strangely lately. I want to check whether K8-P6 contains K7-K3 as its subgraph.

T:=DeleteEdge(CompleteGraph(7),{{1,2},{2,3},{3,1}},inplace= false): 
G:=DeleteEdge(CompleteGraph(8),{{1,2},{2,3},{3,4},{4,5},{5,6}},inplace= false): 


I think theoretically, the result of IsSubgraphIsomorphic is not correct. I also tested it from Mathematica, and it worked as I expected.

h = EdgeDelete[ CompleteGraph[7], {1 <-> 2, 2 <-> 3, 3 <-> 1}]; 
g = EdgeDelete[ CompleteGraph[8], {1 <-> 2, 2 <-> 3, 3 <-> 4, 4 <-> 5, 5 <-> 6}]; 
IsomorphicSubgraphQ[h, g]


I wonder what went wrong.


PS: Subgraph isomorphism is a question I've asked before, and we can refer to the following links and code.

T:=DeleteEdge(CompleteGraph(7),{{1,2},{2,3},{3,1}},inplace= false): 
nE,nV := NumberOfEdges(T), NumberOfVertices(T):
# Produce all subgraphs of G which have the same number of edges and vertices as the "test" sub-graph T
U:=choose(Edges(G),nE): nops(%):
U1:=select(t -> (nops(`union`(t[]))=nV), U): nops(%):
gL:= Graph~(U1): nops(%):
ans:= [ seq
          ( `if`
            ( IsIsomorphic( T, gL[j] ),
if   numelems(ans)>0
then HighlightSubgraph( G, gL[ans[1]], edgestylesheet=[thickness=4, color="Red"]);
     DrawGraph(G, style=spring);

These codes are due to tomleslie  and  vv. According to above codes, it seems that there is something wrong with IsSubgraphIsomorphic too.

I capture the output of dsolve after setting infolevel to some file so I can later read that output and put it in my own document (Latex).

Currently what I do is set infolevel, then use writeto(file_name) to send all the output that would normally go to standard output to the text file, then later do readline to read it back for further processing.

The problem is that Maple does not put the output in the file the same way as it appears on the screen when using worksheet.

For example, all newlines are lost. So everything comes out in one line in the file_name .  I am not sure why that is.

Is there an option or trick to make the output not lose the newlines? It also seems to format things differently in the file. An example will make this clear

When running this code

currentdir("... set the directory to where you want to save the file to ..");

writeto("output_of_dsolve.txt");  #send all output to file
writeto(terminal); #to send output back to terminal

When I open the file output_of_dsolve.txt this is what shows

`Methods for first order ODEs:``--- Trying classification methods ---``trying a quadrature``<- quadrature successful`     solAssignyApplyFunction(x)equalsuminus0cosApplyFunction(x) + _C1, [

       Typesetting:-mprintslash([sol := y(x) = -cos(x) + _C1], 

       [y(x) = -cos(x) + _C1])]


But in the worksheet, when I run the same code without writeto("output_of_dsolve.txt");  so output goes to terminal as normal, here it is how it looks like

Is there a way to keep the newlines? And why there is some extra stuff in the file that do not show on the screen? Should one change the Settings for Display before doing the above? Currently the default I have is typesetting level is "Extended". Do not know if this affects it or not.

Is the above method the only way to capture the output of dsolve from infolevel to a text file? It looks like Maple uses `` in the file in place where there should be a newline (CR) inserted.


I did this experiment but there is still some strange formatting coming out in the file. Here is an example



interface(typesetting=standard): #added this
interface(prettyprint=0):  #added this


And now the text file has this

`Methods for first order ODEs:``--- Trying classification methods ---``trying a quadrature``<- quadrature successful`Typesetting:-mprintslash([(sol := y(x) = -cos(x)+_C1)],[y(x) = -cos(x)+_C1])

What is Typesetting:-mprintslash at the end of the line above? it is duplicate.

And how to get rid of it? Is there another settings to set other than interface(typesetting=standard): and interface(prettyprint=0): ?

I have a set of points. I only want to plot ones with x and y less that 5 units from [0,0]. I can do it with for do loop. Can't get it to work with seq. Ideally I don't want to create another list.



points := [[-.4821957161, -.3251957485], [-1.079859775, -1.473869954], [.7429089919, .1649759550], [1.329939269, 0.7259335832e-1], [-.1254930617, .1268183497], [-10.63408888, -2.637665397], [-0.1855663689e-1, .1572001339], [8.963609684, 7.419424024], [.7724026996, .1662719092], [1.278337644, 0.7583092624e-1]]


" points2:= [seq('if'(" abs"(points[i,1])<5 and abs(points[i,2])<5, points[i] ,0)  ,i=1..10)] "

[[-.4821957161, -.3251957485], [-1.079859775, -1.473869954], [.7429089919, .1649759550], [1.329939269, 0.7259335832e-1], [-.1254930617, .1268183497], [-10.63408888, -2.637665397], [-0.1855663689e-1, .1572001339], `if`(false, [8.963609684, 7.419424024]), [.7724026996, .1662719092], [1.278337644, 0.7583092624e-1]]



redp := plots:-pointplot(points, colour = red, symbolsize = 4, symbol = solidcircle)


plots:-pointplot(points2, colour = red, symbolsize = 4, symbol = solidcircle)

Error, invalid input: `if` expects 3 arguments, but received 2





The Multivariate Calculus lagrange multipliers function acts weird if I try  to compute something with infinite Extrema like sin(x)+sin(y) with the constraint being a straight line like 1-x-y=0
The output is something like
[1 + arctan((cos(1) - 1)/sin(1)) - Pi*_Z7, -arctan((cos(1) - 1)/sin(1)) + Pi*_Z7]

and trying to output a plot fails outright. 

My questions are:

1) What exactly is this z7 in the output? 

2) is there a way to get Lagrange multipliers to output concrete values for some of the infinite points, like for example, all points with -2<x<2?

3) If 2) is not possible, how could I calculate the points manually?

I tried to simplify this equation:

where Ts,Cf,Rf,Lg & L are Variables to equivelent equation in the form of:

                                                         (.....)Z3+(....)Z2+(.....)Z+(.........)      /   (.....)Z3+(....)Z2+(.....)Z+(.........)

Hello, everyone. I encountered one question on simplification.

I don't know how to plug the conditions

x1^2+y1^2=r^2, x2^2+y2^2=r^2,x3^2+y3^2=r^2,x4^2+y4^2=r^2

and further simplify the formula

4*x1*x2^2*x3 - 4*x1*x2*x3*x4 + 4*x1*x3*y2^2 - 4*x1*x3*y2*y4 - 4*x2^2*x3^2 - 4*x2^2*y2^2 + 4*x2^2*y2*y4 + 4*x2*x3^2*x4 + 4*x2*x4*y2^2 - 4*x2*x4*y2*y4 - 4*x3^2*y2^2 + 4*x3^2*y2*y4 - 4*y2^4 + 8*y2^3*y4 - 4*y2^2*y4^2.

Thank you very much!

I would like to use a python open source package available on internet via pip install in maple on my maple code

Package name mathchem

Link of the package mathchem · PyPI

Any advice how to

When using the Statistics package to declare a variable, let's say A,  as random, this variable is associated (assigned?) to a variable of name _R or _Rn with n a non-negative integer.
Subsequently, each expression you construct that contains the name A is displayed in a form where A has been replaced by its "alias" name _Rn.
Here is an example

A := RandomVariable(Uniform(0, 1)):
B := RandomVariable(Uniform(0, 2)):
C := RandomVariable(Uniform(1, 2)):
F :=  (A+2*B)/C
                          _R + 2 _R0

Is it possible,  to display F under its original form?
Is it possible to recover that _R is in fact A, that _R0 is in fact B and so on?

y := x+k;
plot([seq(y, k = 1 .. 4)]);

Can we plot for decimal values of k, i.e., for k=1.1, 1.2, 1.3? How can we give scale for k?



"#(1+c1)f^(' ' ' ')-c1*g^(' ' )-Re(f^*f^(' ' ')-f'*f^(' '))-n0*(1+c1)f^(' ' )-m0*f^(' ' )=0"

#c2"*g^(' ')+c1(f^(' ')-2 g)-c3*Re(f*g'-f'*g)=0"



#boundary condition

f=-1, f^'=0, g=0, a=1, b=1   at  η=-1    

f=1, f^'=0, g=0, a=0, b=0   at  η=-1


PDEtools[declare](f(t), prime = t)

` f`(t)*`will now be displayed as`*f


`derivatives with respect to`*t*`of functions of one variable will now be displayed with '`


N := 15




proc (t) options operator, arrow, function_assign; sum((diff(p(x), [`$`(x, i)]))*f[i]*t, i = 0 .. N) end proc


"de1:=(1-p)*((1+c1)*diff(f(t), t $ 4) -n0*(1+c1)*diff(f(t), t $ 2)  -m0*diff(f(t), t $ 2)))+p(((1+c1)*diff(f(t), t $ 4)-c1*diff(g(t), t $ 2)-Re(f(t)*diff(f(t), t $ 3)-diff(f(t), t $ 1)*diff(f(t), t  2)) -n0 *(1+c1)*diff(f(t), t $ 2)  -m0*diff(f(t), t $ 2) )"

"de2=(1-p)*(c2 *diff(g(t), t $ 2)+c1*(diff(f(t), t $ 2)-2*g(t))))+p*(c2 *diff(g(t), t $ 2)+c1*(diff(f(t), t $ 2)-2*g(t))-c3*Re(f(t)*diff(g(t), t $ 1)-diff(f(t), t $ 1)*g(t))));"

de3 = (1-p)*(diff(a(t), `$`(t, 2))+D*(diff(b(t), `$`(t, 2))))+p*(diff(a(t), `$`(t, 2))+D*(diff(b(t), `$`(t, 2)))+Ph*(diff(f(t), `$`(t, 1)))*a(t)-ph*f(t)*(diff(a(t), `$`(t, 1))))

de4 = (1-p)*(diff(a(t), `$`(t, 2))+D*(diff(b(t), `$`(t, 2))))+p*(diff(b(t), `$`(t, 2))+S*(diff(a(t), `$`(t, 2)))+Pm*(diff(f(t), `$`(t, 1)))*b(t)-ph*f(t)*(diff(b(t), `$`(t, 1))))

sys1 := eval([de1, de2, de3, de4], p = 1)

[de1, de2, de3, de4]



Error, (in dsolve) required an indication of the solving variables for the given system


n := 4



f := unapply(add(g[k](t)*p^k, k = 0 .. n), t)

proc (t) options operator, arrow; g[0](t)+g[1](t)*p+g[2](t)*p^2+g[3](t)*p^3+g[4](t)*p^4 end proc


g := unapply(add(h[k](t)*p^k, k = 0 .. n), t)

proc (t) options operator, arrow; h[0](t)+h[1](t)*p+h[2](t)*p^2+h[3](t)*p^3+h[4](t)*p^4 end proc


a := unapply(add(i[k](t)*p^k, k = 0 .. n), t)

proc (t) options operator, arrow; i[0](t)+i[1](t)*p+i[2](t)*p^2+i[3](t)*p^3+i[4](t)*p^4 end proc


b := unapply(add(j[k](t)*p^k, k = 0 .. n), t)

proc (t) options operator, arrow; j[0](t)+j[1](t)*p+j[2](t)*p^2+j[3](t)*p^3+j[4](t)*p^4 end proc



cond[1][0] := f[0](-1) = -1, (D(f[0]))(-1) = 0, f[0](1) = 1, (D(f[0]))(1) = 0; g[0](-1) = 0, g[0](1) = 0, a[0](-1) = 1, a[0](1) = 1, b[0](-1) = 1, b[0](1) = 0

Error, (in anonymous procedure) invalid input: diff received -1, which is not valid for its 2nd argument


h[0](-1)+h[1](-1)*p+h[2](-1)*p^2+h[3](-1)*p^3+h[4](-1)*p^4 = 0, h[0](1)+h[1](1)*p+h[2](1)*p^2+h[3](1)*p^3+h[4](1)*p^4 = 0, i[0](-1)+i[1](-1)*p+i[2](-1)*p^2+i[3](-1)*p^3+i[4](-1)*p^4 = 1, i[0](1)+i[1](1)*p+i[2](1)*p^2+i[3](1)*p^3+i[4](1)*p^4 = 1, j[0](-1)+j[1](-1)*p+j[2](-1)*p^2+j[3](-1)*p^3+j[4](-1)*p^4 = 1, j[0](1)+j[1](1)*p+j[2](1)*p^2+j[3](1)*p^3+j[4](1)*p^4 = 0


m0 := 12; n0 := 10; ph := .1; pm := .1; c1 := 1.2; c2 := .8; c3 := .6; D := 0.3e-1; S := 2.0; Re := 1



I  had to deal with a long number x =  521...773 that i wanted to break up into 3 digit segments. I converted x to a string and got y="521...773". Then I used String Tools to LengthSplit y and got a sequence z="521", ..."773". So far so good. Next I tried to extract the 3 digit segments and tried
convert(z[1],integer) but that led to

Error, (in anonymous procedure called from depends) too many levels of recursion

Very mysterious. The command convert("521",name)  gave me the symbol 521, not the number.
I eventually stumbled across parse("521") and that gave me what I wanted,namely the integer 521. I looked at the Help page for parse but decided I did not want to delve into that bit of arcane knowledge.

I also tried several times to write little procedures to strip off the double quotes but was unsuccessful.

I am sure there is a more obvious way to go about this. Any suggestions?


I just want to put the integration constands to zero manually, but it does not seem to work. How can I do this?

Thank you in advance!

First 74 75 76 77 78 79 80 Last Page 76 of 2173