Maple 2017 Questions and Posts

These are Posts and Questions associated with the product, Maple 2017

Take any odd number k, with distinct odd prime divisors p_1,...p_k and ask the following question: What is the smallest even number which when added to each prime divisor p_i of k, gives another prime? Example: k= 119=7*17, so the smallest even number is 6 because 7+6=11 and 17+6=23. NB: some numbers (eg 105,195,231...) seem to have no solution. I would appreciate assistance with a code to calculate for every odd k, the even number in question, or to allocate 0 for numbers where no solution has been found up to some suitably convincing high number like N= 10^5 or 10^6, (a parameter I could change if desired). The idea would be to conjecture that the apparently no solution numbers (up to N) don’t actually have a solution. Any assistance much appreciated in advance. I have found the solutions up to k=781 by hand, but my hand is getting tired now.

cheers,

David.

ps: I would like to have the option (if possible) to output the numbers with solution =  0, and the numbers which are the smallest to have solution 2*n, as separate sequences, for n up to some arbitrary value (ie 3,7,23,69,93...). (n>=1). Hope this is not asking too much. 

Hello

I need to create a list of variables from a list of variables.  I thought of something like the code snippet below but I could not figure out how to force Maple to evaluate the variable before creating the new variables.  It is very likely that my approach is completely wrong and I have to use something altogether different.  

vars:=[x,y,z];
for invars in vars do
[invars||(1..nops(vars))];
end do;

Many thanks

Ed

 

 

Hello

I need to build a system of linear equations from a list of polynomials.  The list of indeterminates is as follows:

incog:=[theta[1, 1], theta[1, 2], theta[2, 1], theta[2, 2], theta[2, 6], theta[3, 0], theta[3, 3], theta[3, 4], theta[3, 5]];

The list of polynomials is:

eq:=[1, theta[1, 1]+theta[2, 2]+theta[3, 3], -theta[1, 1]-theta[2, 2], theta[2, 6]*theta[3, 5], -theta[1, 1]*theta[3, 3]-theta[2, 2]*theta[3, 3], -theta[1, 1]*theta[2, 6]*theta[3, 5]+theta[1, 2]*theta[2, 6]*theta[3, 4], theta[1, 1]*theta[2, 2]*theta[3, 3]-theta[1, 2]*theta[2, 1]*theta[3, 3]+theta[1, 2]*theta[2, 6]*theta[3, 0]];

eq[1], eq[2] and eq[5] will be used as examples, although all of them should be used.  

In eq[1], there are no indeterminates, therefore the first line of the matrix related to the system of equations is:

[0, 0, 0, 0, 0, 0, 0, 0, 0]

In eq[2], there is a summation of  three indeterminates and the outcome is a set of three lines (summation of indeterminates)

[1, 0, 0, 0, 0, 0, 0, 0, 0]

[0, 0, 0, 1, 0, 0, 0, 0, 0]

[0, 0, 0, 0, 0, 0, 1, 0, 0]

In eq[5], there is a summation of a product of indeterminates and outcome is a set of two lines as follows:

[1, 0, 0, 0, 0, 0, 1, 0, 0]

[0, 0, 0, 1, 0, 0, 1, 0, 0]

 

Carrying on like this will result in a matrix of 14 lines with zeros and ones in positions related to the indeterminates.  Building the matrix is what matters to me.

I have a thousand of such problems with different indeterminates and set of polynomials.  

Any ideas on how to build a function to automatically create the matrices would be most appreciated.

Thank you.

Cheers

Ed

 

I'm having trouble connecting from Maple on Windows 10 to MSQL Server. I tried Microsoft recommended drivers such as sqljdbc_6.4.0.0, did (as I thought) all required steps. The only invariable result I get is "Cannot load driver". I was wandering if anyone had implemented such a construction. Driver name & version , connection string and Java version would be greatly appreciated. Another option is to have any driver, which connects to any of standard databases (Oracle, MySQL).  The only limitation is- it must be from Windows 7 or 10.
          Thanks.
           A.B.

Hello,

I have a problem in solving an integral in maple. I can't solve the below integral in maple and it returns the integral itself to me. I also attach an image from the integral if here is not clearly shown. I want maple to return me just a number. can anyone help me in this?

Thank you

int(sin(beta)*(-0.4447569104e-1*beta(10)^3+1.846983291*beta(10)^2+78.88888890*beta(10)+620.4645491)/(9.+.6366197724*beta(10))^2, beta = 0 .. (1/2)*Pi)

 

 

 

 

I used the implicit function to draw two images, how to display only the intersection of two images? Or, how do I draw the x^2+y^2+z^2=1 image under x+y+z=0 condition? Code show as above.Thank you.

 

I want to solve for the coefficients in some multivariate polynomials by equating them to other known multivariate polynomials.

 

Something like this. I have

p[1]=(a+b)*x^2+(a+c)*x*y+d*z;

