MaplePrimes Questions

Hey there.

I'm trying to fill out the entries of a matrix. Each matrix element is the result of a very complicated calculation. Currently, I am using nested do loops (two loops total) to scan through each row and column respectively. I find that this process racks up a ton of memory, and that I often run out of memory before the matrix has been completely specified (depending on how big a matrix I want).

First, why is this happening? And second, what is a smarter way to perform the calculation? I will attatch my code below.

Cheers!

MaplePrimes2MuchMemory.mw

Hi 

I am studying Marine Engineer, and we are gonna work alot with vectors. I am using Maple as my mathematical software and i would like to know if you can do a simple vector addition in Maple?
I have tried to make a simple vector diagram to help understand my problem. 
My vector U, is my reference vector, and my two vectors I1 and I2 are the vectors i would like to plus. I know the length of both I1 and I2, and i know the angle between I1 and U and I2 and U.

If i am using my TI-nspire, i can just type in the length and angle on both I1 and I2, to my reference vector, and then plus them together. Is this possible to do in maple?

For the vectors onmy example the result of vector additon of I1+I2 = 2.42 to an angle of 48.07 degree.

The image is just for representation and is not accurate according to the lengths and angles.

Hope someone out there can help me.

 

Dear Users,

I have a set of linear equations which can be presented as A(alpha,n) x(alpha)=b(alpha,n), where 'n' is the dimension of the square matric A.

For a particular value of "n" and "alpha", I can solve the unknown vector x. Further, I can differentiate Ax=b with respect to alpha to find out the rate of change of variable x with respect to alpha.

The above exercise reads, Ax'=b'-xA', which gives the unknown vector x', for a given value of alpha and n.

If I chose different values of n while fixing alpha=alpha0, the rate of change of x with alpha ( x' ) does not converge with 'n'. I noticed that x (alpha=alpha0) converges with n, also x(alpha=alpha0+ delta alpha) also converges with 'n'. I am interested in the query why x' does not converge, in spite of the fact that x converges? Any comments regarding the same are highly appreciated.

 

Thanks,

Grv

I realise this is probably a really obvious question...

I have this function:

(2^(1/3)*Pi*AiryAi(x))/(b*(a*AiryAi(x) + b*AiryBi(x)))

And I want to approximate it near to the root of the equation

a*AiryAi(x) + b*AiryBi(x)=0 (say the solution is x=x0)

The first term - I know - is a term for 1/(x-x0) for which the coefficient is

AiryAi(RootOf(AiryAi(_Z)*a + b*AiryBi(_Z)))*2^(1/3)*Pi/(b*a*AiryAi(1, RootOf(AiryAi(_Z)*a + b*AiryBi(_Z))) + b^2*AiryBi(1, RootOf(AiryAi(_Z)*a + b*AiryBi(_Z)))).

However the next term, which should be a constant, comes out as a really large term which I can't make sense of (I've included it at the bottom of this post but it is very large).

Am I doing something wrong? Because I feel that this should be easier than I'm making it.

 

The determined expansion was:


    (1/3)                                       2
