What formula could mimic the following curve?












8












$begingroup$


For the purpose of deforming a 3D mesh, I am looking for a formula to generate a curve I could evaluate like the following:



enter image description here



Its shape would be more or less a simplified version of wind waves over an ocean, where it starts slowly and ends more abruptly.



Which formula, if any, could allow me to draw such curve ?










share|cite|improve this question











$endgroup$








  • 6




    $begingroup$
    anyone for function golf on Area 51? (similar to code golf) ;-)
    $endgroup$
    – uhoh
    Mar 3 at 2:56








  • 1




    $begingroup$
    I have taken the liberty to add the tag "geometry" to the tag "curves" ( a tag "shape" would have been the most accurate)
    $endgroup$
    – Jean Marie
    Mar 3 at 8:27


















8












$begingroup$


For the purpose of deforming a 3D mesh, I am looking for a formula to generate a curve I could evaluate like the following:



enter image description here



Its shape would be more or less a simplified version of wind waves over an ocean, where it starts slowly and ends more abruptly.



Which formula, if any, could allow me to draw such curve ?










share|cite|improve this question











$endgroup$








  • 6




    $begingroup$
    anyone for function golf on Area 51? (similar to code golf) ;-)
    $endgroup$
    – uhoh
    Mar 3 at 2:56








  • 1




    $begingroup$
    I have taken the liberty to add the tag "geometry" to the tag "curves" ( a tag "shape" would have been the most accurate)
    $endgroup$
    – Jean Marie
    Mar 3 at 8:27
















8












8








8


0



$begingroup$


For the purpose of deforming a 3D mesh, I am looking for a formula to generate a curve I could evaluate like the following:



enter image description here



Its shape would be more or less a simplified version of wind waves over an ocean, where it starts slowly and ends more abruptly.



Which formula, if any, could allow me to draw such curve ?










share|cite|improve this question











$endgroup$




For the purpose of deforming a 3D mesh, I am looking for a formula to generate a curve I could evaluate like the following:



enter image description here



Its shape would be more or less a simplified version of wind waves over an ocean, where it starts slowly and ends more abruptly.



Which formula, if any, could allow me to draw such curve ?







geometry curves






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Mar 3 at 8:27









Jean Marie

30.6k42154




30.6k42154










asked Mar 2 at 19:43









AybeAybe

1836




1836








  • 6




    $begingroup$
    anyone for function golf on Area 51? (similar to code golf) ;-)
    $endgroup$
    – uhoh
    Mar 3 at 2:56








  • 1




    $begingroup$
    I have taken the liberty to add the tag "geometry" to the tag "curves" ( a tag "shape" would have been the most accurate)
    $endgroup$
    – Jean Marie
    Mar 3 at 8:27
















  • 6




    $begingroup$
    anyone for function golf on Area 51? (similar to code golf) ;-)
    $endgroup$
    – uhoh
    Mar 3 at 2:56








  • 1




    $begingroup$
    I have taken the liberty to add the tag "geometry" to the tag "curves" ( a tag "shape" would have been the most accurate)
    $endgroup$
    – Jean Marie
    Mar 3 at 8:27










6




6




$begingroup$
anyone for function golf on Area 51? (similar to code golf) ;-)
$endgroup$
– uhoh
Mar 3 at 2:56






$begingroup$
anyone for function golf on Area 51? (similar to code golf) ;-)
$endgroup$
– uhoh
Mar 3 at 2:56






1




1




$begingroup$
I have taken the liberty to add the tag "geometry" to the tag "curves" ( a tag "shape" would have been the most accurate)
$endgroup$
– Jean Marie
Mar 3 at 8:27






$begingroup$
I have taken the liberty to add the tag "geometry" to the tag "curves" ( a tag "shape" would have been the most accurate)
$endgroup$
– Jean Marie
Mar 3 at 8:27












2 Answers
2






active

oldest

votes


















16












$begingroup$

Try the function



$$f(x)=arctanleft(frac{asin(x-c)}{b+acos x}right) + d$$



Also try $f(f(x))$ and other compositions of $f$ with itself.



Screenshot
The image shows the function $f(f(x))$, with $a=0.9$, $b=1$, $c=0.7$, $d=0.4$.



I recommend that you use desmos to preview the function. For your convenience, here is a template that I have created. Just change the sliders to adjust the constants to your liking. You can also scale the $x$-axis if the peaks are spread out too much.



I hope this helps.



EDIT: As per the suggestion by @J. M. is not a mathematician, you can replace $arctan$ with the function $$g(x) = frac{px}{sqrt{q+(px)^2}}$$
if you need a greater variety of waves.






share|cite|improve this answer