p[2]=(a-b)*x+e*y*z+f*z^2;

 

I want to impose that p[1]=x^2+2*x*y+3*z and that p[2]=x+4*y*z and I want Maple to tell me the values of (a,b,c,d,e,f).

 

Sounds simple enough, but I have not been able to do it

I am providing analysis for a Graph I have made using the GraphTheory kit. I am attempting to find a way to find the Betweeness Centrality. So far I have only found one example of the code which is being used to find the Betweeness Centrality of a Network found in a pdf (Attatched below). I have been able to alter the code accordingly to my data but the last line requires some further understanding of how Matrices work in Maple. This is the line I fail to understand completely:

"""""""" BetweenessCentrality_data := < node_data[1.., 1] | < seq(add (ad_mat[i, j] * wt_mat[i, j], j = 1.. num_characters), i = 1. . num_characters)> >: BetweenessCentrality_sorted := FlipDimension( x[2])))>, 1)  """"""""

And this is all the code leading up to the line in question:

"""""""" data := FileTools:-JoinPath(["Excel", "Inter station database (2).xls"], base = datadir);

M := ExcelTools:-Import(data, "Hoja2");

edge_data := Matrix(727, 3, (i, j) --> M[i, j+2] );

with(ListTools);

node_data := Matrix(727, 2, (i, j) -->M[i, j+2] );

convert(Matrix(<<node_data>>), list);


listednode_data := convert(Matrix(<<node_data>>), list);

MakeUnique(listednode_data);

UniqueListedNode_data := MakeUnique(listednode_data);

node_data := Matrix(numelems(UniqueListedNode_data), 1, (i, j) -->UniqueListedNode_data[i]);
 

num_edges := RowDimension(edge_data);
 

num_characters := RowDimension(node_data);
 

G := Graph(node_data[() .. (), 1], weighted);
 

for i from 1 to num_edges do

AddEdge(G, [{edge_data[i, 1], edge_data[i, 2]}, edge_data[i, 3]])

end do;

wt_mat := WeightMatrix(G);
ad_mat := AdjacencyMatrix(G); """"""""

To provide further context, my graph is strongly connected.

If anyone could kindly provide a breakdown of the line of code in question, It would be very appreciated. 

Here is the link to the pdf I used as source for my code:https://www.maplesoft.com/applications/view.aspx?SID=154530

 

Hello, I am wondering if Maple is capable of generating a subgraph for a directed, weighed graph with the GraphTheory package. The online resources I can find only include undirected, unweighed graphs. 

can you please include an example with commands that is able to perform the said task?

My name is Viorel Popescu and I am a Ph.D. candidate at University Politehnica of Bucharest, Europe. I was impressed by the article that I found on the internet about Series Solution to Differential Equation with Maple. I am trying to solve the equation g''(r)- r/R*g(r)=0 with initial condition g(2R)=0 and g'(0)=R where R>0 is a positive constant.

I am using Maple 2017 and the following equations gives me in correct result when I run `maple m.mpl` in terminal, however, when I run in using the GUI, the result is correct. (one result is postive while one is negative)

 

 

res := solve({
T000000=1/(1*4.57*10^(-06)+1*2.07*10^(-06)+1*2.83*10^(-06)) + T100000*1*4.57*10^(-06)/(1*4.57*10^(-06)+1*2.07*10^(-06)+1*2.83*10^(-06)) + T010000*1*2.07*10^(-06)/(1*4.57*10^(-06)+1*2.07*10^(-06)+1*2.83*10^(-06)) + T000010*1*2.83*10^(-06)/(1*4.57*10^(-06)+1*2.07*10^(-06)+1*2.83*10^(-06)) ,
T000010=1/(1*4.57*10^(-06)+1*2.07*10^(-06)+4) + T100010*1*4.57*10^(-06)/(1*4.57*10^(-06)+1*2.07*10^(-06)+4) + T010010*1*2.07*10^(-06)/(1*4.57*10^(-06)+1*2.07*10^(-06)+4) + T000000*4/(1*4.57*10^(-06)+1*2.07*10^(-06)+4) ,
T010000=1/(1*4.57*10^(-06)+1*2.83*10^(-06)+4) + T110000*1*4.57*10^(-06)/(1*4.57*10^(-06)+1*2.83*10^(-06)+4) + T010010*1*2.83*10^(-06)/(1*4.57*10^(-06)+1*2.83*10^(-06)+4) + T000000*4/(1*4.57*10^(-06)+1*2.83*10^(-06)+4) ,
T010010=1/(1*4.57*10^(-06)+4) + T000010*4/2/(1*4.57*10^(-06)+4) + T010000*4/2/(1*4.57*10^(-06)+4) ,
T100000=1/(1*2.07*10^(-06)+1*2.83*10^(-06)+4) + T110000*1*2.07*10^(-06)/(1*2.07*10^(-06)+1*2.83*10^(-06)+4) + T100010*1*2.83*10^(-06)/(1*2.07*10^(-06)+1*2.83*10^(-06)+4) + T000000*4/(1*2.07*10^(-06)+1*2.83*10^(-06)+4) ,
T100010=1/(1*2.07*10^(-06)+4) + T000010*4/2/(1*2.07*10^(-06)+4) + T100000*4/2/(1*2.07*10^(-06)+4) ,
T110000=1/(1*2.83*10^(-06)+4) + T010000*4/2/(1*2.83*10^(-06)+4) + T100000*4/2/(1*2.83*10^(-06)+4) }, { T000000,T000010,T010000,T010010,T100000,T100010,T110000 }):
T0 := subs(res, T000000):
printf("%g\n", T0);

 

