Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hello everyone!

I use this procedure to open my inbox:

>restart;
ShellExecute := define_external('ShellExecuteA', hwnd::(integer[4]), lpOperation::string, lpFile::string, lpParameters::string, lpDirectory::string, nShowCmd::integer[4], 'RETURN'::integer[4], LIB = "C:\\WINDOWS\\SYSTEM32\\shell32.dll"):
OpenBrowser := proc(someURL::string := "http://")

ShellExecute(0, " ", someURL, " ", " ", 1); NULL;

end proc:

Case 1:  I entered the correct email address of my friend who sent me the mail

>OpenBrowser("https://mail.google.com/mail/u/0/?tab=rm&ogbl#inbox/xxxxxxGqRZXPKXGzrrSrfHscdNWspRJF");

As a result, the content of the message I received was opened with full information.

Case 2:  When I enter an arbitrary email address that is not my friend, the result is that no content is displayed.

>OpenBrowser("https://mail.google.com/mail/u/0/?tab=rm&ogbl#inbox/yyyyyyGqRZXPKXGzrrSrfHscdNWspRJf");

On the email there is only the message: The conversation you requested could not be loaded.

May I ask:  Is there any Maple command to return true in case 1 and to return false in case 2 ?

Thank you very much for your help !

As you can see in the figure below, 

it shows a very strange "font",

you can obviously see very weird spacing even inside one word...

Who knows what's wrong???

Thanks a lot.

B/R

Jankel

Good day,

I am looking for some guidance with the Syrup toolbox

I have a netlist that was generated with the Altium designer Spice simulator (XSpice based), I was able to import it into LTSpice and verrify the results.

I want to move it into maple to make use of the modellica code generation.

I then began modifying the netlist in order to meet the netlist syntax of Syrup. One of the most prominant change I needed to make was the arbitrary input nodes for my Voltage dependant Voltage sources. 

Therefore, for any line that implies arbitrary sources such as:

E_U8_E1 U8_N208620 LO
+ VALUE { IF(V(U8_N208706, 0) > 0.5, 5, -5) }

was changed to:

V1    16   17 1vdc

E_U8_E1 U8_N208620 LO 16 17
+ VALUE { IF(V(U8_N208706, 0) > 0.5, 5, -5) }

This, of course, is a non ideal workaround which brings me to question 1,

Is there a way to define a arbitrary source with the Spice parser in Syrup?

Once these changes were made, it seems the Solve function in Syrup can parse the netlist without issue, however when it gets to the Solve portion it throws the following error:

Solve("file://C:/Users/msavoy/Documents/Spice_cct/inverter_newfet_nonot.cir", 'tran');
Solve: Analyzing SPICE deck "The Apple" (ignoring this line)
Error, (in Syrup:-Solve) invalid input: rcopy uses a 1st argument, A (of type anything), which is missing

Attached is a copy of the netlist, inverter_newfet_nonot.txtI am honestly at a lost as to what could be throwing the rcopy error

Furthermore, I wanted to test out the Modellica code generation in Syurp, it appears that it does not like having subcircuits, as running the test:

V 1 0 1
L1 1 2 L
C1 2 0 C
L2 2 3 L
C2 3 0 C
L3 3 4 L
C3 4 0 C
Vshort 4 5 0
Rt 5 0 1
.SUBCKT TEST A B C Y
V1 14 15 1
EINT YINT 0 14 15
+ VALUE {IF(V(A) > 0.5 && V(B) > 0.5 && V(C) > 0.5, 1, 0)}
RINT YINT Y 1
CINT Y 0 1n
.ENDS TEST
.end

provides the error of:

test_c := ToModelica("file://C:/Users/msavoy/Documents/Spice_cct/test_cct_RCL.txt", 'probes' = ["Rt.v"], 'parameters' = {C = 2, L = 1});
Error, (in Syrup:-ToModelica) invalid input: nodeToModelica expects its 1st argument, node, to be of type nonnegint, but received Y

