0

this might be a basic question to you guys but me having very limited(near to none) applied math experience I am not sure to figure this out rightly.

I've two kind of curves cubic and quadratic and I need a function to randomize them. say for e.g I've cubic curve with 4 points than if I feed this 4 points to this function than it should be able to generate random curves based on this which are not necessarily need to be similar to this but should not weird either. basically it should follow normal distribution.

Edit 1: by 4 point I meant the visual representation of cubic curve achieved through these points.

Edit 2: here is the link of what I'm talking about https://docstore.mik.ua/orelly/java-ent/jfc/ch04_04.htm.

Edit 3: After pointed out by daniel I'm providing more detail here to make it clear to understand. its about bezier curve and its control points.

thanks in advance

  • Would be easier to address if you gave more explicit details for a particular example. As worded this is a bit vague and difficult (at least for me) to guess what is actually wanted. – Daniel Lichtblau Jan 20 '18 at 16:47
  • yeah. by 3 point I meant the visual representation of cubic curve achieved through these points. I'm editing the same in question – hi0001234d Jan 20 '18 at 16:49
  • I'm wondering if you mean "quartic" (= degree 4) when using the term "quadratic" (where degree is 2)? Also, four points are required to determine a cubic of the form y=a*x^3+b*x^2+c*x+d. Again, what would help is an explicit set of points to start with and, if possible, a picture of what curve you have and another of a "reasonable" random variant. – Daniel Lichtblau Jan 20 '18 at 16:55
  • Hello Daniel sorry for confusing you. I miss placed it by the way by quadratic I mean 2 degree and 3 degree for cubic. here is the link of what I'm talking about https://docstore.mik.ua/orelly/java-ent/jfc/ch04_04.htm. – hi0001234d Jan 20 '18 at 17:00
  • So basically I need a way to randomize that curves which can be represented by control points – hi0001234d Jan 20 '18 at 17:02
  • The term "control points" makes me think you have in mind Bezier curves rather than curves that go through a particular set of points. Either way, one approach might be to take a given set and return a new set which is a random perturbation of the original, according to some distribution parameters for mean and variance. These new points would determine a new curve (either as control points using Bezier curvees, or as actual points using e.g, Lagrange interpolation). – Daniel Lichtblau Jan 20 '18 at 17:07
  • Thank Daniel, that makes sense and yes you are right its about bezier curves and control points. if you can point me to some example than it would be great but thanks in either way. – hi0001234d Jan 20 '18 at 17:14
  • 1
    Are you sure this is the right forum to ask this question as there is no indication that you even have access to a copy of Mathematica. No attempts at Mathematica code are shown nor is a single Mathematica function even mentioned. This is not to say that this is not a good question. I just don't see any indication that you're at the desired forum. – JimB Jan 20 '18 at 17:33
  • Check refguide page (Help > Documentation) for BezierFunction. First item in Basic Examples uses the control points pts = {{0, 0}, {1, 1}, {2, 0}, {3, 2}};.You could then alter the input e.g. as newpts = pts + RandomVariate[NormalDistribution[0, .1], Dimensions[pts]]; – Daniel Lichtblau Jan 20 '18 at 17:36
  • Thanks daniel for further explanation. Yeah @JimB you are right I didn't have access to Mathematica and I think I should have better asked it on math SE. anyway I just land here on an other question relating to this and just asked, my apologies.

    by the way Daniel you did nice explanation that can help me a bit because I've to code it in java so I'm not going to get same functions to use but thanks. basically I needed math equations

    – hi0001234d Jan 20 '18 at 17:41
  • Okay, glad this was of some help (I should have realized it was intended for a different site). I voted to migrate it to math.se; someone there can help with the conversion to actual equations. From what I can remember it's not too hard (I once had to convert the Newell teapot patches to Bezier surfaces I think) but now I'd need to look it all up. – Daniel Lichtblau Jan 20 '18 at 17:50
  • Thanks a lot for migration vote. In the mean time I can try this in matlab which I have access to and by the way I need this for implementation in java to solve mutation problem in genetic algorithm – hi0001234d Jan 20 '18 at 18:04
  • Could also try it on the free part of the Wolfram Cloud. Click on "Create a New Notebook" icon on bottom right. – Daniel Lichtblau Jan 20 '18 at 20:46
  • Hello Daniel, I'd tried wolfram and drawn the points on JPanel. Its somewhat doing similar to what I wanted, now I'm trying to implement function in java, is there any chance you know the underlying expression of RandomVariate function of wolfram and could tell me?

    Thanks for your all help!

    – hi0001234d Jan 22 '18 at 12:45
  • I think I've to look for java's normal distribution implementation – hi0001234d Jan 22 '18 at 13:31

0 Answers0