Unexpected result from ArcLengthDetermining which rule NIntegrate selects automaticallyFinding minimum fly-by radius between Mars and spacecraft from interpolating functionCoarse-graining in numerical integrationsNIntegrate fails to converge around a value out of integration rangeA 1D numerical integral Mathematica cannot compute, from physicsDifferential Equation with Numerically Integrated Boundary ConditionsDifferents results of the intersection area between two regions when using the function “Area” and the function “NIntegrate”Issue with boundary Integration of FEM numerical solution (interpolation function)How to get the most accurate volume of a special solid?Numerical solution of 3 dim integral with singularity
Is it normal that my co-workers at a fitness company criticize my food choices?
Why does Bach not break the rules here?
Most cost effective thermostat setting: consistent temperature vs. lowest temperature possible
Are ETF trackers fundamentally better than individual stocks?
What has been your most complicated TikZ drawing?
Official degrees of earth’s rotation per day
How to change two letters closest to a string and one letter immediately after a string using notepad++
Why do Australian milk farmers need to protest supermarkets' milk price?
What did Alexander Pope mean by "Expletives their feeble Aid do join"?
Do I need life insurance if I can cover my own funeral costs?
In a future war, an old lady is trying to raise a boy but one of the weapons has made everyone deaf
Why one should not leave fingerprints on bulbs and plugs?
Do these spellcasting foci from Xanathar's Guide to Everything have to be held in a hand?
What's the meaning of “spike” in the context of “adrenaline spike”?
A Cautionary Suggestion
If curse and magic is two sides of the same coin, why the former is forbidden?
Instead of Universal Basic Income, why not Universal Basic NEEDS?
Welcoming 2019 Pi day: How to draw the letter π?
Time travel from stationary position?
Is there a data structure that only stores hash codes and not the actual objects?
Does Mathematica reuse previous computations?
compactness of a set where am I going wrong
Identifying the interval from A♭ to D♯
What should tie a collection of short-stories together?
Unexpected result from ArcLength
Determining which rule NIntegrate selects automaticallyFinding minimum fly-by radius between Mars and spacecraft from interpolating functionCoarse-graining in numerical integrationsNIntegrate fails to converge around a value out of integration rangeA 1D numerical integral Mathematica cannot compute, from physicsDifferential Equation with Numerically Integrated Boundary ConditionsDifferents results of the intersection area between two regions when using the function “Area” and the function “NIntegrate”Issue with boundary Integration of FEM numerical solution (interpolation function)How to get the most accurate volume of a special solid?Numerical solution of 3 dim integral with singularity
$begingroup$
I want to determine the arc lenght of a parametric curve $C: x(t),y(t) = cos(t)^p , sin(t)^p $ with $p$ between $0$ and $1$, and $t$ between $0$ and $pi/2$.
I set up the following function of $p$:
L[p_] := ArcLength[Cos[t]^p, Sin[t]^p, t, 0, Pi/2,
Method -> "NIntegrate", MaxRecursion -> 20]
For $p=1$ we have a quarter of a circle of radius 1 and we know the arc length is equal to $pi/2$. The above function gives the correct result: 1.5708
.
For $p$ close to zero, the curve approaches a square, and we know the result should be very close to $2$. However, the function doesn't even come close to it. Evaluating L[1/100]
results in 1.30603
. Not close to 2
(it's not even bigger than Pi/2
).
Plotting, results in the following:
Plot[L[p], p, 0, 1]
Any ideas? I'm running 11.0.0.0
numerical-integration
$endgroup$
add a comment |
$begingroup$
I want to determine the arc lenght of a parametric curve $C: x(t),y(t) = cos(t)^p , sin(t)^p $ with $p$ between $0$ and $1$, and $t$ between $0$ and $pi/2$.
I set up the following function of $p$:
L[p_] := ArcLength[Cos[t]^p, Sin[t]^p, t, 0, Pi/2,
Method -> "NIntegrate", MaxRecursion -> 20]
For $p=1$ we have a quarter of a circle of radius 1 and we know the arc length is equal to $pi/2$. The above function gives the correct result: 1.5708
.
For $p$ close to zero, the curve approaches a square, and we know the result should be very close to $2$. However, the function doesn't even come close to it. Evaluating L[1/100]
results in 1.30603
. Not close to 2
(it's not even bigger than Pi/2
).
Plotting, results in the following:
Plot[L[p], p, 0, 1]
Any ideas? I'm running 11.0.0.0
numerical-integration
$endgroup$
1
$begingroup$
I get a warning fromNIntegrate
("Numerical integration converging too slowly; suspect one of the following: singularity...") when trying to evaluateL
for smallp
.
$endgroup$
– MarcoB
6 hours ago
$begingroup$
@MarcoB I don't get any warnings when evaluatingL[1/100]
$endgroup$
– Ivan
6 hours ago
add a comment |
$begingroup$
I want to determine the arc lenght of a parametric curve $C: x(t),y(t) = cos(t)^p , sin(t)^p $ with $p$ between $0$ and $1$, and $t$ between $0$ and $pi/2$.
I set up the following function of $p$:
L[p_] := ArcLength[Cos[t]^p, Sin[t]^p, t, 0, Pi/2,
Method -> "NIntegrate", MaxRecursion -> 20]
For $p=1$ we have a quarter of a circle of radius 1 and we know the arc length is equal to $pi/2$. The above function gives the correct result: 1.5708
.
For $p$ close to zero, the curve approaches a square, and we know the result should be very close to $2$. However, the function doesn't even come close to it. Evaluating L[1/100]
results in 1.30603
. Not close to 2
(it's not even bigger than Pi/2
).
Plotting, results in the following:
Plot[L[p], p, 0, 1]
Any ideas? I'm running 11.0.0.0
numerical-integration
$endgroup$
I want to determine the arc lenght of a parametric curve $C: x(t),y(t) = cos(t)^p , sin(t)^p $ with $p$ between $0$ and $1$, and $t$ between $0$ and $pi/2$.
I set up the following function of $p$:
L[p_] := ArcLength[Cos[t]^p, Sin[t]^p, t, 0, Pi/2,
Method -> "NIntegrate", MaxRecursion -> 20]
For $p=1$ we have a quarter of a circle of radius 1 and we know the arc length is equal to $pi/2$. The above function gives the correct result: 1.5708
.
For $p$ close to zero, the curve approaches a square, and we know the result should be very close to $2$. However, the function doesn't even come close to it. Evaluating L[1/100]
results in 1.30603
. Not close to 2
(it's not even bigger than Pi/2
).
Plotting, results in the following:
Plot[L[p], p, 0, 1]
Any ideas? I'm running 11.0.0.0
numerical-integration
numerical-integration
edited 6 hours ago
Henrik Schumacher
56.6k577157
56.6k577157
asked 7 hours ago
IvanIvan
1,622821
1,622821
1
$begingroup$
I get a warning fromNIntegrate
("Numerical integration converging too slowly; suspect one of the following: singularity...") when trying to evaluateL
for smallp
.
$endgroup$
– MarcoB
6 hours ago
$begingroup$
@MarcoB I don't get any warnings when evaluatingL[1/100]
$endgroup$
– Ivan
6 hours ago
add a comment |
1
$begingroup$
I get a warning fromNIntegrate
("Numerical integration converging too slowly; suspect one of the following: singularity...") when trying to evaluateL
for smallp
.
$endgroup$
– MarcoB
6 hours ago
$begingroup$
@MarcoB I don't get any warnings when evaluatingL[1/100]
$endgroup$
– Ivan
6 hours ago
1
1
$begingroup$
I get a warning from
NIntegrate
("Numerical integration converging too slowly; suspect one of the following: singularity...") when trying to evaluate L
for small p
.$endgroup$
– MarcoB
6 hours ago
$begingroup$
I get a warning from
NIntegrate
("Numerical integration converging too slowly; suspect one of the following: singularity...") when trying to evaluate L
for small p
.$endgroup$
– MarcoB
6 hours ago
$begingroup$
@MarcoB I don't get any warnings when evaluating
L[1/100]
$endgroup$
– Ivan
6 hours ago
$begingroup$
@MarcoB I don't get any warnings when evaluating
L[1/100]
$endgroup$
– Ivan
6 hours ago
add a comment |
3 Answers
3
active
oldest
votes
$begingroup$
Seems to be a precision thing.
L[p_] = Cos[t]^p, Sin[t]^p
ArcLength[L[1/100], t, 0, π/2, WorkingPrecision -> 1000]
1.99447959240474567...
$endgroup$
add a comment |
$begingroup$
Manipulate[ParametricPlot[Cos[t]^p, Sin[t]^p, t, 0, Pi/2], p, 0.01, 1]
gives this plot at $p=0.01$:
(An unpreprocessing plot was here.)
Yes, looks to be approaching two sides of a square, but the sides are shrinking!
UPDATE:
p = 0.01; ParametricPlot[Cos[t]^p, Sin[t]^p, t, 0, Pi/2, Axes -> False, Frame -> True, PlotRange -> 0, 1.1, 0, 1.1]
So yes, the sides are not shrinking, but Mathematica seems to be missing some of the curve ...
$endgroup$
$begingroup$
>but the sides are shrinking. Not really. Check your plotrange
$endgroup$
– Ivan
6 hours ago
$begingroup$
Yes, but this does not seem to answer the OP's question. Try including smaller values of $p$.
$endgroup$
– MarcoB
6 hours ago
2
$begingroup$
No, not that desperate ... By the way, you guys are tough! Imagine a classroom where a student gives an answer/suggestion that is not correct. Or a collaboration with somebody making a mistake. Seems that "Mathematica Stack Exchange" culture does not like people taking risks. May hurt creativity ... But we will have strictly precise, quality answers!!
$endgroup$
– mjw
6 hours ago
1
$begingroup$
@mjw "Seems that "Mathematica Stack Exchange" culture does not like people taking risks." To the contrary. I was really surprise that posts in this threads were downvoted so quickly. Downvotes on answers are actually very uncommon on this site.
$endgroup$
– Henrik Schumacher
6 hours ago
1
$begingroup$
@Ivan, yes, point well taken! Could be an artifact. But why is theArcLength[]
returning wrong results? Seems that in both cases Mathematica is undersampling ...
$endgroup$
– mjw
6 hours ago
|
show 9 more comments
$begingroup$
I can only provide an alternative to bypass ArcLength
.
The points pts
of a quarter circle are scaled such that they lie on the desired curve; afterwards the length of the polygonal line is computed. You will still get problems for values of p
very close to 0
, but at least you may obtain a qualitatively correct plot (so I hope).
Certainly this method won't provide you with the best possible accuracy. The relative error between the arclength $ell$ of an arc and the length $s$ of a secant is roughly $|ell/s - 1| leq ell^2 , max(|kappa|)$ in the limit of $ell to 0$. Since the maximal curvature in of curve goes to $infty$ for $p to infty$, the quality of this approximation will reduce significantly for $p to 0$.
n = 10000;
pts = Transpose[Cos[Subdivide[0., Pi/2, n]], Sin[Subdivide[0., Pi/2, n]]];
L[p_] := With[x = pts/Power[Dot[(Abs[pts]^(1/p)), 1., 1.], p],
Total[Sqrt[Dot[Differences[x]^2, 1., 1.]]]
]
Plot[L[p], p, 0.001, 1]
$endgroup$
add a comment |
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: "387"
;
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f193346%2funexpected-result-from-arclength%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Seems to be a precision thing.
L[p_] = Cos[t]^p, Sin[t]^p
ArcLength[L[1/100], t, 0, π/2, WorkingPrecision -> 1000]
1.99447959240474567...
$endgroup$
add a comment |
$begingroup$
Seems to be a precision thing.
L[p_] = Cos[t]^p, Sin[t]^p
ArcLength[L[1/100], t, 0, π/2, WorkingPrecision -> 1000]
1.99447959240474567...
$endgroup$
add a comment |
$begingroup$
Seems to be a precision thing.
L[p_] = Cos[t]^p, Sin[t]^p
ArcLength[L[1/100], t, 0, π/2, WorkingPrecision -> 1000]
1.99447959240474567...
$endgroup$
Seems to be a precision thing.
L[p_] = Cos[t]^p, Sin[t]^p
ArcLength[L[1/100], t, 0, π/2, WorkingPrecision -> 1000]
1.99447959240474567...
answered 5 hours ago
Bill WattsBill Watts
3,5111620
3,5111620
add a comment |
add a comment |
$begingroup$
Manipulate[ParametricPlot[Cos[t]^p, Sin[t]^p, t, 0, Pi/2], p, 0.01, 1]
gives this plot at $p=0.01$:
(An unpreprocessing plot was here.)
Yes, looks to be approaching two sides of a square, but the sides are shrinking!
UPDATE:
p = 0.01; ParametricPlot[Cos[t]^p, Sin[t]^p, t, 0, Pi/2, Axes -> False, Frame -> True, PlotRange -> 0, 1.1, 0, 1.1]
So yes, the sides are not shrinking, but Mathematica seems to be missing some of the curve ...
$endgroup$
$begingroup$
>but the sides are shrinking. Not really. Check your plotrange
$endgroup$
– Ivan
6 hours ago
$begingroup$
Yes, but this does not seem to answer the OP's question. Try including smaller values of $p$.
$endgroup$
– MarcoB
6 hours ago
2
$begingroup$
No, not that desperate ... By the way, you guys are tough! Imagine a classroom where a student gives an answer/suggestion that is not correct. Or a collaboration with somebody making a mistake. Seems that "Mathematica Stack Exchange" culture does not like people taking risks. May hurt creativity ... But we will have strictly precise, quality answers!!
$endgroup$
– mjw
6 hours ago
1
$begingroup$
@mjw "Seems that "Mathematica Stack Exchange" culture does not like people taking risks." To the contrary. I was really surprise that posts in this threads were downvoted so quickly. Downvotes on answers are actually very uncommon on this site.
$endgroup$
– Henrik Schumacher
6 hours ago
1
$begingroup$
@Ivan, yes, point well taken! Could be an artifact. But why is theArcLength[]
returning wrong results? Seems that in both cases Mathematica is undersampling ...
$endgroup$
– mjw
6 hours ago
|
show 9 more comments
$begingroup$
Manipulate[ParametricPlot[Cos[t]^p, Sin[t]^p, t, 0, Pi/2], p, 0.01, 1]
gives this plot at $p=0.01$:
(An unpreprocessing plot was here.)
Yes, looks to be approaching two sides of a square, but the sides are shrinking!
UPDATE:
p = 0.01; ParametricPlot[Cos[t]^p, Sin[t]^p, t, 0, Pi/2, Axes -> False, Frame -> True, PlotRange -> 0, 1.1, 0, 1.1]
So yes, the sides are not shrinking, but Mathematica seems to be missing some of the curve ...
$endgroup$
$begingroup$
>but the sides are shrinking. Not really. Check your plotrange
$endgroup$
– Ivan
6 hours ago
$begingroup$
Yes, but this does not seem to answer the OP's question. Try including smaller values of $p$.
$endgroup$
– MarcoB
6 hours ago
2
$begingroup$
No, not that desperate ... By the way, you guys are tough! Imagine a classroom where a student gives an answer/suggestion that is not correct. Or a collaboration with somebody making a mistake. Seems that "Mathematica Stack Exchange" culture does not like people taking risks. May hurt creativity ... But we will have strictly precise, quality answers!!
$endgroup$
– mjw
6 hours ago
1
$begingroup$
@mjw "Seems that "Mathematica Stack Exchange" culture does not like people taking risks." To the contrary. I was really surprise that posts in this threads were downvoted so quickly. Downvotes on answers are actually very uncommon on this site.
$endgroup$
– Henrik Schumacher
6 hours ago
1
$begingroup$
@Ivan, yes, point well taken! Could be an artifact. But why is theArcLength[]
returning wrong results? Seems that in both cases Mathematica is undersampling ...
$endgroup$
– mjw
6 hours ago
|
show 9 more comments
$begingroup$
Manipulate[ParametricPlot[Cos[t]^p, Sin[t]^p, t, 0, Pi/2], p, 0.01, 1]
gives this plot at $p=0.01$:
(An unpreprocessing plot was here.)
Yes, looks to be approaching two sides of a square, but the sides are shrinking!
UPDATE:
p = 0.01; ParametricPlot[Cos[t]^p, Sin[t]^p, t, 0, Pi/2, Axes -> False, Frame -> True, PlotRange -> 0, 1.1, 0, 1.1]
So yes, the sides are not shrinking, but Mathematica seems to be missing some of the curve ...
$endgroup$
Manipulate[ParametricPlot[Cos[t]^p, Sin[t]^p, t, 0, Pi/2], p, 0.01, 1]
gives this plot at $p=0.01$:
(An unpreprocessing plot was here.)
Yes, looks to be approaching two sides of a square, but the sides are shrinking!
UPDATE:
p = 0.01; ParametricPlot[Cos[t]^p, Sin[t]^p, t, 0, Pi/2, Axes -> False, Frame -> True, PlotRange -> 0, 1.1, 0, 1.1]
So yes, the sides are not shrinking, but Mathematica seems to be missing some of the curve ...
edited 6 hours ago
answered 6 hours ago
mjwmjw
5879
5879
$begingroup$
>but the sides are shrinking. Not really. Check your plotrange
$endgroup$
– Ivan
6 hours ago
$begingroup$
Yes, but this does not seem to answer the OP's question. Try including smaller values of $p$.
$endgroup$
– MarcoB
6 hours ago
2
$begingroup$
No, not that desperate ... By the way, you guys are tough! Imagine a classroom where a student gives an answer/suggestion that is not correct. Or a collaboration with somebody making a mistake. Seems that "Mathematica Stack Exchange" culture does not like people taking risks. May hurt creativity ... But we will have strictly precise, quality answers!!
$endgroup$
– mjw
6 hours ago
1
$begingroup$
@mjw "Seems that "Mathematica Stack Exchange" culture does not like people taking risks." To the contrary. I was really surprise that posts in this threads were downvoted so quickly. Downvotes on answers are actually very uncommon on this site.
$endgroup$
– Henrik Schumacher
6 hours ago
1
$begingroup$
@Ivan, yes, point well taken! Could be an artifact. But why is theArcLength[]
returning wrong results? Seems that in both cases Mathematica is undersampling ...
$endgroup$
– mjw
6 hours ago
|
show 9 more comments
$begingroup$
>but the sides are shrinking. Not really. Check your plotrange
$endgroup$
– Ivan
6 hours ago
$begingroup$
Yes, but this does not seem to answer the OP's question. Try including smaller values of $p$.
$endgroup$
– MarcoB
6 hours ago
2
$begingroup$
No, not that desperate ... By the way, you guys are tough! Imagine a classroom where a student gives an answer/suggestion that is not correct. Or a collaboration with somebody making a mistake. Seems that "Mathematica Stack Exchange" culture does not like people taking risks. May hurt creativity ... But we will have strictly precise, quality answers!!
$endgroup$
– mjw
6 hours ago
1
$begingroup$
@mjw "Seems that "Mathematica Stack Exchange" culture does not like people taking risks." To the contrary. I was really surprise that posts in this threads were downvoted so quickly. Downvotes on answers are actually very uncommon on this site.
$endgroup$
– Henrik Schumacher
6 hours ago
1
$begingroup$
@Ivan, yes, point well taken! Could be an artifact. But why is theArcLength[]
returning wrong results? Seems that in both cases Mathematica is undersampling ...
$endgroup$
– mjw
6 hours ago
$begingroup$
>but the sides are shrinking. Not really. Check your plotrange
$endgroup$
– Ivan
6 hours ago
$begingroup$
>but the sides are shrinking. Not really. Check your plotrange
$endgroup$
– Ivan
6 hours ago
$begingroup$
Yes, but this does not seem to answer the OP's question. Try including smaller values of $p$.
$endgroup$
– MarcoB
6 hours ago
$begingroup$
Yes, but this does not seem to answer the OP's question. Try including smaller values of $p$.
$endgroup$
– MarcoB
6 hours ago
2
2
$begingroup$
No, not that desperate ... By the way, you guys are tough! Imagine a classroom where a student gives an answer/suggestion that is not correct. Or a collaboration with somebody making a mistake. Seems that "Mathematica Stack Exchange" culture does not like people taking risks. May hurt creativity ... But we will have strictly precise, quality answers!!
$endgroup$
– mjw
6 hours ago
$begingroup$
No, not that desperate ... By the way, you guys are tough! Imagine a classroom where a student gives an answer/suggestion that is not correct. Or a collaboration with somebody making a mistake. Seems that "Mathematica Stack Exchange" culture does not like people taking risks. May hurt creativity ... But we will have strictly precise, quality answers!!
$endgroup$
– mjw
6 hours ago
1
1
$begingroup$
@mjw "Seems that "Mathematica Stack Exchange" culture does not like people taking risks." To the contrary. I was really surprise that posts in this threads were downvoted so quickly. Downvotes on answers are actually very uncommon on this site.
$endgroup$
– Henrik Schumacher
6 hours ago
$begingroup$
@mjw "Seems that "Mathematica Stack Exchange" culture does not like people taking risks." To the contrary. I was really surprise that posts in this threads were downvoted so quickly. Downvotes on answers are actually very uncommon on this site.
$endgroup$
– Henrik Schumacher
6 hours ago
1
1
$begingroup$
@Ivan, yes, point well taken! Could be an artifact. But why is the
ArcLength[]
returning wrong results? Seems that in both cases Mathematica is undersampling ...$endgroup$
– mjw
6 hours ago
$begingroup$
@Ivan, yes, point well taken! Could be an artifact. But why is the
ArcLength[]
returning wrong results? Seems that in both cases Mathematica is undersampling ...$endgroup$
– mjw
6 hours ago
|
show 9 more comments
$begingroup$
I can only provide an alternative to bypass ArcLength
.
The points pts
of a quarter circle are scaled such that they lie on the desired curve; afterwards the length of the polygonal line is computed. You will still get problems for values of p
very close to 0
, but at least you may obtain a qualitatively correct plot (so I hope).
Certainly this method won't provide you with the best possible accuracy. The relative error between the arclength $ell$ of an arc and the length $s$ of a secant is roughly $|ell/s - 1| leq ell^2 , max(|kappa|)$ in the limit of $ell to 0$. Since the maximal curvature in of curve goes to $infty$ for $p to infty$, the quality of this approximation will reduce significantly for $p to 0$.
n = 10000;
pts = Transpose[Cos[Subdivide[0., Pi/2, n]], Sin[Subdivide[0., Pi/2, n]]];
L[p_] := With[x = pts/Power[Dot[(Abs[pts]^(1/p)), 1., 1.], p],
Total[Sqrt[Dot[Differences[x]^2, 1., 1.]]]
]
Plot[L[p], p, 0.001, 1]
$endgroup$
add a comment |
$begingroup$
I can only provide an alternative to bypass ArcLength
.
The points pts
of a quarter circle are scaled such that they lie on the desired curve; afterwards the length of the polygonal line is computed. You will still get problems for values of p
very close to 0
, but at least you may obtain a qualitatively correct plot (so I hope).
Certainly this method won't provide you with the best possible accuracy. The relative error between the arclength $ell$ of an arc and the length $s$ of a secant is roughly $|ell/s - 1| leq ell^2 , max(|kappa|)$ in the limit of $ell to 0$. Since the maximal curvature in of curve goes to $infty$ for $p to infty$, the quality of this approximation will reduce significantly for $p to 0$.
n = 10000;
pts = Transpose[Cos[Subdivide[0., Pi/2, n]], Sin[Subdivide[0., Pi/2, n]]];
L[p_] := With[x = pts/Power[Dot[(Abs[pts]^(1/p)), 1., 1.], p],
Total[Sqrt[Dot[Differences[x]^2, 1., 1.]]]
]
Plot[L[p], p, 0.001, 1]
$endgroup$
add a comment |
$begingroup$
I can only provide an alternative to bypass ArcLength
.
The points pts
of a quarter circle are scaled such that they lie on the desired curve; afterwards the length of the polygonal line is computed. You will still get problems for values of p
very close to 0
, but at least you may obtain a qualitatively correct plot (so I hope).
Certainly this method won't provide you with the best possible accuracy. The relative error between the arclength $ell$ of an arc and the length $s$ of a secant is roughly $|ell/s - 1| leq ell^2 , max(|kappa|)$ in the limit of $ell to 0$. Since the maximal curvature in of curve goes to $infty$ for $p to infty$, the quality of this approximation will reduce significantly for $p to 0$.
n = 10000;
pts = Transpose[Cos[Subdivide[0., Pi/2, n]], Sin[Subdivide[0., Pi/2, n]]];
L[p_] := With[x = pts/Power[Dot[(Abs[pts]^(1/p)), 1., 1.], p],
Total[Sqrt[Dot[Differences[x]^2, 1., 1.]]]
]
Plot[L[p], p, 0.001, 1]
$endgroup$
I can only provide an alternative to bypass ArcLength
.
The points pts
of a quarter circle are scaled such that they lie on the desired curve; afterwards the length of the polygonal line is computed. You will still get problems for values of p
very close to 0
, but at least you may obtain a qualitatively correct plot (so I hope).
Certainly this method won't provide you with the best possible accuracy. The relative error between the arclength $ell$ of an arc and the length $s$ of a secant is roughly $|ell/s - 1| leq ell^2 , max(|kappa|)$ in the limit of $ell to 0$. Since the maximal curvature in of curve goes to $infty$ for $p to infty$, the quality of this approximation will reduce significantly for $p to 0$.
n = 10000;
pts = Transpose[Cos[Subdivide[0., Pi/2, n]], Sin[Subdivide[0., Pi/2, n]]];
L[p_] := With[x = pts/Power[Dot[(Abs[pts]^(1/p)), 1., 1.], p],
Total[Sqrt[Dot[Differences[x]^2, 1., 1.]]]
]
Plot[L[p], p, 0.001, 1]
edited 6 hours ago
answered 6 hours ago
Henrik SchumacherHenrik Schumacher
56.6k577157
56.6k577157
add a comment |
add a comment |
Thanks for contributing an answer to Mathematica 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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f193346%2funexpected-result-from-arclength%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
$begingroup$
I get a warning from
NIntegrate
("Numerical integration converging too slowly; suspect one of the following: singularity...") when trying to evaluateL
for smallp
.$endgroup$
– MarcoB
6 hours ago
$begingroup$
@MarcoB I don't get any warnings when evaluating
L[1/100]
$endgroup$
– Ivan
6 hours ago