Is it possible to define a sub circuit in a netlist that is to be converted to Modellica, or do all subcircuits need to be defined in their own file?

Thank you

in the context of solving an ode, sometimes the constant of integration that will satisfy an initial condition is +infinity or -infinity.

But Maple's solve does not find such solutions to the constant of integration. It only can solve for finite value if it can.

When this happens, I manually try taking the limit as the constant of integration goes to +- infinity, until I get an equation where both sides are the same or fail, and then give up.

I was wondering if there is a way or different command/package which will find solution such as infinity (which is valid solution to constant of integration).

Here are two examples

ode:=diff(y(x),x)=1/(LambertW(-exp(-1+_C1+x))+1);
ic:=[diff(y(x),x)=1,x=0];
eq2:=eval(ode,ic);
solution_for_constant := solve(eq2,_C1,'allsolutions'=true,'tryhard'=true);

Maple can not solve for _C1. It gives

But when trying manually few values, I find that _C1=-infinity satisfies the equation

limit(rhs(eq2),_C1=0);
limit(rhs(eq2),_C1=1);
limit(rhs(eq2),_C1=-1);
limit(rhs(eq2),_C1=infinity);
limit(rhs(eq2),_C1=-infinity);

The above shows that _C1 = -infinity is the constant of integration. Another simpler example

eq:=exp(-1 + _C1) = 0;
solution_for_constant:=solve(eq,_C1) assuming real;
limit(lhs(eq),_C1=-infinity)

The above shows that _C1=-infinity is solution for exp(-1+C_1)=0.  which one can see by just looking at it as exp(-infinity)=0.  Adding assumptions did not help.I also tried symbolic option.

I am not familar with SolveTools package, may there is something there.

So for now, my code just try the limit until it finds solution or gives up.

Any suggestions if Maple itself can find such solutions?

Maple 2022.2

if isolate fail, then it returns back the input equation. But if solve failed to solve for the variable in question, it returns either NULL or empty list, or empty set (depending on the input). So it is easy to check if it failed or not.

How does one check that isolate failed? Should I check the left side of what isolate returns is the variable I am solving for? For an example,

sol:=isolate(-2*y-cos(y)+x+sin(x)-_C1 = 0,y)

returns back -2*y-cos(y)+x+sin(x)-_C1 = 0

Is the following the correct way to check if isolate solved the equation or not:

sol:=isolate(-2*y-cos(y)+x+sin(x)-_C1 = 0,y);
if lhs(sol)=y then
   print("it solved it. Soltion is ",sol);
else
   print("Failed to solve it. Try solve command now ");
fi;

Just wanted to make sure as help for isolate does not mention anything about what happens if isolate can't solve the equation.

Maple 2022.1

Hello everyone,

I am trying to solve a system of 4 ODEs that describe a physical system, however, I get the message:

Error, (in dsolve/numeric/bvp) matrix is singular

Any help is much appreciated. The initial conditions are such that to find solution in steady state, that means, v(0)=v(period) and so on with all variables.

Download LLCcircuit_SteadyState_numerical.mw

Good day. 

I have been looking into the time series features in Maple and was eager to apply the models to one specific example containing 47 data points (attached).

When I run the ESM routine, Maple provides a forecast based on a (A,N,N) configuration. You will notice that the forecast for the following 12 data points is a constant value. I have also noticed this for several other data set examples and I would have expected the predictions to vary across the next 12 data points.

Does the (A,N,N) configuration in Maple automatically provide an optimal forecast and can anyone advise me on how to specify all possible combinations of (error, trend, season) models?

Thanks you for reading.

MaplePrimes_TS_Example.mw

