vs140580

490 Reputation

8 Badges

5 years, 16 days

MaplePrimes Activity


These are questions asked by vs140580

Given a graph G and a vertex v find the shortest self returning walk from that visits all vertices starts at v and comes back to v.

In the below graph the shortest self returning walk which visits all vertices and comes back to first to started vertex

A function which takes a graph G  and  vertex v as input and returns the length of the  shortest self returning walk of that vertex in the below example 10

 

I am sorry for the error i just saw the change after reading more in deep

 

For the vertex 7 the shortest self returning walk from that visits all vertices starts at 7 and comes back to 7 It is a walk so edges can repeat

 

The closed walk which passes through all vertices minimum from vertex 7 is so length 10. is what it means

so it returns 10.

A function which takes a matrix as input and k the number of places to round to Given a matrix

 

Matrix(17, 17, [[0, 1.67136411, 3.04642520, 3.03792037, 4.46305818, 4.48953189, 11.44947182, 11.44363094, 5.99694026, 10.05030814, 10.04436470, 12.86806872, 12.86675621, 8.65792026, 11.48220112, 11.47942388, 10.13243670], [1.67136411, 0, 1.37506109, 1.36655626, 2.79169407, 2.81816777, 9.77810770, 9.77226682, 4.32557615, 8.37894403, 8.37300059, 11.19670460, 11.19539209, 6.98655615, 9.81083701, 9.80805976, 8.46107258], [3.04642520, 1.37506109, 0, 2.74161735, 1.41663298, 4.19322886, 8.40304661, 8.39720573, 5.70063724, 7.00388294, 6.99793950, 12.57176570, 12.57045318, 5.61149506, 11.18589810, 11.18312085, 9.83613367], [3.03792037, 1.36655626, 2.74161735, 0, 4.15825033, 1.45161152, 11.14466396, 11.13882308, 2.95901989, 9.74550028, 9.73955684, 9.83014835, 9.82883584, 8.35311240, 8.44428075, 8.44150350, 7.09451633], [4.46305818, 2.79169407, 1.41663298, 4.15825033, 0, 5.60986184, 6.98641363, 6.98057275, 7.11727022, 5.58724996, 5.58130652, 13.98839867, 13.98708616, 4.19486208, 12.60253107, 12.59975383, 11.25276665], [4.48953189, 2.81816777, 4.19322886, 1.45161152, 5.60986184, 0, 12.59627548, 12.59043460, 1.50740837, 11.19711180, 11.19116836, 8.37853683, 8.37722432, 9.80472392, 6.99266923, 6.98989199, 5.64290481], [11.44947182, 9.77810770, 8.40304661, 11.14466396, 6.98641363, 12.59627548, 0, 5.58361857, 14.10368385, 6.98420414, 4.19901549, 20.97481231, 20.97349980, 5.59181627, 19.58894471, 19.58616747, 18.23918029], [11.44363094, 9.77226682, 8.39720573, 11.13882308, 6.98057275, 12.59043460, 5.58361857, 0, 14.09784297, 4.19891293, 6.98410159, 20.96897143, 20.96765892, 5.59130081, 19.58310383, 19.58032659, 18.23333941], [5.99694026, 4.32557615, 5.70063724, 2.95901989, 7.11727022, 1.50740837, 14.10368385, 14.09784298, 0, 12.70452017, 12.69857674, 6.87112846, 6.86981595, 11.31213229, 5.48526086, 5.48248361, 4.13549644], [10.05030814, 8.37894403, 7.00388294, 9.74550028, 5.58724996, 11.19711180, 6.98420414, 4.19891293, 12.70452017, 0, 5.59817917, 19.57564863, 19.57433612, 6.99097994, 18.18978103, 18.18700379, 16.84001661], [10.04436470, 8.37300059, 6.99793950, 9.73955684, 5.58130652, 11.19116836, 4.19901549, 6.98410159, 12.69857673, 5.59817917, 0, 19.56970519, 19.56839268, 6.99056705, 18.18383759, 18.18106035, 16.83407317], [12.86806871, 11.19670460, 12.57176569, 9.83014835, 13.98839867, 8.37853683, 20.97481232, 20.96897144, 6.87112846, 19.57564864, 19.56970520, 0, 5.47162962, 18.18326076, 6.88344719, 4.18501750, 5.53368276], [12.86675620, 11.19539209, 12.57045318, 9.82883584, 13.98708616, 8.37722432, 20.97349980, 20.96765892, 6.86981595, 19.57433612, 19.56839268, 5.47162962, 0, 18.18194824, 4.18355276, 6.88198245, 5.53331719], [8.65792026, 6.98655615, 5.61149506, 8.35311240, 4.19486208, 9.80472392, 5.59181627, 5.59130081, 11.31213229, 6.99097994, 6.99056705, 18.18326075, 18.18194824, 0, 16.79739315, 16.79461591, 15.44762873], [11.48220112, 9.81083701, 11.18589810, 8.44428075, 12.60253108, 6.99266923, 19.58894472, 19.58310384, 5.48526086, 18.18978104, 18.18383760, 6.88344719, 4.18355276, 16.79739316, 0, 5.57088509, 6.91955036], [11.47942387, 9.80805976, 11.18312085, 8.44150350, 12.59975383, 6.98989199, 19.58616748, 19.58032660, 5.48248361, 18.18700380, 18.18106036, 4.18501750, 6.88198245, 16.79461592, 5.57088509, 0, 6.92064952], [10.13243670, 8.46107258, 9.83613367, 7.09451633, 11.25276665, 5.64290481, 18.23918030, 18.23333942, 4.13549644, 16.84001662, 16.83407318, 5.53368276, 5.53331719, 15.44762874, 6.91955036, 6.92064952, 0]])

 