-3 2      Pi RootOf(AiryAi(_Z) a + b AiryBi(_Z))  

                                             3               
  AiryBi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  AiryAi(RootOf(

                                 3      (1/3)    
  AiryAi(_Z) a + b AiryBi(_Z))) b  - 9 2      Pi

                                     2
  RootOf(AiryAi(_Z) a + b AiryBi(_Z))  

                                             2
  AiryBi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  

                                             2    2      (1/3)    
  AiryAi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  a b  - 9 2      Pi

                                     2                           
  RootOf(AiryAi(_Z) a + b AiryBi(_Z))  AiryBi(RootOf(AiryAi(_Z) a

                                                               3
   + b AiryBi(_Z))) AiryAi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  

   2        (1/3)                                       2
  a  b - 3 2      Pi RootOf(AiryAi(_Z) a + b AiryBi(_Z))  

                                             4  3      (1/3)    
  AiryAi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  a  - 4 2      Pi

  RootOf(AiryAi(_Z) a + b AiryBi(_Z)) AiryBi(RootOf(AiryAi(_Z) a

   + b AiryBi(_Z)))

                                                2               
  AiryBi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  AiryAi(RootOf(

                                 3      (1/3)                       
  AiryAi(_Z) a + b AiryBi(_Z))) b  - 8 2      Pi RootOf(AiryAi(_Z) a

   + b AiryBi(_Z)) AiryBi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))

  AiryBi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z))) AiryAi(1,

  RootOf(AiryAi(_Z) a + b AiryBi(_Z))) AiryAi(RootOf(AiryAi(_Z) a

                       2      (1/3)                       
   + b AiryBi(_Z))) a b  - 4 2      Pi RootOf(AiryAi(_Z) a

   + b AiryBi(_Z)) AiryBi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))

                                                2               
  AiryAi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  AiryAi(RootOf(

                                 2        (1/3)                  
  AiryAi(_Z) a + b AiryBi(_Z))) a  b - 4 2      Pi RootOf(AiryAi(

  _Z) a + b AiryBi(_Z))

                                                2
  AiryBi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  

                                             2    2      (1/3)    
  AiryAi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  a b  - 8 2      Pi

  RootOf(AiryAi(_Z) a + b AiryBi(_Z)) AiryBi(1,

  RootOf(AiryAi(_Z) a + b AiryBi(_Z))) AiryAi(1,

  RootOf(AiryAi(_Z) a + b AiryBi(_Z)))

                                             2  2        (1/3)    
  AiryAi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  a  b - 4 2      Pi

  RootOf(AiryAi(_Z) a + b AiryBi(_Z))

                                                2
  AiryAi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  

                                             2  3      (1/3)    
  AiryAi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  a  + 2 2      Pi

                                             2           
  AiryBi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  AiryBi(1,

  RootOf(AiryAi(_Z) a + b AiryBi(_Z))) AiryAi(RootOf(AiryAi(_Z) a

                     3      (1/3)    
   + b AiryBi(_Z))) b  + 2 2      Pi

                                             2           
  AiryBi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  AiryAi(1,

  RootOf(AiryAi(_Z) a + b AiryBi(_Z))) AiryAi(RootOf(AiryAi(_Z) a

                       2      (1/3)                              
   + b AiryBi(_Z))) a b  + 4 2      Pi AiryBi(RootOf(AiryAi(_Z) a

   + b AiryBi(_Z))) AiryBi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))

                                             2    2      (1/3)    
  AiryAi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  a b  + 4 2      Pi

  AiryBi(RootOf(AiryAi(_Z) a + b AiryBi(_Z))) AiryAi(1,

  RootOf(AiryAi(_Z) a + b AiryBi(_Z)))

                                             2  2         (1/3)    
  AiryAi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  a  b + 12 2      Pi

                                                3           
  AiryBi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  AiryAi(1,

                                        3       (1/3)    
  RootOf(AiryAi(_Z) a + b AiryBi(_Z))) b  + 36 2      Pi

                                                2
  AiryBi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  

                                                2    2      
  AiryAi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  a b  + 36

   (1/3)                                                   
  2      Pi AiryBi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))

                                                3  2        (1/3)    
  AiryAi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  a  b + 2 2      Pi

  AiryBi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))

                                             3  2  
  AiryAi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  a  b

         (1/3)                                                  4
   + 12 2      Pi AiryAi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  

   3      (1/3)                                                   
  a  + 2 2      Pi AiryAi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))

                                             3  3\//   
  AiryAi(RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  a / \12

                                                4  4        
  AiryAi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  a  b + 48

                                                3           
  AiryAi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  AiryBi(1,

                                        3  2      
  RootOf(AiryAi(_Z) a + b AiryBi(_Z))) a  b  + 72

                                                2
  AiryAi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  

                                                2  2  3      
  AiryBi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  a  b  + 48

  AiryAi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))

                                                3    4
  AiryBi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  a b

                                                      4  5\
   + 12 AiryBi(1, RootOf(AiryAi(_Z) a + b AiryBi(_Z)))  b /

 

Let be given a cylinder with radius of the base circle is equal to 3 and the altitude of the cylinder is equal to 2. How can I draw square ABCD so that A, B and C, D lie on two base circles. How can I get one option of all vetices A, B, C, D ?

In my papers, I frequently use characters surmounted with a symbol, e.g., an "overbar" (used, for example, to denote a sample mean), a caret (or "hat") (used, for example, for Fourier transforms, or estimated value of a parameter), or a tilde.  Can one create surmounted symbols like this in Maple?  If so, please explain how.

Hello,

I'm new to Maple, but somewhat competent in computer mathematics. Below is some code that I wrote. I start off with f, my original function, and try to simplify it. I tried defining some assumptions as best I could. When I calculate the integral, it gives me an odd range of validity.

I'm wondering if I can further add to my assumptions to make the integral result more concise, i.e. without the piecewise range of validity. All my variables in f and g are already real and positive, so there is no reason one of the expressions should be less than zero. 

Thank you in advance for any insight.

 flat-geometry_recalc_Aug20_singleS.mw
 

f := (Pi*x+2*c+2*m)/(mu__c*S)+2*epsilon/(mu__a*S)+(Pi*x+2*c)/(mu__s*S)