$endgroup$









  • 1




    $begingroup$
    Thank you, exactly what I was looking for :)
    $endgroup$
    – Aybe
    Mar 2 at 21:38






  • 6




    $begingroup$
    What a lovely function. Can you perhaps say a few words on how you came up with it?
    $endgroup$
    – J. M. is not a mathematician
    Mar 3 at 3:35






  • 1




    $begingroup$
    @Haris Gusic I am trying to 'map' the interesting range to the 0 to 1 range but I am struggling, if you have an idea it's welcome!
    $endgroup$
    – Aybe
    Mar 3 at 4:32








  • 2




    $begingroup$
    @Aybe: Replace $x$ with $2pi (x-x_0)$ for some $x_0$?
    $endgroup$
    – Mehrdad
    Mar 3 at 4:37








  • 1




    $begingroup$
    @Mehrdad It works except that it doesn't start at (0, 0). Desmos tells when sign changes so I know it starts at (-1.63, -0.204) and scales to (2PI, 2.0), I could just go on from there but still ... I was hoping to fix it directly in the formula but failed miserably :)
    $endgroup$
    – Aybe
    Mar 3 at 5:47





















10












$begingroup$

@Haris Gusic : I have seen your solution which fits nicely the objectives of the asker with its different tunable parameters.



I propose here two alternatives, an intuitive one, using linear algebra, and another one more 'numerical analysis' oriented.



1) I have been striken by the fact that the curve desired by Aybe can be considered as a perspective view (or shadow) of a sine curve (or a power of a sine curve) : see Fig. 1 displaying the (red) curve of $y=sin(x)^n$ and its (blue) perspective image, with parametric equations given by



$$begin{cases}x&=&t+asin(t)^n\y&=&bsin(t)^nend{cases} text{here, with } begin{cases}n&=&4\a&=&0.8\b&=&0.1end{cases}$$



enter image description here



Fig. 1. The blue curve as a "shadow" of the red curve.



Why that ? This "shadow effect" is rendered by a so-called horizontal "shear mapping" (https://en.wikipedia.org/wiki/Shear_mapping) or "transvection", a linear operation with an upper triangular matrix:



$$color{blue}{binom{x}{y}}=begin{pmatrix}1&a\0&bend{pmatrix}color{red}{binom{t}{sin(t)^n}}$$



(The first column of this matrix reflects the fact that the horizontal direction is preserved whereas the second column with $a,b>0$ gives to the former vertical direction a certain leaning to the right).



enter image description here



Fig. 2 : Graphical representation using Desmos. Please note that $sin$ function has been placed between absolute value signs in order to allow non-integer exponents. A supplementary parameter $m$ has also been introduced. This is a very tunable solution : one can even, in this way, obtain breaking waves...



2) A "numerical analysis" method using quadratic splines.



I will not enter into the details because it is not sure at all that you are acquainted with such curves, which are made of arcs of parabolas connected in a "smooth" way (https://wordsandbuttons.online/quadric_splines_are_useful_too.html).



enter image description here



Fig. 3 : A quadratic spline solution based on 3 parabolas (red, magenta, blue) connected in a smooth way, repeated "ad libidum".



Here is the Matlab program that has generated Figure 3 (please note the three plotting operations for the red, magenta and blue parabolas with right translation variable $k$) :



clear all;close all;hold on;
t=0:0.01:1;
for k=0:6:18
plot(t.^2 + 2*t+k, t.^2,'r');
plot(-2*t.^2+4*t+3+k,-2*t.^2+2*t+1,'m');
plot(t.^2+5+k,(1-t).^2,'b');
end;


If you want to do the same with Desmos, here is a way to do it (it can be very instructive to enlarge a little the domain of parameter $t$ by taking for example $-0.5 leq t leq 1.5$ in order to understand what are these parabolas):



enter image description here



Fig. 4.






share|cite|improve this answer











$endgroup$









  • 1




    $begingroup$
    Thank you, this looks very interesting but I don't understand how I can draw it from the formulas you've posted :)
    $endgroup$
    – Aybe
    Mar 3 at 4:13










  • $begingroup$
    @Aybe : Desmos, for example, handles as well cartesian graphing ($y=f(x)$) and parametric plot graphing ($x=x(t),y=y(t)$). I just included a way to do it in my text.
    $endgroup$
    – Jean Marie
    Mar 3 at 7:11






  • 1




    $begingroup$
    @Aybe, to get a periodic function from Jean's second construction, you can compose the piecewise-parabolic function he has with a sawtooth function, as in this answer.
    $endgroup$
    – J. M. is not a mathematician
    Mar 3 at 8:36










  • $begingroup$
    Right, I need to do that in front of my computer because it's not exactly easy from a phone :)
    $endgroup$
    – Aybe
    Mar 3 at 10:01










  • $begingroup$
    This is really interesting but I just don't understand how to transform it to C# code, usually I do evaluate say 100 steps between 0 and 1 so t or x if you prefer then a generate a vertex out of it; right now I'm puzzled on how to do it yet I'd like to try it!
    $endgroup$
    – Aybe
    Mar 4 at 4:35













Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3132764%2fwhat-formula-could-mimic-the-following-curve%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









