Skip to main content
1-Visitor
May 24, 2018
Question

Integration

  • May 24, 2018
  • 2 replies
  • 5004 views

Hi to all,

 

I am further experimenting with my Naval Architecture calculations in MC. 

 

In the attached MCP3 file, can anyone tell me why the integral returns what seems to be an infinite number of answers when the answer I expect to get is 50m^2?

 

Thanks,

 

Andy.

2 replies

16-Pearl
May 24, 2018

Your integral goes to WL(y,T,phi).  y is defined as a range variable of 100 points, so it returns 100 results.  

Replace y with a single value (5 m or similar) and you get one answer (50 m^2)

awibroe1-VisitorAuthor
1-Visitor
May 24, 2018

Any ideas how I can set this up to integrate area under WL?

 

As per attached where phi is not 0.

23-Emerald I
May 24, 2018

@awibroe wrote:

Any ideas how I can set this up to integrate area under WL?


I don't like your setup, but

Capture.PNG

25-Diamond I
May 24, 2018

One rule you should consider is NOT TO USE range varaibles for calculations!!

Use ranges for plotting, use ranges for indexing vectors and matrices and uses ranges for loops in a program. But please don't use ranges for anything else unless you really want to run into troubles!!!

awibroe1-VisitorAuthor
1-Visitor
May 24, 2018
Top advice Werner. I defined range variables to allow visualisation of the problem.

I’m still not quite there with a solution though. Ultimately I want to integrate the space inside function St(z) i.e. to the left of the vertical blue line. And up to a height of the function WL(z) ie the black line which may not be horizontal.
25-Diamond I
May 25, 2018

@awibroe wrote:

Ok but if I don't define y the integral returns an error. I have clearly missed the point, can you give me an example of what you mean?


You sure can't use a y in the limits of the outer integral over z. If you expect a numeric result, the limit of the leftmost integral have to be scalars.

Hasn't Fred already shown a possible solution?