Ask Your Question
1

how to calculate distance between origin and furthest point on graph?

asked 2012-11-26 08:55:31 -0500

anonymous user

Anonymous

updated 2015-01-13 14:28:31 -0500

FrédéricC gravatar image

Hello! I am new on this forum so forgive me if I don't respect all "rules" or if someone answered already this question. image description

If you take a look at the image, I just want to know how to calculate the distance between origin and the furthest dot on the graph.

code:

var('t')
ff = (exp(cos(t)) - 2*cos(4*t) + sin(t/12)^5)
parametric_plot((ff*cos(t),ff*sin(t)), (t,0,2*pi) , fill=True, fillcolor='orange', figsize=[3,3])
edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
1

answered 2012-11-26 12:52:56 -0500

calc314 gravatar image

updated 2012-11-26 16:20:52 -0500

The maximum you need occurs for $t$ in $[0,\pi/4]$. So, we can look for the maximum of the distance from the origin to the point over that interval as follows.

var('t')
ff = (exp(cos(t)) - 2*cos(4*t) + sin(t/12)^5)
v=vector((ff*cos(t),ff*sin(t)))
w=v[0]^2+v[1]^2
ans=w.find_maximum_on_interval(0,pi/4)
ans

which gives

(16.48247427444069, 0.74104978802589871)

So, the length is $\sqrt{16.4825}=4.060$.

The point at which this max occurs is given by:

v.subs(t=ans[1])

(2.99520450583, 2.74066127836)

edit flag offensive delete link more

Comments

Good catch - I was about to point out the missing sqrt :)

kcrisman gravatar imagekcrisman ( 2012-11-26 16:25:21 -0500 )edit
0

answered 2012-11-26 16:25:04 -0500

kcrisman gravatar image

The above is a more or less analytic answer. It's possible (perhaps not advisable) to give one from the data itself, though this is probably not robust.

sage: P = parametric_plot((ff*cos(t),ff*sin(t)), (t,0,2*pi) , fill=True, fillcolor='orange', figsize=[3,3])
sage: p = P[0]sage: Z = zip(p.xdata,p.ydata)
sage: W = [(vector(z).norm(),z) for z in Z]
sage: W.sort()
sage: W[-5:]
[(4.07480714946, (3.0424694670479733, -2.7106148467446545)), (4.0760691956, (2.9829635305007063, -2.7778172479461185)), (4.07657737686, (3.028814532960587, -2.7285097827236444)), (4.07721170912, (2.99905277507801, -2.762125589698095)), (4.07738007646, (3.01433945952578, -2.7456849620178922))]

The last two points correspond to the outer parts of the biggest leaves in your picture. Note that this involves a lot of rounding error, relatively speaking. Using

sage: P = parametric_plot((ff*cos(t),ff*sin(t)), (t,0,2*pi) , fill=True, fillcolor='orange', plot_points=400)

gives things slightly closer together.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-11-26 08:55:31 -0500

Seen: 1,185 times

Last updated: Nov 26 '12