Remember Me?

 cigarette external usenet poster First recorded activity by ExcelBanter: Jul 2004 Posts: 1 Maths-Integration

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
co-ordinate 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. --
Message posted from http://www.ExcelForum.com

 Amedee Van Gasse[_3_] external usenet poster First recorded activity by ExcelBanter: Jul 2004 Posts: 102 Maths-Integration

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
co-ordinate 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. ---
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.

For the integrals: http://www.cheresources.com/integrals_in_excel.shtml
You can google others using the following keywords: excel vba integrals

--
To top-post is human, to bottom-post and snip is sublime.
 Dana DeLouis[_3_] external usenet poster First recorded activity by ExcelBanter: Nov 2008 Posts: 690 Maths-Integration

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

'// 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
co-ordinate 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. ---
Message posted from http://www.ExcelForum.com/

 Dana DeLouis[_3_] external usenet poster First recorded activity by ExcelBanter: Nov 2008 Posts: 690 Maths-Integration

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
y-axes "is" in proportion to the x-axes. 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

'// 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

 cigarette[_2_] external usenet poster First recorded activity by ExcelBanter: Jul 2004 Posts: 1 Maths-Integration

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

 Thread Tools Search this Thread Show Printable Version Search this Thread: Advanced Search Display Modes Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Posting Rules Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Similar Threads Thread Thread Starter Forum Replies Last Post Cyclops Excel Discussion (Misc queries) 7 January 5th 10 06:07 PM Mohamed Rifan Excel Discussion (Misc queries) 4 April 25th 09 04:10 AM Keir FM Excel Discussion (Misc queries) 2 December 5th 07 10:41 PM Sue Excel Discussion (Misc queries) 4 October 31st 05 01:56 AM Sue Excel Discussion (Misc queries) 2 October 25th 05 11:39 AM

All times are GMT +1. The time now is 04:29 AM. Copyright ©2004-2019 ExcelBanter.