16












$begingroup$

Try the function



$$f(x)=arctanleft(frac{asin(x-c)}{b+acos x}right) + d$$



Also try $f(f(x))$ and other compositions of $f$ with itself.



Screenshot
The image shows the function $f(f(x))$, with $a=0.9$, $b=1$, $c=0.7$, $d=0.4$.



I recommend that you use desmos to preview the function. For your convenience, here is a template that I have created. Just change the sliders to adjust the constants to your liking. You can also scale the $x$-axis if the peaks are spread out too much.



I hope this helps.



EDIT: As per the suggestion by @J. M. is not a mathematician, you can replace $arctan$ with the function $$g(x) = frac{px}{sqrt{q+(px)^2}}$$
if you need a greater variety of waves.






share|cite|improve this answer











$endgroup$









  • 1




    $begingroup$
    Thank you, exactly what I was looking for :)
    $endgroup$
    – Aybe
    Mar 2 at 21:38






  • 6




    $begingroup$
    What a lovely function. Can you perhaps say a few words on how you came up with it?
    $endgroup$
    – J. M. is not a mathematician
    Mar 3 at 3:35






  • 1




    $begingroup$
    @Haris Gusic I am trying to 'map' the interesting range to the 0 to 1 range but I am struggling, if you have an idea it's welcome!
    $endgroup$
    – Aybe
    Mar 3 at 4:32








  • 2




    $begingroup$
    @Aybe: Replace $x$ with $2pi (x-x_0)$ for some $x_0$?
    $endgroup$
    – Mehrdad
    Mar 3 at 4:37








  • 1




    $begingroup$
    @Mehrdad It works except that it doesn't start at (0, 0). Desmos tells when sign changes so I know it starts at (-1.63, -0.204) and scales to (2PI, 2.0), I could just go on from there but still ... I was hoping to fix it directly in the formula but failed miserably :)
    $endgroup$
    – Aybe
    Mar 3 at 5:47


















16












$begingroup$

Try the function



$$f(x)=arctanleft(frac{asin(x-c)}{b+acos x}right) + d$$



Also try $f(f(x))$ and other compositions of $f$ with itself.



Screenshot
The image shows the function $f(f(x))$, with $a=0.9$, $b=1$, $c=0.7$, $d=0.4$.



I recommend that you use desmos to preview the function. For your convenience, here is a template that I have created. Just change the sliders to adjust the constants to your liking. You can also scale the $x$-axis if the peaks are spread out too much.



I hope this helps.



EDIT: As per the suggestion by @J. M. is not a mathematician, you can replace $arctan$ with the function $$g(x) = frac{px}{sqrt{q+(px)^2}}$$
if you need a greater variety of waves.






share|cite|improve this answer











$endgroup$









  • 1




    $begingroup$
    Thank you, exactly what I was looking for :)
    $endgroup$
    – Aybe
    Mar 2 at 21:38






  • 6




    $begingroup$
    What a lovely function. Can you perhaps say a few words on how you came up with it?
    $endgroup$
    – J. M. is not a mathematician
    Mar 3 at 3:35






  • 1




    $begingroup$
    @Haris Gusic I am trying to 'map' the interesting range to the 0 to 1 range but I am struggling, if you have an idea it's welcome!
    $endgroup$
    – Aybe
    Mar 3 at 4:32








  • 2




    $begingroup$
    @Aybe: Replace $x$ with $2pi (x-x_0)$ for some $x_0$?
    $endgroup$
    – Mehrdad
    Mar 3 at 4:37








  • 1




    $begingroup$
    @Mehrdad It works except that it doesn't start at (0, 0). Desmos tells when sign changes so I know it starts at (-1.63, -0.204) and scales to (2PI, 2.0), I could just go on from there but still ... I was hoping to fix it directly in the formula but failed miserably :)
    $endgroup$
    – Aybe
    Mar 3 at 5:47
















16












16








16





$begingroup$

Try the function



$$f(x)=arctanleft(frac{asin(x-c)}{b+acos x}right) + d$$



Also try $f(f(x))$ and other compositions of $f$ with itself.



Screenshot
The image shows the function $f(f(x))$, with $a=0.9$, $b=1$, $c=0.7$, $d=0.4$.



I recommend that you use desmos to preview the function. For your convenience, here is a template that I have created. Just change the sliders to adjust the constants to your liking. You can also scale the $x$-axis if the peaks are spread out too much.



I hope this helps.