(Pi*x+2*c+2*m)/(mu__c*S)+2*epsilon/(mu__a*S)+(Pi*x+2*c)/(mu__s*S)

(1)

g := simplify(f, symbolic)

(((Pi*x+2*c+2*m)*mu__s+2*((1/2)*Pi*x+c)*mu__c)*mu__a+2*epsilon*mu__c*mu__s)/(mu__c*S*mu__a*mu__s)

(2)

`assuming`([g], [S__s::positive]); 1; S__c::positive, S__a::positive, epsilon::positive, mu__s::positive, mu__c::positive, mu__a::positive, c::positive, m::positive

S__c::positive, S__a::positive, epsilon::positive, mu__s::positive, mu__c::positive, mu__a::positive, c::positive, m::positive

(3)

int(1/g, x = 0 .. w, AllSolutions)

`assuming`([int(1/g, x = 0 .. w)], [0 < w])

piecewise(And((c*mu__a*mu__c+c*mu__a*mu__s+epsilon*mu__c*mu__s+m*mu__a*mu__s)/(mu__a*(mu__c+mu__s)) < 0, -2*(c*mu__a*mu__c+c*mu__a*mu__s+epsilon*mu__c*mu__s+m*mu__a*mu__s)/(Pi*mu__a*(mu__c+mu__s)) < w), undefined, mu__s*S*mu__c*(-ln(2)-ln(c*mu__a*mu__c+c*mu__a*mu__s+epsilon*mu__c*mu__s+m*mu__a*mu__s)+ln(Pi*mu__a*mu__c*w+Pi*mu__a*mu__s*w+2*c*mu__a*mu__c+2*c*mu__a*mu__s+2*epsilon*mu__c*mu__s+2*m*mu__a*mu__s))/(Pi*(mu__c+mu__s)))``

(4)

 

NULL


 

Download flat-geometry_recalc_Aug20_singleS.mw

 

Hi, 

I want to insert the symbol ( infinity) in my graph, but I did not succeed . ideas? Thank you

TickmarkQuestion.mw

 

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

 

Hi MaplePrimes,

I'm trying to explore the polynomial r = n^2+n+39.  where n is an integer

I want restrictions on n such that r will factor into two trinomials.

Here is how far I got - 

prime_poly_39_explore.mw

The 'has' function may be helpful.

Any help is appreciated.

Regards,

Matt

 

Hi 

I was wondering whether anyone could help me. I am trying to plot a large number of functions on the same graph and am struggling with a way of inputting this without having to manually enter each.

 

Basically, I have a for do loop that runs from i being 0 to n. Within the loop, it takes a[i] = some function of my variables so in essence I have n functions that I would like to plot on the same graph. Currently I'm working with a low number for n to make sure that the code is running how I want it to, however I'm looking to increase my n number significantly which will obviously mean I have a significant number of functions.

I am using:

plot3d({a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15], a[16], a[17], a[18], a[19], a[20]}, z = 0 .. m, x = -M .. M, lightmodel = none, orientation = [180, 0, 180], style = surfacecontour, shading = zhue)

to plot my functions however I don't want to have write out each of the a[ ] when increasing this n value. So I was wondering whether anyone has any ideas how to write this in a shorter form?

I hope that makes sense and any help would be greatly appreciated.

So I have two differently parametrised plots:

p1 := plot([2^(1/3)*Pi*AiryAi(x)/(Q*(P*AiryAi(x) + Q*AiryBi(x))), -2*(-0.0008397983056*2^(1/6)*AiryAi(1, x) + 0.004845212367*2^(1/6)*AiryBi(1, x))/((-0.0008397983056*2^(1/6)*AiryAi(x) + 0.004845212367*2^(1/6)*AiryBi(x))^3*(648.3911162*2^(1/6)*AiryAi(1, x)/(-0.0008397983056*2^(1/6)*AiryAi(x) + 0.004845212367*2^(1/6)*AiryBi(x)) - 648.3911162*2^(1/6)*AiryAi(x)*(-0.0008397983056*2^(1/6)*AiryAi(1, x) + 0.004845212367*2^(1/6)*AiryBi(1, x))/(-0.0008397983056*2^(1/6)*AiryAi(x) + 0.004845212367*2^(1/6)*AiryBi(x))^2)), x = -1 .. 5])

and

p2 := plot([(sin(x) - sin(ap))/K, abs(sin(x)/cos(x)), x = 0 .. 2])

 

I would like to show the sum of these two plots. How would I go about doing this?

 

Does maple provide any platform for running calculation something like cloud facility

When was the Mathematical formula question introduced in Maple TA?

From a book, it shows the following

Verified by hand the last result  above x^(2/3)+y^(2/3)-a^(2/3)=0 is correct. The input is always 2 equations in x and y as shown above, and there is always one constant C in both that needs to be eliminated to obtain a solution (one equation) that contains y,x and any other parameters, but without c.

