vs140580

135 Reputation

One Badge

1 years, 44 days

MaplePrimes Activity


These are replies submitted by vs140580

Great answer excellent 

@Carl Love no I changed the phyton output to string as my input will not be accepted directly by maple 

@Carl Love Now if I have a string like

A:="[[0,1,0,0,0,0,0,0,0,0,0,0,0],[1,0,1,0,0,0,0,0,0,0,0,0,1],[0,1,0,1,0,0,0,0,0,0,0,0,0],[0,0,1,0,1,0,0,1,0,0,0,0,0],[0,0,0,1,0,1,0,0,0,0,0,0,0],[0,0,0,0,1,0,1,0,0,0,0,0,0],[0,0,0,0,0,1,0,1,1,0,0,0,0],[0,0,0,1,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,0,1,0,0,1,1,1,0],[0,0,0,0,0,0,0,0,1,0,0,0,0],[0,0,0,0,0,0,0,0,1,0,0,0,0],[0,0,0,0,0,0,0,0,1,0,0,0,0],[0,1,0,0,0,0,0,0,0,0,0,0,0]]"

I want convert it to as a  matrix say

B:=[[0,1,0,0,0,0,0,0,0,0,0,0,0],[1,0,1,0,0,0,0,0,0,0,0,0,1],[0,1,0,1,0,0,0,0,0,0,0,0,0],[0,0,1,0,1,0,0,1,0,0,0,0,0],[0,0,0,1,0,1,0,0,0,0,0,0,0],[0,0,0,0,1,0,1,0,0,0,0,0,0],[0,0,0,0,0,1,0,1,1,0,0,0,0],[0,0,0,1,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,0,1,0,0,1,1,1,0],[0,0,0,0,0,0,0,0,1,0,0,0,0],[0,0,0,0,0,0,0,0,1,0,0,0,0],[0,0,0,0,0,0,0,0,1,0,0,0,0],[0,1,0,0,0,0,0,0,0,0,0,0,0]]

How to do this

kind help

 

@Carl Love 

A:= [[0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [1. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1.]
 [0. 1. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 1. 0. 1. 0. 0. 1. 0. 0. 0. 0. 0.]
 [0. 0. 0. 1. 0. 1. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 1. 0. 1. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 1. 0. 1. 1. 0. 0. 0. 0.]
 [0. 0. 0. 1. 0. 0. 1. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 1. 0. 0. 1. 1. 1. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0.]
 [0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]]

This type of matrix is my input say

I want

A:=[[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]

This type of matrix is my output

can you help sir

But this is in general

In the first set instead of , it is ". " and at the end of each ] no ], inside

DistE := proc(v, e, g::GRAPHLN)

local Adj;

Adj := AdjacencyMatrix(g);

if Distance(e[1], v) < Distance(e[2], v) then

return 1;

else return 0;

end if;

end proc;

G := PetersenGraph();

V := Vertices(G);

V := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

E := Edges(G);

E := {{1, 2}, {1, 5}, {1, 6}, {2, 3}, {2, 9}, {3, 4}, {3, 7}, {4, 5}, {4, 10}, {5, 8}, {6, 7}, {6, 10}, {7, 8}, {8, 9}, {9, 10}} DrawGraph(G);

DistE(V[1], E[3], G);

 

Error, (in DistE) invalid input: GraphTheory:-Distance expects its 1st argument, G, to be of type GRAPHLN, but received 1

I am getting the above error kind help to correct it.

 

@Carl Love

Can you help with a small procedure with the the above logic I will check with a graph

Kind help sir

I apologize to disturb you sir help once free sir 

S I understood 

@lcz I am using worksheet mode

I changed it to proc and did it 

@lcz 

 

Error, invalid arrow procedure

(u,G)->local j; it is saying

 

@Carl Love 

 

Sir if possible kind with a code if possible for help give a graph as g and a vertex v like above

The fuction should return the number of vertices at distance 2 from the vertex v in that given graph g.

If possible kind help sir.

 

I thank you for your previous code.

@mmcdara I want to do for polynomial of degree n too. Where number of independent variables is 9 as above. If p values are higher I want learn that too sir. In the above case. 

Then how to find value of p. 

That is P value as in statistics

I am sorry for the disturbance in your busy schedule 

@mmcdara if the p values of the fit are >0.1 then I have to do in polynomial fit of a degree say n of choice where 9 independent variables

 

How to compute p values using program in maple is another question comes here now 

@mmcdara

 

Y=a0+a1*x1+a2*x2+....... +a9*x9

The output is from maple

 

@mmcdara   

X := Vector([64.00, 70.00, 112.00, 96.00, 112.00, 116.00, 116.00, 50.00, 340.00, 56.00, 80.00, 82.00, 56.00, 102.00, 142.00, 102.00, 46.00, 44.00, 82.00, 86.00, 88.00, 128.00, 130.00, 38.00, 34.00, 74.00], datatype = float);


