I would like to do this program but I am stuck on a few things ... Can anyone help me? Items can be three, four, five, etc ...
baricent()
Prgm
InputStr "How many elements ?",str1
If str1="" Then
.............................. Place a cycle for to say: If the items are five then enter this data .....
InputStr "Enter A1",str2
InputStr "Enter A2",str3
InputStr "Enter A3",str4
InputStr "Enter A4",str5
InputStr "Enter A5",str6
InputStr "Enter D1",str7
InputStr "Enter D2",str8
InputStr "Enter D3",str9
InputStr "Enter D4",str10
InputStr "Enter D5",str11
Pause "M1=A1*D1"
Pause str2*str7
.....................
Mtot= .......
xG=....
yG=....
zG=...
Barycentre
14 posts
• Page 1 of 2 • 1, 2
Barycentre
You do not have the required permissions to view the files attached to this post.
-
marcoz
Niveau 3: MH (Membre Habitué)- Posts: 11
- Joined: 11 Dec 2011, 14:58
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: Ingegneria
Re: Barycentre
You have to do a for loop :
Then, I didn't really understand what you wanted to do
- Code: Select all
baricent()
Prgm
A:={} -- The list which is gonna contain the A elements
D:={} -- The list which is gonna contain the D elements
InputStr "How many elements ?",str1
For k,1,str1
InputStr "Enter A"&string(k),str2
A:=augment(A,{str2})
EndFor
For k,1,str1
InputStr "Enter D"&string(k),str2
D:=augment(D,{str2})
EndFor
EndPgrm
Then, I didn't really understand what you wanted to do
Bonjour
-
pierrotdu18Premium
Niveau 15: CC (Chevalier des Calculatrices)- Posts: 975
- Joined: 07 Nov 2013, 20:18
- Location: Paris V
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: MP* Lycée Henri IV
Re: Barycentre
I want to calculate the center of gravity of a structure in three dimensions...
Now I try and I'll know
Now I try and I'll know
-
marcoz
Niveau 3: MH (Membre Habitué)- Posts: 11
- Joined: 11 Dec 2011, 14:58
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: Ingegneria
Re: Barycentre
A structure un three dimensions? Defined by what? Your A points and your D points?...
Bonjour
-
pierrotdu18Premium
Niveau 15: CC (Chevalier des Calculatrices)- Posts: 975
- Joined: 07 Nov 2013, 20:18
- Location: Paris V
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: MP* Lycée Henri IV
Re: Barycentre
A represents the length / surface
D represents the density
A and D are data of the problem
I want to insert A and D according to the number of elements that have the structure (may be two, three or four, etc. ...)
I want him to calculate the mass of each element, knowing that the mass is given by M = D / A
Then I want to calculate the total mass .... What is given by M1 + M2 + M3 ......
and after this calculation the center of gravity
D represents the density
A and D are data of the problem
I want to insert A and D according to the number of elements that have the structure (may be two, three or four, etc. ...)
I want him to calculate the mass of each element, knowing that the mass is given by M = D / A
Then I want to calculate the total mass .... What is given by M1 + M2 + M3 ......
and after this calculation the center of gravity
-
marcoz
Niveau 3: MH (Membre Habitué)- Posts: 11
- Joined: 11 Dec 2011, 14:58
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: Ingegneria
Re: Barycentre
EDIT : It is not InputStr but Input, you must enter numbers, don't you?
- Code: Select all
baricent()
Prgm
A:={} -- The list which is gonna contain the A elements
D:={} -- The list which is gonna contain the D elements
M:={} -- The list which is gonna contain the M elements
result:=0 -- The result
InputStr "How many elements ?",str1
For k,1,str1
Input "Enter A"&string(k),str2
A:=augment(A,{str2})
EndFor
For k,1,str1
Input "Enter D"&string(k),str2
D:=augment(D,{str2})
EndFor
For k,1,str1
temp:=D[k]*A[k]
M:=augment(M,{temp})
EndFor
For k,1,dim(M)
result:=result+M[k]
EndFor
Disp result -- The sum of the Mk elements
EndPgrm
Last edited by pierrotdu18 on 15 Feb 2014, 13:26, edited 1 time in total.
Bonjour
-
pierrotdu18Premium
Niveau 15: CC (Chevalier des Calculatrices)- Posts: 975
- Joined: 07 Nov 2013, 20:18
- Location: Paris V
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: MP* Lycée Henri IV
Re: Barycentre
The center of gravity
Xg=[somm(xg^i* M^i) ] / M(total)
Yg=[somm(yg^i* M^i) ] / M(total)
Zg=[somm(zg^i* M^i) ] / M(total)
I only as data density and the length / surface of each single element of the structure
Xg=[somm(xg^i* M^i) ] / M(total)
Yg=[somm(yg^i* M^i) ] / M(total)
Zg=[somm(zg^i* M^i) ] / M(total)
I only as data density and the length / surface of each single element of the structure
-
marcoz
Niveau 3: MH (Membre Habitué)- Posts: 11
- Joined: 11 Dec 2011, 14:58
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: Ingegneria
Re: Barycentre
I wanted to ask this program:
How many elements are there?
ANSWER: for example, 5
If there are five elements creates a 2x5 matrix and enter the data
A1 D1
A2 D2
A3 D3
A4 D4
A5 D5
When I ask the program:
Calculate the mass of each element:
A1 * D1 = M1
A2 * D2 = M2
A3 * A3 = M3
A4 * D4 = M4
A5 * D5 = M5
I ask the program calculate the total mass
M (tot) = M1 + M2 + M3 + M4 + M5
I ask the program to insert an array always 3 x n.elementi and insert the centroid of each element
xg1 yg1 zg1
xg2 yg2 zg2
xg3 yg3 zg3
xg4 yg4 zg4
xg5 yg5 zg5
After I asked him: Now compute the centroid
Xg=[somm(xg^i* M^i) ] / M(total)= xg1*m1+xg2*m2+xg3*m3+xg4*m4+xg5*m5 / M(tot)
Yg=[somm(yg^i* M^i) ] / M(total)= .................
Zg=[somm(zg^i* M^i) ] / M(total)=.................
How many elements are there?
ANSWER: for example, 5
If there are five elements creates a 2x5 matrix and enter the data
A1 D1
A2 D2
A3 D3
A4 D4
A5 D5
When I ask the program:
Calculate the mass of each element:
A1 * D1 = M1
A2 * D2 = M2
A3 * A3 = M3
A4 * D4 = M4
A5 * D5 = M5
I ask the program calculate the total mass
M (tot) = M1 + M2 + M3 + M4 + M5
I ask the program to insert an array always 3 x n.elementi and insert the centroid of each element
xg1 yg1 zg1
xg2 yg2 zg2
xg3 yg3 zg3
xg4 yg4 zg4
xg5 yg5 zg5
After I asked him: Now compute the centroid
Xg=[somm(xg^i* M^i) ] / M(total)= xg1*m1+xg2*m2+xg3*m3+xg4*m4+xg5*m5 / M(tot)
Yg=[somm(yg^i* M^i) ] / M(total)= .................
Zg=[somm(zg^i* M^i) ] / M(total)=.................
Last edited by marcoz on 15 Feb 2014, 13:27, edited 1 time in total.
-
marcoz
Niveau 3: MH (Membre Habitué)- Posts: 11
- Joined: 11 Dec 2011, 14:58
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: Ingegneria
Re: Barycentre
Did you try the code I wrote for you?
It gives you M(total), I think you would be able to do the end as there is only one step left.
It gives you M(total), I think you would be able to do the end as there is only one step left.
Bonjour
-
pierrotdu18Premium
Niveau 15: CC (Chevalier des Calculatrices)- Posts: 975
- Joined: 07 Nov 2013, 20:18
- Location: Paris V
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: MP* Lycée Henri IV
Re: Barycentre
Thank you very much .... After I try and I'll know ... Now we all go to eat ...
-
marcoz
Niveau 3: MH (Membre Habitué)- Posts: 11
- Joined: 11 Dec 2011, 14:58
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: Ingegneria
14 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: ClaudeBot [spider] and 2 guests