Skip to main content
16-Pearl
June 12, 2020
Solved

Optimisation problem: Find the best N pts (x,y) to meet criteria?

  • June 12, 2020
  • 2 replies
  • 3937 views

to all,

A bit of an open question as I do not know how to go about solving the following – if it can be done at all

I have a curve C1, define between [x1,xn] and I would like to create a curve C2 using N pts so that some criteria are met. Essentially is a “double optimisation” problem. Consider the following; I want C2 to be made of p points p(xi,yi) – Generally a few points (say no more than 10)

Criteria 1:-  xn > xn-1 > x1 . xn and x1 are given

Criteria 2: In a given x range [xn,x+1] rms C1 ~ rms C2 . Within a given a tolerance (say +/-1%).

 

Is there of way of using Mathcad to find the best pair of points to meet criteria #2

Does it require some sort of loop, or is there some built-in optimisation tool one can use

Attached a mcad 15 file swith some preliminary stuff - Not much

Best answer by terryhendicott

Hi,

 

Is this what you mean by finding the y values?

Capture.JPG

2 replies

16-Pearl
June 12, 2020

I think your explanation could be expanded as it's not fully clear to me what you are after.  From what I 'think' you're asking, aren't you just trying to get points off of C1?  If your criteria is rms(c1)=rms(c2) then c2=c1 is your obvious answer, you just want a smaller set of points along a given interval.  You could fit a b-spline and grab spaced points along c1.  Or other interpolation type.  Not exactly what you asked for but I think gets your end goal.  Otherwise there are an infinite number of solutions where rms(c2) = rms(c1).

16-Pearl
June 12, 2020

Thanks for the reply. I appreciate I wasn’t clear about what I am trying to do. Still trying to put it in words 

imagine the following. Using the Simpson method for integration by splitting a range [a,b] into n equivalent length. Let’s say I split this range into 2 rectangles. It’s fairly easy to find the “middle” point so that the area A of each rectangle is close to the exact integral 

 

what I am thinking at the moment is if there is a way of “automatically” finding the best positions of say N points so that the area in each “bin” is a close match. If the raw data as a x increment =1 over say [10-2000] range then choosing 1990 points would be an exact match

 

With the attached diagram

I split the range into 3 areas . I therefore "decided" I want to use a vector {f1,f2,f3,f4} in all cases f1 and f4 are "fixed" i.e. decided by the user. I therefore will have a vector y={y1,y2,y3,y4}

Is there a way of finding the best values for (f2,y2) & (f3,y3) so that

area sqrt(A1) ~ sqrt(A'1); sqrt(A2) ~ sqrt(A'2) and sqrt(A3)~ sqrt(A'3) where the A areas from Curve C1 and A' the areas from the points I am trying to establish

 

also added a mcad 15 example but needed 5 pts to "look" good. Not checked the areas,etc

21-Topaz II
June 12, 2020

Hi,

 

"what I am thinking at the moment is if there is a way of “automatically” finding the best positions of say N points so that the area in each “bin” is a close match"

 

look up "Gaussian quadrature" on the internet for exactly this problem and solution.

 

Cheers

Terry

21-Topaz II
June 13, 2020

Hi,

Are you ultimately after the integral of whole set of data.  A similar technique can be used to determine integral (area) between any two data points.

 

Capture.JPG

16-Pearl
June 13, 2020

Thanks. Not really as the (sqrt of the) integral is a given i.e easy to set-up I am using the same method as you kindly offered but use a log-log integration. I also have a method somewhere  which fits a cspline to the data first and then do integration.

 

Did some searches on the Gauss integration-attached pdf. It is what I am trying to do but I do not know if the "solving" can be done in mcad. I suspect it can. Might be a minimisation problem! I think I started laying out the problem  a bit better and the "key" step is how to use and set up the 'Given' block

21-Topaz II
June 13, 2020

Hi,

 

Is this what you mean by finding the y values?

Capture.JPG