have been trying to use eliminate command to do the same as above. I assume eliminate is the right command for this. But not able to get close to what the book shows above for final result. 

Does any one knows how obtain same result as above using Maple's eliminate?  (I can't follow the same steps as hand solution, since that would apply only to the above example. I need to use a generic approach). 

Sometimes it is hard to obtain same result using computer as one can do by "hand".

Here is some of my attempts

restart;

assume(x::real,y::real,a::real);
eq1:=x=-a/(1+c^2)^(3/2);
eq2:=y=a*c^3/(1+c^2)^(3/2);

x = -a/(c^2+1)^(3/2)

y = a*c^3/(c^2+1)^(3/2)

result:=eliminate([eq1,eq2],c);
result:=DEtools:-remove_RootOf(result[2,1]):
result:=DEtools:-remove_RootOf(result);
result:=simplify(result,power,symbolic);
result:=expand(result);

[{c = RootOf(_Z^2-RootOf(_Z^3*x+a)^2+1)}, {y*(RootOf(_Z^3*x+a)^2)^(3/2)-RootOf(_Z^2-RootOf(_Z^3*x+a)^2+1)*RootOf(_Z^3*x+a)^2*a+a*RootOf(_Z^2-RootOf(_Z^3*x+a)^2+1)}]

x*((a^2-y^2)*(a*y^2)^(1/3)*a*((a*y^2)^(2/3)+a*(a*y^2)^(1/3)+y^2))^(3/2)/(a*y^2*(a^2-y^2)^3)+a = 0

a*((y^(2/3)*a^(2/3)+a^(4/3)+y^(4/3))^(3/2)*x+(a^2-y^2)^(3/2))/(a^2-y^2)^(3/2) = 0

x*a*(y^(2/3)*a^(2/3)+a^(4/3)+y^(4/3))^(3/2)/(a^2-y^2)^(3/2)+a = 0

 

Download how_to_eliminate.mw

Notice: The reason I am asking the above, is becuase I was doing it this way: I first solve for from one equation, then use this result in the second equation (this is what one would do normally by hand). but this could result in many solutions and hard to know which to pick to match the book result. That is why I am thinking of using Elminate instead:

restart;

assume(x::real, y::real,a::real);
eq1:=x=-a/(1+c^2)^(3/2);
eq2:=y=a*c^3/(1+c^2)^(3/2);

x = -a/(c^2+1)^(3/2)

y = a*c^3/(c^2+1)^(3/2)

#brute force method
c_found:=Vector([solve(eq1,c)])

Vector(6, {(1) = sqrt((-a*x^2)^(2/3)-x^2)/x, (2) = -sqrt((-a*x^2)^(2/3)-x^2)/x, (3) = (1/2)*sqrt(2)*sqrt(I*sqrt(3)*(-a*x^2)^(2/3)-(-a*x^2)^(2/3)-2*x^2)/x, (4) = -(1/2)*sqrt(2)*sqrt(I*sqrt(3)*(-a*x^2)^(2/3)-(-a*x^2)^(2/3)-2*x^2)/x, (5) = (1/2)*sqrt(-(2*I)*sqrt(3)*(-a*x^2)^(2/3)-2*(-a*x^2)^(2/3)-4*x^2)/x, (6) = -(1/2)*sqrt(-(2*I)*sqrt(3)*(-a*x^2)^(2/3)-2*(-a*x^2)^(2/3)-4*x^2)/x})

map(x->simplify(subs(c=x,eq2),symbolic),c_found)

Vector(6, {(1) = y = -(1/4)*sqrt(2)*(I*a^(2/3)*sqrt(3)-a^(2/3)-2*x^(2/3))^(3/2), (2) = y = (1/4)*sqrt(2)*(I*a^(2/3)*sqrt(3)-a^(2/3)-2*x^(2/3))^(3/2), (3) = y = -((1/4)*I)*sqrt(2)*(I*a^(2/3)*sqrt(3)+a^(2/3)+2*x^(2/3))^(3/2), (4) = y = ((1/4)*I)*sqrt(2)*(I*a^(2/3)*sqrt(3)+a^(2/3)+2*x^(2/3))^(3/2), (5) = y = -(a^(2/3)-x^(2/3))^(3/2), (6) = y = (a^(2/3)-x^(2/3))^(3/2)})

 

 

Looking at result above, I think I can safely eliminate all y solutions with complex number I in them. This leaves the last two listed above (real y). Which is a little better than before.

Download how_to_eliminate_brute_force.mw

 

 

First 641 642 643 644 645 646 647 Last Page 643 of 2416