n is a Carmichael number iff for every prime factor p of n, p-1/n-1.

Question: How to find odd squarefree composite numbers n having k distinct prime divisors, and the property that exactly k-1 prime divisors satisfy the Carmichael requirement, p-1/n-1 ?

Examples: 231,1045,1635. In these cases k=3 and the prime divisors satisfying the criteria are the greatest and smallest. I have a code for this but would like to compute the general case, where the criteria is satisfied for precisely any k-1 divisors.

Any assistance greatly appreciated.

David. 

 

Hello everyone, I'm trying to run a simple calculation (Water flowing out of a pressurised container) using a combination of conservation of energy and conservation of mass. I have working models of the same system without pressurisation (purely gravity working) which work fine in Maple, but when re-writing the pressure as a function of the height of the water I receive the error:

"Error, (in DEtools/convertsys) unable to convert to an explicit first-order system".

 

The formula used is:

"Eq1:= -Rho_Water * A_Barrell * v_Barrel = Rho_Water * A_Nozzle * v_Nozzle"

Which returns:

"Eq1:= -25.23733555 * d/dt h_Water(t) = 0.5982 * (-190.1309944 - 13.64385474 * h_Water(t) + (d/dt h_Water(t))2)1/2"

With initial condition:

"ics1:= h_Water(0) = 0.2"

 

After giving the command:

"Sol1:= dsolve({Eq1, ics1}, numeric)"

Maple returns the aforementioned error. When trying to solve non-numerically the output is a list filled with "RootOf" and "_Z". Instinctively I would say the square root in the second part of the equation is the problem here, but I would not know how to fix this. Does anybody have a quick fix for this problem? Or is there a fundamental issue with the equation? Thank you in advance!

I'm trying to solve this set of two equations forn where (EQ1 and EQ2 are already défined in fontions of the followings variables (k, wr ,R,Pi), and i'm using the following loop 

 

eqns:={EQ1,EQ2}:

for i from 1 by 1 to 101 do R:=(i-1):S:=fsolve((eqns), {k, wr},{k=0..10,wr=0..10} ):v(i):=(subs(S,(wr))):w(i):=(subs(S,(k)))end do:
Error, invalid input: subs received fsolve({-0.6391108652e160*k+0.2384499927e160*wr+0.714075224e160*k^3-0.4729440685e160*wr^3-0.4025871558e160*k^5+0.1700629083e159*wr^5-0.4813673552e156*k^9+0.1033594302e160*k^7-0.1044324938e156*wr^7-0.1017755535e159*k^3*wr^4+0.2163976160e160*k^5*wr^2-0.7986601863e160*k^4*wr-0.2729449277e160*k^6*wr+0.8693579523e154*k^3*wr^6+0.4453377949e156*k^4*wr^5-0.2636332727e157*k^5*wr^4-0.5817233940e157*k^7*wr^2+0.5719400327e157*k^6*wr^3-0.2875232976e161*k^2*wr+0.2294793648e161*k*wr^2+0.1483050053e158*k^2*wr^5-0.3944893217e159*k^4*wr^3-0.464413477e159*k^2*wr^3+0.2760407324e157*k^8*wr+0.8238787577e156*k*wr^6-0.1081920595e...
 

i do get a solution for Pi/2 and Pi/3 but beyond this value i get the above error

Hi,

I am trying to write a code for the following simple recurrence:

a(1)=1,

a(n)+1prime—>a(n+1)=a(n)+1,

a(n)+1 composite —>a(n+1)=n+2

if a(n) even, or a(n)+ 3 if a(n) odd.

Data: 1,2,3,6,7,10,11,14,16,17.....

My first attempt is the following:

N:=10:

for k from 1 to N do

X:=1;

if isprime(X+1) then print(X+1);

elif not isprime(X+1) and mod(X,2)=0 

then print(X+2);

else print(X+3);

end if:

end do:

This does not work but I cannot see why. Would somebody mind to help me out with this?

 

Best regards

David.

 

 

 

4 5 6 7 8 9 10 Last Page 6 of 38