Friday, May 2, 2008 - New servers are in! Click-in for more info!
VoyForums

VoyUser Login optional ] [ Main index ] [ Post a new message ] [ Search | Check update time ]


[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 04:42:22 07/02/04 Fri
Author: Erland
Author Host/IP: 138.106.143.116
Subject: Re: involute function
In reply to: Web Gear Services Ltd 's message, "Re: involute function" on 20:10:57 11/11/02 Mon

I have written a small python function that solves it. Have fun :-)

from Numeric import *

#************************
def arcinv(y, epsilon):
# Solves x from equation y=tan(x)-x
# using interval method
# Valid for y between 0-1.5533 (0-89 degrees)
# Findes root to function: f=(tan(x)-x) - y
# Solves for error less than epsilon
# ex: arcinv(0.8, 1e-12)

pi=4*arctan(1)
# input checking
if (y==0):
return 0
if (y>(tan(89*pi/180.)-89*pi/180.)):
return -2 # too big
if (y<0):
return -1 # negative

# calculations
x1=0
x2=89*pi/180.0
x=45*pi/180.0
f1=-y
f2=tan(x2)-x2-y
f=tan(x)-x-y

while(abs(f)>epsilon):
if(f<0):
x1=x
f1=f
elif(f>0):
x2=x
f2=f
x=(x2+x1)/2.0
f=tan(x)-x-y

return x
#************************

[ Next Thread | Previous Thread | Next Message | Previous Message ]


Replies:



VoyUser Login ] Not required to post.
Post a public reply to this message | Go post a new public message
* Notice: Posting problems? [ Click here ]
* HTML allowed in marked fields.
Message subject (required):

Name (required):

  Expression (Optional mood/title along with your name) Examples: (happy, sad, The Joyful, etc.) help)

  E-mail address (required):

Type your message here:


Notice: Copies of your message may remain on this and other systems on internet. Please be respectful.


Forum timezone: GMT-5
VF Version: 2.94, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2008 Voyager Info-Systems. All Rights Reserved.