EDIT: As per the suggestion by @J. M. is not a mathematician, you can replace $arctan$ with the function $$g(x) = frac{px}{sqrt{q+(px)^2}}$$
if you need a greater variety of waves.






share|cite|improve this answer











$endgroup$



Try the function



$$f(x)=arctanleft(frac{asin(x-c)}{b+acos x}right) + d$$



Also try $f(f(x))$ and other compositions of $f$ with itself.



Screenshot
The image shows the function $f(f(x))$, with $a=0.9$, $b=1$, $c=0.7$, $d=0.4$.



I recommend that you use desmos to preview the function. For your convenience, here is a template that I have created. Just change the sliders to adjust the constants to your liking. You can also scale the $x$-axis if the peaks are spread out too much.



I hope this helps.



EDIT: As per the suggestion by @J. M. is not a mathematician, you can replace $arctan$ with the function $$g(x) = frac{px}{sqrt{q+(px)^2}}$$
if you need a greater variety of waves.







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Mar 3 at 10:56

























answered Mar 2 at 20:18









Haris GusicHaris Gusic

2,603322




2,603322








  • 1




    $begingroup$
    Thank you, exactly what I was looking for :)
    $endgroup$
    – Aybe
    Mar 2 at 21:38






  • 6




    $begingroup$
    What a lovely function. Can you perhaps say a few words on how you came up with it?
    $endgroup$
    – J. M. is not a mathematician
    Mar 3 at 3:35






  • 1




    $begingroup$
    @Haris Gusic I am trying to 'map' the interesting range to the 0 to 1 range but I am struggling, if you have an idea it's welcome!
    $endgroup$
    – Aybe
    Mar 3 at 4:32








  • 2




    $begingroup$
    @Aybe: Replace $x$ with $2pi (x-x_0)$ for some $x_0$?
    $endgroup$
    – Mehrdad
    Mar 3 at 4:37








  • 1




    $begingroup$
    @Mehrdad It works except that it doesn't start at (0, 0). Desmos tells when sign changes so I know it starts at (-1.63, -0.204) and scales to (2PI, 2.0), I could just go on from there but still ... I was hoping to fix it directly in the formula but failed miserably :)
    $endgroup$
    – Aybe
    Mar 3 at 5:47
















  • 1




    $begingroup$
    Thank you, exactly what I was looking for :)
    $endgroup$
    – Aybe
    Mar 2 at 21:38






  • 6




    $begingroup$
    What a lovely function. Can you perhaps say a few words on how you came up with it?
    $endgroup$
    – J. M. is not a mathematician
    Mar 3 at 3:35






  • 1




    $begingroup$
    @Haris Gusic I am trying to 'map' the interesting range to the 0 to 1 range but I am struggling, if you have an idea it's welcome!
    $endgroup$
    – Aybe
    Mar 3 at 4:32








  • 2




    $begingroup$
    @Aybe: Replace $x$ with $2pi (x-x_0)$ for some $x_0$?
    $endgroup$
    – Mehrdad
    Mar 3 at 4:37








  • 1




    $begingroup$
    @Mehrdad It works except that it doesn't start at (0, 0). Desmos tells when sign changes so I know it starts at (-1.63, -0.204) and scales to (2PI, 2.0), I could just go on from there but still ... I was hoping to fix it directly in the formula but failed miserably :)
    $endgroup$
    – Aybe
    Mar 3 at 5:47










1




1




$begingroup$
Thank you, exactly what I was looking for :)
$endgroup$
– Aybe
Mar 2 at 21:38




$begingroup$
Thank you, exactly what I was looking for :)
$endgroup$
– Aybe
Mar 2 at 21:38




6




6




$begingroup$
What a lovely function. Can you perhaps say a few words on how you came up with it?
$endgroup$
– J. M. is not a mathematician
Mar 3 at 3:35




$begingroup$
What a lovely function. Can you perhaps say a few words on how you came up with it?
$endgroup$
– J. M. is not a mathematician
Mar 3 at 3:35




1




1




$begingroup$
@Haris Gusic I am trying to 'map' the interesting range to the 0 to 1 range but I am struggling, if you have an idea it's welcome!
$endgroup$
– Aybe
Mar 3 at 4:32






$begingroup$
@Haris Gusic I am trying to 'map' the interesting range to the 0 to 1 range but I am struggling, if you have an idea it's welcome!
$endgroup$
– Aybe
Mar 3 at 4:32






2




2




$begingroup$
@Aybe: Replace $x$ with $2pi (x-x_0)$ for some $x_0$?
$endgroup$
– Mehrdad
Mar 3 at 4:37






$begingroup$
@Aybe: Replace $x$ with $2pi (x-x_0)$ for some $x_0$?
$endgroup$
– Mehrdad
Mar 3 at 4:37