solve((∂(-    ∇(f) ))/(∂ t)+((DotProduct(v[0],∇f))*(1-e(DotProduct(B,Omega)))+(c[s0]^(2)*rho[1])/(rho[0])(1-e(DotProduct(B,Omega)))+e(CrossProduct(∇ f,B))*Omega-e((DotProduct(-∇f,Omega))*(DotProduct(B,∇)))*(-∇f)+e(E)*(1-(DotProduct(B,Omega)))+e^(2)(DotProduct(E,B))*Omega-e*((CrossProduct(E,Omega))*(∇(-∇f)),rho[1]);

Hi,

Since a couple of years ago,  SQLite has been enriched with a bunch of new math functions not existing in previous versions: acos, asin, atan, atn2, atan2, acosh, asinh, atanh, difference, degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp, log, log10, power, sign, sqrt, square, ceil, floor, pi. 

Examples: In SQLite version 3.39.4 2022-09-29 15:55:41 we can invoke:

sqlite> select pi();
3.14159265358979

sqlite> select power(2, 3);
8.0

sqlite> select floor(2.35);
2.0

Package Database[SQLite] in Maple 2022.2 does not recognize these functions.

In oldest versions of Sqlite3 we were able to add these functions after loading an external extension with sqlite3 api function load_extension() (see  https://sqlite.org/contrib/download/extension-functions.c), but his option is blocked in Maple:

dbName := "d:/sq3_maple/etc.db":
sq3Extension := "d:/sq3_maple/extensions.sq3":

with(Database[SQLite]);
[Attach, Bind, ClearBindings, Close, ColumnCount, ColumnNames, 
  Execute, Fetch, FetchAll, FetchRow, Finalize, Open, Opened, 
  Prepare, RESULT_BUSY, RESULT_DONE, RESULT_ROW, Reset, Step]

conn := Open(dbName):
Execute(conn, sprintf("SELECT load_extension('%s')", sq3Extension));
Error, (in Database:-SQLite:-Execute) not authorized

Am I missing something? Any way to add these functions to SQLite in current version of Maple?

Thanks in advance.

César Lozada

PS: SQLite is updated in Mathematica 13.1

 

 

 

Dear all

I construct by hand the two matrices L and U so that A= LU ( LU-factorization) 
I would like to find the number of arithmetic operations required to obtain the matrices 𝐿 and 𝑈

Number_arithmetic_operation.mw

Thank you

Hi.  I am using the linux version of Maple.  I seem to experience more bombs in Maple/Linux vs MathCad/Windows.  The program just froze as I was entering text.  Just text.  It is not a disaster since I make very frequent saves.  But it is very annoying.  I was a heavy user of MathCad from about 2005 to 2019.  In the early days, it bombed a lot.  But I do not recall that it ever bombed when I was entering text.  Any suggestions?  Would there be a limition on the number of text characters?  Is it Linux?  Other than this problem, it is a great program.

Hi! This is probably simple, but
I would like to know if there's an specific algorithm to do this:

let B = {x[i], i=1..n} in such a way that:

f( B ) = Sum(a[i]*b[i], i=1..N); a_i in R; b_i in B; N>n.

so Linearcomb: f->V(R).

Linearcomb( f ) =

 (Sum(a[j],j in J))*x[1]+(Sum(a[k],k in K))*x[2] + ... +(Sum(a[z],z in Z))*x[n].

with V(R) a vector space; R the Real numbers, and B the base. Neither the "factorize", nor the "simplify" are proving useful to this. Is there something i'm missng?

with(Physics)

diff(x(t), `$`(t, 2)) = a(t)

diff(diff(x(t), t), t) = a(t)

(1)

dsolve(diff(diff(x(t), t), t) = a(t), arbitraryconstants = subscripted)

x(t) = Int(Int(a(t), t), t)+c__1*t+c__2

(2)

a(t) = 1.*Unit('m'/'s'^2), c__1 = 2*Unit('m'/'s'), c__2 = 3*Unit('m')

a(t) = 1.*Units:-Unit(m/s^2), c__1 = 2*Units:-Unit(m/s), c__2 = 3*Units:-Unit(m)

(3)

subs(a(t) = 1.*Units:-Unit(m/s^2), c__1 = 2*Units:-Unit(m/s), c__2 = 3*Units:-Unit(m), x(t) = Int(Int(a(t), t), t)+c__1*t+c__2)

x(t) = Int(Int(1.*Units:-Unit(m/s^2), t), t)+2*Units:-Unit(m/s)*t+3*Units:-Unit(m)

(4)

value(%)

x(t) = (1/2)*t^2*Units:-Unit(m/s^2)+2*Units:-Unit(m/s)*t+3*Units:-Unit(m)

(5)

NULL

Warning, units problem, not enough information to unambiguously deduce the units of the variables {t}; proceeding as if dimensionless

How can I provide the information to Maple that the unit of t is s?

 

Update: Temporarily disabling the warning would also be an option for the above case.

 

Download Unit_of_t.mw

!Edits: I have found  a existing polynomial algorithm, but I still have difficulty implementing it. 2022/10/26

 

The edge connectivity of a connected graph G  is the minimum number of edges whose deletion from the graph G disconnects G. Below we are concerned with a particular kind of edge-cut.

  • For a connected graph G=(V ,E), an edge set S ⊂ E is a restricted-edge-cut, if G−S is disconnected and every connected component of  G−S has at least 2 vertices. 

Clearly, a restricted-edge-cut is an edge cut with a special requirement.

  • The restricted-edge-connectivity of G, denoted by κres(G), is defined as the cardinality of a minimum restricted-edge-cut.

For example, a graph g is as follows.

 

Clearly, its edge-connectivity is 1 since (0,3) or (0,4) is a edge cut of g. But we can find that  if we remove the edge (0,3), then "3" is a isolated vertex. Similarly, "4" is a isolated vertex if we remove  (0,4). It is not difficult to find g has exactly the two cut-edges (0,3) and (0,4).

 

Based on the definition of the restricted-edge-cuts, neither {(0,3)} nor  {(0,4)} are restricted-edge-cuts A minimum restricted-edge-cut is {(0,1),(0,2)} since every connected component of G-{(0,1),(0,2)} has  (at least) 2 vertices.

So  κres(g) is 2.  My problem is:

Given a graph G, how to calculate the restricted-edge-connectivity of  G?  Moreover, how to find a minimum restricted-edge-cut? 

A specific graph that I want to test is as follows. (it has 16 vertices and 56 edges.) I would like to calculate its restricted-edge-connectivity and find a minimum restricted-edge-cut. 

g:=ConvertGraph("O~tIID@wL~j`PbOqgLJ@p");
DrawGraph(g, stylesheet=[vertexborder=false,vertexpadding=15,edgecolor = "Black",
     vertexcolor="Black",edgethickness=2])

EdgeConnectivity(g) 

6

One option I came up with is to find all 6-edge subsets first. Test if they satisfy  the restricted condition (one by one). Then continue to increase to 7 or more. But this violent calculation may get stuck in the first step. That is, test all the minimum edge cut sets (Note that we will consider 32468436 edge-subsets!) I was referring to the efficiency aspect.  

with(Iterator):
C:=Combination(58,6):
K:=Edges(g):
#sub:=seq( K[[seq(c[]+1)]], c=C); # do not run this code since it has 32468436 members.

 

Any language is acceptable.( C or C++, Python. )

PS: Some time ago, I also asked a related question (but with some differences) on mathematica stack (Find all the minimum edge cuts of a graph). Although Bob Hanlon  gave a reply, the actual result is not good.

 

Edits: The following literature gives a polynomial algorithm for computing the restricted-edge-connectivity of a given  graph. The heart of it is to computing the least cardinality of some  edge-pairs's edge separator. I'm stuck here.

  • Esfahanian A H, Hakimi S L. On computing a conditional edge-connectivity of a graph[J]. Information processing letters, 1988, 27(4): 195-199.

How to implement this algorithm is my current concern.

Hello:

I've changed my laptop this week and I'd like to know how to install Maple with my account in the new one.

Thanks in advance.

Sergio Sanz.

First 7 8 9 10 11 12 13 Last Page 9 of 1999