MaplePrimes Questions

Even though this question is related to this one 
https://www.mapleprimes.com/questions/234781-How-Can-I-Get-The-Desired-Answer-From-solve
feel it is about a different issue. If any of you feel otherwise feel free to move it to the original one.

In this notional example  the name _Z1~ is created by RootOf: and here is an ad hoc way to catch it.

restart:

f := RootOf(cos(x)-z, x):
u := indets(f, name);
s := series(f, z):
v := remove(type, indets(s, name), constant);
w := v minus u

{z}

 

{_Z1, z}

 

{_Z1}

(1)

 

Download Example_1.mw

In this more complex example an assumption must be made on M to obtain ths desired solution g and the previous method no longer works.

restart

f := 10*cos((-1+t)/sqrt(1+M))-10*cos(t/sqrt(1+M)):
assume(M::nonnegative):
u := indets(f, name);
g := solve({diff(f, t), t>0 }, t, allsolutions)[1][1];
v := remove(type, indets(rhs(g), name), constant);
w := v minus u

{M, t}

 

t = Pi*_Z2*(1+M)^(1/2)-arctan((cos(1/(1+M)^(1/2))+1)/sin(1/(1+M)^(1/2)))*(1+M)^(1/2)

 

{M, _Z2}

 

{M, _Z2}

(1)

 

Download Example_2.mw

I have tried using select to "capture" the name _Z2~ but I can't know how to distinguish M~ from _Z2~ (is there a type which could be used?).

Can you helpm fix this?
TIA

Is there an assumption or some other way I can tell Maple to avoid such errors when using odetest, as I get many of them.

I think the solution Maple gives is correct. But odetest generates these strange innternal error that it does not know the sign of a complex number.

restart;
ode:=x^2*diff(y(x), x$2) + (cos(x)-1)*diff(y(x), x) + exp(x)*y(x) = 0;
sol:=dsolve(ode,y(x),series):
odetest(sol,ode,series,point=0);

Error, (in odetest/series) need to determine the sign of I*3^(1/2)

I've seen such error many times before and it is still not fixed in release after release.

I am using Maple 2022.1 on windows 10.

To make the "Simple External Code Function" example of the tutorial work, an external complier is required.

in MapleSim:-CreateDataRecord) invalid input: dsolve/numeric/ToExternal:-AddTempFile expects its 1st argument, f, to be of type string, but received [[["f1", 1864151924736]]] (3.597s)

Update:

help(Setup, Compiler) in Maple 2022 provides a link to supported compilers, which are Visual Studio 2017 and 2019.

In the list of available downloads there is no mention of "Express Edition". Which of the packages can be installed alternatively?

I don't understand why the solution of sys_2 isn't those of sys_1 when M__p=1 and M__a=0 ?

Traces of the computation seem to indicate that dsolve proceeds exactly the same for sys_2 and sys_1 .

Please note that sol_1 contains a term of the form t*cos(t) that sol_2 doesn't, thus the question: "Is sol_2 correct?"

Could you help me to fix this?
TIA

restart

infolevel[dsolve] := 4;

4

(1)

sys_1 := {diff(x(t), t$2)=sin(t)-x(t), x(0)=0, D(x)(0)=0};
sol_1 := dsolve(sys_1)

{diff(diff(x(t), t), t) = sin(t)-x(t), x(0) = 0, (D(x))(0) = 0}

 

Methods for second order ODEs:
--- Trying classification methods ---
trying a quadrature
trying high order exact linear fully integrable
trying differential order: 2; linear nonhomogeneous with symmetry [0,1]
trying a double symmetry of the form [xi=0, eta=F(x)]
-> Try solving first the homogeneous part of the ODE
   checking if the LODE has constant coefficients
   <- constant coefficients successful
   -> Determining now a particular solution to the non-homogeneous ODE
      building a particular solution using variation of parameters
<- solving first the homogeneous part of the ODE successful

 

x(t) = (1/2)*sin(t)-(1/2)*cos(t)*t

(2)

sys_2 := {(M__p+M__a)*diff(x(t), t$2)=M__p*sin(t)-x(t), x(0)=0, D(x)(0)=0};
sol_2 := dsolve(sys_2)

{(M__p+M__a)*(diff(diff(x(t), t), t)) = M__p*sin(t)-x(t), x(0) = 0, (D(x))(0) = 0}

 