Y := Vector([514.30, 409.30, 463.90, 399.60, 643.80, 524.50, 427.40, 265.30, 998.70, 314.40, 536.40, 503.10, 395.90, 457.20, 619.10, 464.00, 408.30, 274.00, 442.90, 473.80, 365.40, 568.00, 438.70, 220.00, 277.70, 457.20], datatype = float);

 

Y is the dependent variable and X1 to X9 are independent variables


ls := PolynomialFit(4, X, Y, v, summarize = true);


Summary:
----------------
Model: -438.92373+29.636011*v-.35993203*v^2+.18424374e-2*v^3-.29517721e-5*v^4
----------------
Coefficients:
              Estimate    Std. Error    t-value  P(>|t|)
Parameter 1   -438.9237    370.7291     -1.1839   0.2497
Parameter 2    29.6360     16.3053       1.8176   0.0834
Parameter 3   -0.3599      0.2357       -1.5271   0.1417
Parameter 4    0.0018      0.0013        1.4095   0.1733
Parameter 5   -0.0000      0.0000       -1.3437   0.1934
----------------
R-squared: 0.8238, Adjusted R-squared: 0.7902

 

In the above it is only for ordinary polynomial fit I want such a summary for Multivariate Polynomial fit here I mean one dependent variable and more than one intependent variable. For any given specific degree n . I want the p-values,R,R-squared etc like above table and the  parameter estimates etc

 

Say the data below

X1 := Vector([64.00, 70.00, 112.00, 96.00, 112.00, 116.00, 116.00, 50.00, 340.00, 56.00, 80.00, 82.00, 56.00, 102.00, 142.00, 102.00, 46.00, 44.00, 82.00, 86.00, 88.00, 128.00, 130.00, 38.00, 34.00, 74.00], datatype = float);

X2:=Vector([70.00,80.00,127.00,115.00,134.00,137.00,138.00,58.00,397.00,62.00,86.00,96.00,64.00,123.00,169.00,124.00,50.00,44.00,100.00,99.00,100.00,149.00,154.00,39.00,33.00,83.00],datatype=float):

X3:=Vector([182.00,180.00,284.00,244.00,292.00,300.00,300.00,146.00,892.00,150.00,192.00,214.00,144.00,264.00,354.00,270.00,116.00,110.00,220.00,222.00,240.00,324.00,408.00,90.00,82.00,204.00],datatype=float):

X4:=Vector([2.75,3.58,5.36,3.97,4.58,4.81,4.83,2.25,15.45,2.83,4.28,3.53,2.83,4.42,6.08,4.21,2.28,2.67,3.71,3.75,3.83,5.56,4.22,2.61,2.25,2.90],datatype=float):

X5:=Vector([364.00,406.00,632.00,586.00,692.00,698.00,708.00,320.00,2050.00,316.00,402.00,492.00,326.00,636.00,848.00,662.00,242.00,204.00,546.00,498.00,514.00,746.00,868.00,182.00,148.00,420.00],datatype=float):

X6:=Vector([36.50,36.00,56.66,43.66,52.66,55.00,54.67,27.00,168.75,29.33,41.66,40.33,29.00,47.00,63.67,46.58,24.66,26.66,38.58,42.66,47.50,61.00,68.50,22.00,21.00,38.42],datatype=float):

X7:=Vector([5.39,6.73,10.60,8.57,9.70,10.17,10.20,4.22,30.77,5.40,8.30,7.23,5.37,8.90,13.07,8.99,4.43,4.66,7.46,7.70,8.19,11.66,9.02,4.47,3.87,6.17],datatype=float):

X8:=Vector([13.81,16.28,26.22,23.20,26.60,27.50,27.60,10.95,79.38,12.70,18.81,19.20,13.02,24.45,34.62,24.38,10.55,9.66,19.44,20.10,19.96,30.50,27.78,8.73,7.52,16.63],datatype=float):

X9:=Vector([83.69,116.30,182.44,167.70,185.84,190.45,193.84,70.94,554.58,86.75,133.51,131.06,92.30,174.47,255.72,176.22,69.52,61.50,144.22,135.67,131.70,214.45,165.20,66.14,50.13,106.50],datatype=float):

 

Y := Vector([514.30, 409.30, 463.90, 399.60, 643.80, 524.50, 427.40, 265.30, 998.70, 314.40, 536.40, 503.10, 395.90, 457.20, 619.10, 464.00, 408.30, 274.00, 442.90, 473.80, 365.40, 568.00, 438.70, 220.00, 277.70, 457.20], datatype = float);

 

 

 

 

 

@Kitonum I want each output picked one by one as if my number of iterative cartesian products become 10 it will be difficult so i want to exceutive only until a certain point

 

1 2 3 Page 2 of 3