1




1




$begingroup$
@Mehrdad It works except that it doesn't start at (0, 0). Desmos tells when sign changes so I know it starts at (-1.63, -0.204) and scales to (2PI, 2.0), I could just go on from there but still ... I was hoping to fix it directly in the formula but failed miserably :)
$endgroup$
– Aybe
Mar 3 at 5:47






$begingroup$
@Mehrdad It works except that it doesn't start at (0, 0). Desmos tells when sign changes so I know it starts at (-1.63, -0.204) and scales to (2PI, 2.0), I could just go on from there but still ... I was hoping to fix it directly in the formula but failed miserably :)
$endgroup$
– Aybe
Mar 3 at 5:47













10












$begingroup$

@Haris Gusic : I have seen your solution which fits nicely the objectives of the asker with its different tunable parameters.



I propose here two alternatives, an intuitive one, using linear algebra, and another one more 'numerical analysis' oriented.



1) I have been striken by the fact that the curve desired by Aybe can be considered as a perspective view (or shadow) of a sine curve (or a power of a sine curve) : see Fig. 1 displaying the (red) curve of $y=sin(x)^n$ and its (blue) perspective image, with parametric equations given by



$$begin{cases}x&=&t+asin(t)^n\y&=&bsin(t)^nend{cases} text{here, with } begin{cases}n&=&4\a&=&0.8\b&=&0.1end{cases}$$



enter image description here



Fig. 1. The blue curve as a "shadow" of the red curve.



Why that ? This "shadow effect" is rendered by a so-called horizontal "shear mapping" (https://en.wikipedia.org/wiki/Shear_mapping) or "transvection", a linear operation with an upper triangular matrix:



$$color{blue}{binom{x}{y}}=begin{pmatrix}1&a\0&bend{pmatrix}color{red}{binom{t}{sin(t)^n}}$$



(The first column of this matrix reflects the fact that the horizontal direction is preserved whereas the second column with $a,b>0$ gives to the former vertical direction a certain leaning to the right).



enter image description here



Fig. 2 : Graphical representation using Desmos. Please note that $sin$ function has been placed between absolute value signs in order to allow non-integer exponents. A supplementary parameter $m$ has also been introduced. This is a very tunable solution : one can even, in this way, obtain breaking waves...



2) A "numerical analysis" method using quadratic splines.



I will not enter into the details because it is not sure at all that you are acquainted with such curves, which are made of arcs of parabolas connected in a "smooth" way (https://wordsandbuttons.online/quadric_splines_are_useful_too.html).



enter image description here



Fig. 3 : A quadratic spline solution based on 3 parabolas (red, magenta, blue) connected in a smooth way, repeated "ad libidum".



Here is the Matlab program that has generated Figure 3 (please note the three plotting operations for the red, magenta and blue parabolas with right translation variable $k$) :



clear all;close all;hold on;
t=0:0.01:1;
for k=0:6:18
plot(t.^2 + 2*t+k, t.^2,'r');
plot(-2*t.^2+4*t+3+k,-2*t.^2+2*t+1,'m');
plot(t.^2+5+k,(1-t).^2,'b');
end;


If you want to do the same with Desmos, here is a way to do it (it can be very instructive to enlarge a little the domain of parameter $t$ by taking for example $-0.5 leq t leq 1.5$ in order to understand what are these parabolas):



enter image description here



Fig. 4.






share|cite|improve this answer











$endgroup$









  • 1




    $begingroup$
    Thank you, this looks very interesting but I don't understand how I can draw it from the formulas you've posted :)
    $endgroup$
    – Aybe
    Mar 3 at 4:13










  • $begingroup$
    @Aybe : Desmos, for example, handles as well cartesian graphing ($y=f(x)$) and parametric plot graphing ($x=x(t),y=y(t)$). I just included a way to do it in my text.
    $endgroup$
    – Jean Marie
    Mar 3 at 7:11






  • 1




    $begingroup$
    @Aybe, to get a periodic function from Jean's second construction, you can compose the piecewise-parabolic function he has with a sawtooth function, as in this answer.
    $endgroup$
    – J. M. is not a mathematician
    Mar 3 at 8:36










  • $begingroup$
    Right, I need to do that in front of my computer because it's not exactly easy from a phone :)
    $endgroup$
    – Aybe
    Mar 3 at 10:01










  • $begingroup$
    This is really interesting but I just don't understand how to transform it to C# code, usually I do evaluate say 100 steps between 0 and 1 so t or x if you prefer then a generate a vertex out of it; right now I'm puzzled on how to do it yet I'd like to try it!
    $endgroup$
    – Aybe
    Mar 4 at 4:35


















10












$begingroup$

@Haris Gusic : I have seen your solution which fits nicely the objectives of the asker with its different tunable parameters.