Methods for second order ODEs:
--- Trying classification methods ---
trying a quadrature
trying high order exact linear fully integrable
trying differential order: 2; linear nonhomogeneous with symmetry [0,1]
trying a double symmetry of the form [xi=0, eta=F(x)]
-> Try solving first the homogeneous part of the ODE
   checking if the LODE has constant coefficients
   <- constant coefficients successful
   -> Determining now a particular solution to the non-homogeneous ODE
      building a particular solution using variation of parameters
<- solving first the homogeneous part of the ODE successful

 

x(t) = sin(t/(M__p+M__a)^(1/2))*M__p*(M__p+M__a)^(1/2)/(M__p+M__a-1)-M__p*sin(t)/(M__p+M__a-1)

(3)

eval(sol_2, [M__p=1, M__a=0])

Error, numeric exception: division by zero

 

 

Download SomethingWrong.mw

PS: Already, in the following case, dsolve doesn't return the solution of sys_1.

sys_3 := {(A+B)*diff(x(t), t$2)=(A+B)*sin(t)-x(t), x(0)=0, D(x)(0)=0};
sol_3 := dsolve(sys_3)

If I do this

sys_4 := {(A+B)*diff(v(t), t)=(A+B)*sin(t)-x(t), diff(x(t), t)=v(t), x(0)=0, v(0)=0}:
sol_4 := dsolve(sys_4)

I get a very complex solution wich contains a piecewise function which separates the cases A+B=1 and A+B<>1.
Evaluating sol_4 for A+B=1 gives the same expression than sys_1:

simplify(eval(sol_4, A=1-B), trig)
       /       1                  1          1         \ 
      { v(t) = - sin(t) t, x(t) = - sin(t) - - cos(t) t }
       \       2                  2          2         / 

Here is a workaround to get the correct solution of sys_2:

sys_5 := {(M__P+M__A)*diff(v(t), t)=(M__P+C)*sin(t)-x(t), diff(x(t), t)=v(t), x(0)=0, v(0)=0}:
sol_5 := dsolve(sys_5):
simplify(eval(sol_5, [M__P=1, M__A=0, C=0]), trig)
       /       1                  1          1         \ 
      { v(t) = - sin(t) t, x(t) = - sin(t) - - cos(t) t }
       \       2                  2          2         / 

e

Hi, 

Please how I do plot: theta := -(65.7014900075861*(cos(-4.536529763+45365.29764*z)+.1749541674))*exp(-1.603200636*t) for z=0..d.

I tried this: 

display(plot([seq(subs(t = i, theta), i = [seq(0.1*ii, ii = 1 .. 7)])], z = 0 .. d));

But I want this sequence: [seq(subs(t = i, theta), i = [seq(0.1*ii, ii = 1 .. 7)])] to include Pi/2 such that t_0 = Pi/2 in the plot. I.e., I want the Pi/2 to be the initial value in the sequence.

I compute the solution of this differential system

shock := piecewise(t <0, 0, t < 1, 10, 0):
sys   := {(M__p+M__a)*diff(x(t), t$2)=M__p*shock-x(t), x(0)=0, D(x)(0)=0}
sol   := unapply(rhs(dsolve(sys)), (M__p,M__a))

I'm interested in 3 quantities:

  • the first time tend > 0 such that sol(tend) = 0,
  • the time tmax in (0..tend) where sol(tmax) reaches its maximum value,
  • the value xmax = sol(tmax).

Since sol has a relatively simple expression, I first attempted to use solve for calculating tend, but that didn't work.
The conclusion is still the same for tmax and xmax.

The values of these 3 quantities that I expect solve to provide, are those obtained using fsolve.

Can you explain me the failures I faced and show me how to force solve to get these values?
TIA

ToyProblem.mw

Let S be a set S={E1,E2,E3,E4,.....,Ek}  where E1 is a set of edges, E2 is another set of edges etc.

that like E1={{1,2},{2,3},..}, E2={{3,4},{1,2},....} , now we need to pick all possible  distinct sets of  size L  from the k sets of S such that the 

{E1,E2,E3,....,EL} are mutually disjoint with each other in other.

Ei intersect Ej is null no edge in common for i  not equal to j    where i, j varies from 1 to L.

F is the function which takes to parameters set S and L.