Convert all the digits in the matrix to k decimal places where k I can specify After converting to decimal places it should not show zero's at the end of the decimal places. Kind help

Let L be a list like

L:=[[3, 2], [2, 1], [1, 2], [1, 2], [2, 3], [2, 1], [1, 2], [1, 1], [2, 1], [1, 2], [1, 1], [2, 1], [1, 1], [1, 3], [1, 2], [2, 1], [1, 3], [1, 3], [1, 3], [1, 2], [2, 2], [2, 3]]

Now we consider [3,1] and [1,3] as same 

First we form a list gives us 

Lk:=[[[1,3],4],[[1.2],11],[[2,3],3],[[2,2],1],[[1,1],3]]

That is [1,3] appears 4 times in L

[1,2] appears 11 times in L

[2,3] appears 3 times in L

[1,1] appears.3 times in L

[2,2] appears 1 times in L

now we do addtion in [1,3] which is 1+3=4 therefore [[1,3],4] become [4,4]

[2,2] becomes 2+2=4 therefore [[2,2],1] is [4,1]

[[1,2],11] become [3,11]

[[2,3],3] becomes [5,3]

[[1,1],3] becomes [2,3]

So new list is [[4,4],[3,11],[5,3],[2,3],[4,1]]

so answer is from [4,4] we get 4 *4 , from [3,11] we get 3*11 , from [5,3] we get 5*3 and from [2,3] we get 2*3 from [4,1] we get 4*1

final required answer is (4*4)*(3*11)*(5*3)*(2*3)*(4*1)  =190080

Any list L like above if given kind help with a function which can do the above operation and give the final answer that is in above case 190080

From a list of strings say

L:=[k$1,y$23,f$25,........]

A particular type of delimiter will their which is  common to all elements in the list the right side is always a number 

The function takes the list, and the delimiter as input

Then it outputs a list of 

Numbers which is on the right side of the delimiter 

Output will be like 

[1,23,25,...]

The delimiters could be a space 

Or 

Space on both sides of dollars

That is in understanding space should also be considered in delimiter that is anything significant 

Let A:=[1,2,1,6,6,2,1,1,1,4,5,2,4,5,6,7,1] say

Then I want find the

1) number of times each of the each of the element occurs
2) To multiple the number by the number of times it occurs

3) Then to multple the all these that is in the above

(3*(2)) *(3*(6))*(3*(2))*(2*(4))*(2*(5))*(1*(7))*(5*(1)) = need this value

Here we can observe 3 is the number of times 2 occurs 

3 is the number of times 6 occurs

similiary 5 is the number of times 1 occurs so on

Kind help

3 4 5 6 7 8 9 Last Page 5 of 24