I propose here two alternatives, an intuitive one, using linear algebra, and another one more 'numerical analysis' oriented.



1) I have been striken by the fact that the curve desired by Aybe can be considered as a perspective view (or shadow) of a sine curve (or a power of a sine curve) : see Fig. 1 displaying the (red) curve of $y=sin(x)^n$ and its (blue) perspective image, with parametric equations given by



$$begin{cases}x&=&t+asin(t)^n\y&=&bsin(t)^nend{cases} text{here, with } begin{cases}n&=&4\a&=&0.8\b&=&0.1end{cases}$$



enter image description here



Fig. 1. The blue curve as a "shadow" of the red curve.



Why that ? This "shadow effect" is rendered by a so-called horizontal "shear mapping" (https://en.wikipedia.org/wiki/Shear_mapping) or "transvection", a linear operation with an upper triangular matrix:



$$color{blue}{binom{x}{y}}=begin{pmatrix}1&a\0&bend{pmatrix}color{red}{binom{t}{sin(t)^n}}$$



(The first column of this matrix reflects the fact that the horizontal direction is preserved whereas the second column with $a,b>0$ gives to the former vertical direction a certain leaning to the right).



enter image description here



Fig. 2 : Graphical representation using Desmos. Please note that $sin$ function has been placed between absolute value signs in order to allow non-integer exponents. A supplementary parameter $m$ has also been introduced. This is a very tunable solution : one can even, in this way, obtain breaking waves...



2) A "numerical analysis" method using quadratic splines.



I will not enter into the details because it is not sure at all that you are acquainted with such curves, which are made of arcs of parabolas connected in a "smooth" way (https://wordsandbuttons.online/quadric_splines_are_useful_too.html).



enter image description here



Fig. 3 : A quadratic spline solution based on 3 parabolas (red, magenta, blue) connected in a smooth way, repeated "ad libidum".



Here is the Matlab program that has generated Figure 3 (please note the three plotting operations for the red, magenta and blue parabolas with right translation variable $k$) :



clear all;close all;hold on;
t=0:0.01:1;
for k=0:6:18
plot(t.^2 + 2*t+k, t.^2,'r');
plot(-2*t.^2+4*t+3+k,-2*t.^2+2*t+1,'m');
plot(t.^2+5+k,(1-t).^2,'b');
end;


If you want to do the same with Desmos, here is a way to do it (it can be very instructive to enlarge a little the domain of parameter $t$ by taking for example $-0.5 leq t leq 1.5$ in order to understand what are these parabolas):



enter image description here



Fig. 4.






share|cite|improve this answer











$endgroup$









  • 1




    $begingroup$
    Thank you, this looks very interesting but I don't understand how I can draw it from the formulas you've posted :)
    $endgroup$
    – Aybe
    Mar 3 at 4:13










  • $begingroup$
    @Aybe : Desmos, for example, handles as well cartesian graphing ($y=f(x)$) and parametric plot graphing ($x=x(t),y=y(t)$). I just included a way to do it in my text.
    $endgroup$
    – Jean Marie
    Mar 3 at 7:11






  • 1




    $begingroup$
    @Aybe, to get a periodic function from Jean's second construction, you can compose the piecewise-parabolic function he has with a sawtooth function, as in this answer.
    $endgroup$
    – J. M. is not a mathematician
    Mar 3 at 8:36










  • $begingroup$
    Right, I need to do that in front of my computer because it's not exactly easy from a phone :)
    $endgroup$
    – Aybe
    Mar 3 at 10:01










  • $begingroup$
    This is really interesting but I just don't understand how to transform it to C# code, usually I do evaluate say 100 steps between 0 and 1 so t or x if you prefer then a generate a vertex out of it; right now I'm puzzled on how to do it yet I'd like to try it!
    $endgroup$
    – Aybe
    Mar 4 at 4:35
















10












10








10





$begingroup$

@Haris Gusic : I have seen your solution which fits nicely the objectives of the asker with its different tunable parameters.



I propose here two alternatives, an intuitive one, using linear algebra, and another one more 'numerical analysis' oriented.



1) I have been striken by the fact that the curve desired by Aybe can be considered as a perspective view (or shadow) of a sine curve (or a power of a sine curve) : see Fig. 1 displaying the (red) curve of $y=sin(x)^n$ and its (blue) perspective image, with parametric equations given by



$$begin{cases}x&=&t+asin(t)^n\y&=&bsin(t)^nend{cases} text{here, with } begin{cases}n&=&4\a&=&0.8\b&=&0.1end{cases}$$



enter image description here



Fig. 1. The blue curve as a "shadow" of the red curve.