F(S,L)  then returns all possible sets which are such that {E1,E2,E3,....,EL} are mutually disjoint with each other in other.

Here mutually disjoint in graph theory terms they are edge-disjoint mutually 

I hava a recursive formula with variable n. The answer has the variable n and also N1.  What doe N1 mean?

Currrently maple exports it in huge fonts do the pdf is really big. I would like to make the pdf smaller by decreaseasing the font size. I cant seem to find any options for that online.

Hi ---

      I know how to add the Angstrom symbol to a plot's axis label using my mouse and the palette menu.  How can I add the Angstroms symbol programmatically to the plot command?  Thanks!

David

Hi

I want to solve two equations (Eqmin and Eqmax) numerically  and plot curves of Mmin and Mmax versus "sigma" in one frame, But the  second curve (Mmax) is not plotted !  What should I do? 
(We know that only real and positive roots are acceptable)
Eq.mw

I can not spawn draw the circles C3 and C4

restart;
with(plots):
with(geometry):
_EnvHorizontalName := x:
_EnvVerticalName := y:
R := 7:
point(A, [0, R]):
line(L1, y = sqrt(3)*x + R):
line(L2, y = -sqrt(3)*x + R):
line(L3, y = R/3):
intersection(B, L1, L3):
intersection(C, L2, L3):
detail(C):
triangle(ABC, [A, B, C]):
circle(C1, [point(P1, [0, 0]), R]):
circle(C2, [point(P2, [0, R/3 + (2*R)/9]), (2*R)/9]):
detail(C2):
center(C2), coordinates(center(C2)):
reflection(P3, P2, C):
detail(P3):
reflection(C3, C2, C);
detail(C3):
Error, (in geometry:-reflection) unable to compute coeff
Error, (in geometry:-detail) unknown object:  C3
circle(C3, [point(P3*[(28*sqrt(3))/9, 7/9]), (2*R)/9]):
Error, (in geometry:-point) wrong number of arguments
reflection(C4, C2, B);
detail(C4);
Error, (in geometry:-reflection) unable to compute coeff
Error, (in geometry:-detail) unknown object:  C4
circle(C3*[point(P3, [(28*sqrt(3))/9, 7/9]), (2*R)/9]);
Error, (in geometry:-circle) wrong number of arguments


draw([L1(color = blue), 
ABC(color = red, transparency = 0.5, filled = true), 
L2(color = blue), L3(color = blue), 
C1(color = blue, thickness = 3), C1(color = yellow, transparency = 0.8, filled = true), C2(color = blue, filled = true)], 
axes = normal,
 view = [-R .. R, -R .. R], 
scaling = constrained);
Why these error messages. Thank you veru much.

Respected sir,

It looks like the Maple function IsSubgraphIsomorphic(G1,G2) function I think it is developled from the

phyton networkx package function 

GraphMatcher.subgraph_is_isomorphic()   The source python code for this is in this link below

networkx.algorithms.isomorphism.ismags — NetworkX 2.8.6 documentation

Now Can considering the Graphs G1 and G2 as vertex labeled graphs can we tweek the function in such way that rather than just to return true based on shape The function will now take a new parameter extra

IsSubgraphIsomorphic(G1,G2,Label=True or False)

If Label= True the then the function will return true if their is a subgraph G1 isomorphic in G2 with the same type of labels exists then it returns true and also returns that graph G1 edges based on those labels in G2.

Can anyone help please your help will be acknolwedged surely

Intially let it be for the undirected graph cases only.

A "while" ago this was possible by commands. E.g.:

(from https://www.youtube.com/watch?v=uaQh_bXcIGA)

I consulted the help pages for Export and CodeGeneration options, but could not find anything suitable to generate a C code file.

Did I overlook something or searched for the wrong help pages?

If such options no longer exist, what is the preferred way to transfer C code from Maple to MapleSim?

Am I supposed to copy, paste & save with a third party editor? If I do so for a C code generated from a Maple procedure (generated with makeproc), I get

A complete example that works in 2022 versions would be helpfull. The tutorial "6.6 Tutorial 6: Using the External C Code/DLL Custom Component App" unfortuneately does not include code generated by Maple that can be imported, compiled, simulated and verified against a MapleSim model as in the example from youtube (which is still very instructive by the way). 

First 64 65 66 67 68 69 70 Last Page 66 of 2212