Home 
Search 
Today's Posts 
#1




MathsIntegration
Dear all, would appreciate if anyone can help me with this
I know nuts about excel, not to mention its vba programming. I am trying to write a program using excel to calculate geometrica properties of any arbitrary shape, namely perimeter, enclosed are etc...I have several queries about how to start, listed as below : 1) the user to draw the shape required, either by autoshapes or an other means, but the important thing is that i need the program t capture the points that the user has clicked, for reference a coordinate points. From here i can do vector calculus to work out th perimeter, using the function { INTEGRAL F(r) dr}(*ignore this functio if not sure*). But how do i program it (vba)? 2) Subsequently using the points captured i need to perform variou integrations again to obtain the other properties. The Main problem i how to get the program to perform integration? Bear in mind that som of these calculations includes double integrals. I know that this may be tough if you do not have mathematics knowledge but i will greatly appreciate if anyone can help with the 2 problem listed. That is, (1) how to capture the points, (2) perfor mathematical integration. Please try to help me, thanks in advanc  Message posted from http://www.ExcelForum.com 
#2




MathsIntegration
cigarette wrote:
Dear all, would appreciate if anyone can help me with this I know nuts about excel, not to mention its vba programming. I am trying to write a program using excel to calculate geometrical properties of any arbitrary shape, namely perimeter, enclosed area etc...I have several queries about how to start, listed as below : 1) the user to draw the shape required, either by autoshapes or any other means, but the important thing is that i need the program to capture the points that the user has clicked, for reference as coordinate points. From here i can do vector calculus to work out the perimeter, using the function { INTEGRAL F(r) dr}(*ignore this function if not sure*). But how do i program it (vba)? 2) Subsequently using the points captured i need to perform various integrations again to obtain the other properties. The Main problem is how to get the program to perform integration? Bear in mind that some of these calculations includes double integrals. I know that this may be tough if you do not have mathematics knowledge, but i will greatly appreciate if anyone can help with the 2 problems listed. That is, (1) how to capture the points, (2) perform mathematical integration. Please try to help me, thanks in advance  Message posted from http://www.ExcelForum.com/ For the autoshapes: use the .Nodes property of a Shape object. This gives you a ShapeNodes collection. The .Points property of a Node gives you the coordinates. More info in Excel/VBA help. For the integrals: http://www.cheresources.com/integrals_in_excel.shtml You can google others using the following keywords: excel vba integrals  To toppost is human, to bottompost and snip is sublime. 
#3




MathsIntegration
I know nuts about excel, not to mention its vba programming.
Hello. Just some thoughts. In the vba editor, you may want to add a "Watch" to something like "ActiveSheet.Shapes(1)" This way, when you are stepping thru your code, you can see what might be available for your shape. It can be confusing, so this may help. Also be aware that the coordinates that Excel uses on the sheet may be different than what you expect. You may want to add a Unit Square, but the coordinates that Excel uses on the sheet for each corner may be different. This would give you a much larger "Area" in your calculations. I don't do this often, but I "think" the Y axes scaling is different then the X axes scaling. Maybe someone can jump in with some experience on that. I am not sure if there is a way to convert Node points / Vertices back to the correct "points" that the original user entered. Here's a short demo to add a triangle, and uses the ".Vertices" property. Notice that the extracted vertices are slightly different. I believe this is due to rounding, and would affect your calculations also. Notice also the ratio of 25/100 is slightly different then 24.75 / 99.75 that is stored. All told, I don't think you will get an accurate reading of Area, etc. Sub Demo() Dim Shp(1 To 4, 1 To 2) As Single Dim v Shp(1, 1) = 25 Shp(1, 2) = 100 Shp(2, 1) = 100 Shp(2, 2) = 150 Shp(3, 1) = 150 Shp(3, 2) = 50 ' Back to first point Shp(4, 1) = 25 Shp(4, 2) = 100 ActiveSheet.Shapes.AddPolyline Shp '// Now, get Vertices v = ActiveSheet.Shapes(1).Vertices Debug.Print v(1, 1); v(1, 2) Debug.Print v(1, 1) / v(1, 2) End Sub Returns: 24.75 99.75 0.2481203 If you are doing many of these with double integrals, you may want to consider a dedicated math program. It is difficult in Excel to do similar things. For example, if we make a Unit Pentagon... shp = Pentagon; we could ask for the vertices... Vertices[shp] {(1/4)*(1 + Sqrt(5)),(1/2)*Sqrt((1/2)*(5 + Sqrt(5)))}, {((1/4))*(1 + Sqrt(5)),(1/2)*Sqrt((1/2)*(5  Sqrt(5)))} ...etc And calculate it's area... Area[shp] (5*(1 + Sqrt(5)))/(4*Sqrt(2*(5  Sqrt(5)))) HTH Dana DeLouis "cigarette " wrote in message ... Dear all, would appreciate if anyone can help me with this I know nuts about excel, not to mention its vba programming. I am trying to write a program using excel to calculate geometrical properties of any arbitrary shape, namely perimeter, enclosed area etc...I have several queries about how to start, listed as below : 1) the user to draw the shape required, either by autoshapes or any other means, but the important thing is that i need the program to capture the points that the user has clicked, for reference as coordinate points. From here i can do vector calculus to work out the perimeter, using the function { INTEGRAL F(r) dr}(*ignore this function if not sure*). But how do i program it (vba)? 2) Subsequently using the points captured i need to perform various integrations again to obtain the other properties. The Main problem is how to get the program to perform integration? Bear in mind that some of these calculations includes double integrals. I know that this may be tough if you do not have mathematics knowledge, but i will greatly appreciate if anyone can help with the 2 problems listed. That is, (1) how to capture the points, (2) perform mathematical integration. Please try to help me, thanks in advance  Message posted from http://www.ExcelForum.com/ 
#4




MathsIntegration
I don't do this that often, so I may have been off a little. This draws a
400 "unit" square in the upper left corner of the sheet. Looks like the yaxes "is" in proportion to the xaxes. However, the display "rounded" 400 to 399.75, which causes a 199.9375 difference in the calculated area. Don't know if this is useful, but something to keep in mind. Debug results: 0 0 399.75 0 399.75 399.75 0 399.75 0 0 ? 400^2  399.75^2 199.9375 Sub Square_400_Units() Dim Shp(1 To 5, 1 To 2) As Single Dim v Dim j Shp(1, 1) = 0 Shp(1, 2) = 0 Shp(2, 1) = 400 Shp(2, 2) = 0 Shp(3, 1) = 400 Shp(3, 2) = 400 Shp(4, 1) = 0 Shp(4, 2) = 400 ' Back to first point Shp(5, 1) = 0 Shp(5, 2) = 0 ActiveSheet.Shapes.AddPolyline Shp '// Now, get Vertices v = ActiveSheet.Shapes(1).Vertices For j = 1 To 5 Debug.Print v(j, 1); v(j, 2) Next End Sub <snip 
#5




MathsIntegration
Thanks, u guys are great.
i'll try to work these out and ask if i have furthermore questions. Thanks a million, cheer  Message posted from http://www.ExcelForum.com 
Reply 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Forum  
excel maths  Excel Discussion (Misc queries)  
Maths  Excel Discussion (Misc queries)  
Maths In Excel  Help Needed!  Excel Discussion (Misc queries)  
Maths Fonts  Excel Discussion (Misc queries)  
Maths Fonts  Excel Discussion (Misc queries) 