Why that ? This "shadow effect" is rendered by a so-called horizontal "shear mapping" (https://en.wikipedia.org/wiki/Shear_mapping) or "transvection", a linear operation with an upper triangular matrix:



$$color{blue}{binom{x}{y}}=begin{pmatrix}1&a\0&bend{pmatrix}color{red}{binom{t}{sin(t)^n}}$$



(The first column of this matrix reflects the fact that the horizontal direction is preserved whereas the second column with $a,b>0$ gives to the former vertical direction a certain leaning to the right).



enter image description here



Fig. 2 : Graphical representation using Desmos. Please note that $sin$ function has been placed between absolute value signs in order to allow non-integer exponents. A supplementary parameter $m$ has also been introduced. This is a very tunable solution : one can even, in this way, obtain breaking waves...



2) A "numerical analysis" method using quadratic splines.



I will not enter into the details because it is not sure at all that you are acquainted with such curves, which are made of arcs of parabolas connected in a "smooth" way (https://wordsandbuttons.online/quadric_splines_are_useful_too.html).



enter image description here



Fig. 3 : A quadratic spline solution based on 3 parabolas (red, magenta, blue) connected in a smooth way, repeated "ad libidum".



Here is the Matlab program that has generated Figure 3 (please note the three plotting operations for the red, magenta and blue parabolas with right translation variable $k$) :



clear all;close all;hold on;
t=0:0.01:1;
for k=0:6:18
plot(t.^2 + 2*t+k, t.^2,'r');
plot(-2*t.^2+4*t+3+k,-2*t.^2+2*t+1,'m');
plot(t.^2+5+k,(1-t).^2,'b');
end;


If you want to do the same with Desmos, here is a way to do it (it can be very instructive to enlarge a little the domain of parameter $t$ by taking for example $-0.5 leq t leq 1.5$ in order to understand what are these parabolas):



enter image description here



Fig. 4.






share|cite|improve this answer











$endgroup$



@Haris Gusic : I have seen your solution which fits nicely the objectives of the asker with its different tunable parameters.



I propose here two alternatives, an intuitive one, using linear algebra, and another one more 'numerical analysis' oriented.



1) I have been striken by the fact that the curve desired by Aybe can be considered as a perspective view (or shadow) of a sine curve (or a power of a sine curve) : see Fig. 1 displaying the (red) curve of $y=sin(x)^n$ and its (blue) perspective image, with parametric equations given by



$$begin{cases}x&=&t+asin(t)^n\y&=&bsin(t)^nend{cases} text{here, with } begin{cases}n&=&4\a&=&0.8\b&=&0.1end{cases}$$



enter image description here



Fig. 1. The blue curve as a "shadow" of the red curve.



Why that ? This "shadow effect" is rendered by a so-called horizontal "shear mapping" (https://en.wikipedia.org/wiki/Shear_mapping) or "transvection", a linear operation with an upper triangular matrix:



$$color{blue}{binom{x}{y}}=begin{pmatrix}1&a\0&bend{pmatrix}color{red}{binom{t}{sin(t)^n}}$$



(The first column of this matrix reflects the fact that the horizontal direction is preserved whereas the second column with $a,b>0$ gives to the former vertical direction a certain leaning to the right).



enter image description here



Fig. 2 : Graphical representation using Desmos. Please note that $sin$ function has been placed between absolute value signs in order to allow non-integer exponents. A supplementary parameter $m$ has also been introduced. This is a very tunable solution : one can even, in this way, obtain breaking waves...



2) A "numerical analysis" method using quadratic splines.



I will not enter into the details because it is not sure at all that you are acquainted with such curves, which are made of arcs of parabolas connected in a "smooth" way (https://wordsandbuttons.online/quadric_splines_are_useful_too.html).



enter image description here



Fig. 3 : A quadratic spline solution based on 3 parabolas (red, magenta, blue) connected in a smooth way, repeated "ad libidum".



Here is the Matlab program that has generated Figure 3 (please note the three plotting operations for the red, magenta and blue parabolas with right translation variable $k$) :



clear all;close all;hold on;
t=0:0.01:1;
for k=0:6:18
plot(t.^2 + 2*t+k, t.^2,'r');
plot(-2*t.^2+4*t+3+k,-2*t.^2+2*t+1,'m');
plot(t.^2+5+k,(1-t).^2,'b');
end;


If you want to do the same with Desmos, here is a way to do it (it can be very instructive to enlarge a little the domain of parameter $t$ by taking for example $-0.5 leq t leq 1.5$ in order to understand what are these parabolas):



enter image description here



Fig. 4.







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Mar 5 at 5:51

























answered Mar 3 at 0:13









Jean MarieJean Marie

30.6k42154




30.6k42154








  • 1




    $begingroup$
    Thank you, this looks very interesting but I don't understand how I can draw it from the formulas you've posted :)
    $endgroup$
    – Aybe
    Mar 3 at 4:13










  • $begingroup$
    @Aybe : Desmos, for example, handles as well cartesian graphing ($y=f(x)$) and parametric plot graphing ($x=x(t),y=y(t)$). I just included a way to do it in my text.
    $endgroup$
    – Jean Marie
    Mar 3 at 7:11






  • 1




    $begingroup$
    @Aybe, to get a periodic function from Jean's second construction, you can compose the piecewise-parabolic function he has with a sawtooth function, as in this answer.
    $endgroup$
    – J. M. is not a mathematician
    Mar 3 at 8:36










  • $begingroup$
    Right, I need to do that in front of my computer because it's not exactly easy from a phone :)
    $endgroup$
    – Aybe
    Mar 3 at 10:01










  • $begingroup$
    This is really interesting but I just don't understand how to transform it to C# code, usually I do evaluate say 100 steps between 0 and 1 so t or x if you prefer then a generate a vertex out of it; right now I'm puzzled on how to do it yet I'd like to try it!
    $endgroup$
    – Aybe
    Mar 4 at 4:35
















  • 1




    $begingroup$
    Thank you, this looks very interesting but I don't understand how I can draw it from the formulas you've posted :)
    $endgroup$
    – Aybe
    Mar 3 at 4:13










  • $begingroup$
    @Aybe : Desmos, for example, handles as well cartesian graphing ($y=f(x)$) and parametric plot graphing ($x=x(t),y=y(t)$). I just included a way to do it in my text.
    $endgroup$
    – Jean Marie
    Mar 3 at 7:11






  • 1




    $begingroup$
    @Aybe, to get a periodic function from Jean's second construction, you can compose the piecewise-parabolic function he has with a sawtooth function, as in this answer.
    $endgroup$
    – J. M. is not a mathematician
    Mar 3 at 8:36










  • $begingroup$
    Right, I need to do that in front of my computer because it's not exactly easy from a phone :)
    $endgroup$
    – Aybe
    Mar 3 at 10:01










  • $begingroup$
    This is really interesting but I just don't understand how to transform it to C# code, usually I do evaluate say 100 steps between 0 and 1 so t or x if you prefer then a generate a vertex out of it; right now I'm puzzled on how to do it yet I'd like to try it!
    $endgroup$
    – Aybe
    Mar 4 at 4:35










1




1




$begingroup$
Thank you, this looks very interesting but I don't understand how I can draw it from the formulas you've posted :)
$endgroup$
– Aybe
Mar 3 at 4:13




$begingroup$
Thank you, this looks very interesting but I don't understand how I can draw it from the formulas you've posted :)
$endgroup$
– Aybe
Mar 3 at 4:13












$begingroup$
@Aybe : Desmos, for example, handles as well cartesian graphing ($y=f(x)$) and parametric plot graphing ($x=x(t),y=y(t)$). I just included a way to do it in my text.
$endgroup$
– Jean Marie
Mar 3 at 7:11




$begingroup$
@Aybe : Desmos, for example, handles as well cartesian graphing ($y=f(x)$) and parametric plot graphing ($x=x(t),y=y(t)$). I just included a way to do it in my text.
$endgroup$
– Jean Marie
Mar 3 at 7:11




1




1




$begingroup$
@Aybe, to get a periodic function from Jean's second construction, you can compose the piecewise-parabolic function he has with a sawtooth function, as in this answer.
$endgroup$
– J. M. is not a mathematician
Mar 3 at 8:36




$begingroup$
@Aybe, to get a periodic function from Jean's second construction, you can compose the piecewise-parabolic function he has with a sawtooth function, as in this answer.
$endgroup$
– J. M. is not a mathematician
Mar 3 at 8:36












$begingroup$
Right, I need to do that in front of my computer because it's not exactly easy from a phone :)
$endgroup$
– Aybe
Mar 3 at 10:01




$begingroup$
Right, I need to do that in front of my computer because it's not exactly easy from a phone :)
$endgroup$
– Aybe
Mar 3 at 10:01












$begingroup$
This is really interesting but I just don't understand how to transform it to C# code, usually I do evaluate say 100 steps between 0 and 1 so t or x if you prefer then a generate a vertex out of it; right now I'm puzzled on how to do it yet I'd like to try it!
$endgroup$
– Aybe
Mar 4 at 4:35






$begingroup$
This is really interesting but I just don't understand how to transform it to C# code, usually I do evaluate say 100 steps between 0 and 1 so t or x if you prefer then a generate a vertex out of it; right now I'm puzzled on how to do it yet I'd like to try it!
$endgroup$
– Aybe
Mar 4 at 4:35




















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3132764%2fwhat-formula-could-mimic-the-following-curve%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Can I use Tabulator js library in my java Spring + Thymeleaf project?