Toady Posted April 2, 2007 Share Posted April 2, 2007 ;======================================================= ; Function: _SlopeOfTangent ; Author: Toady ; ; Action: Calculates the slope of of a tangent to a curve ; Same as calculating the derivative in calculus ; ; $expr: String - Mathmatical expression ; $var: String - Independent variable ; $at_point: Number - x coordinate to evaluate slope ; $places: Integer - Places to round result (default = 4) ; ; Ex) y = x^2 ; dy/dx = 2x ; dy/dx(2) = 4 ; MsgBox(0,"Slope",_SlopeOfTangent("x^2","x",2)) ;====================================================== Func _SlopeOfTangent($expr,$var,$at_point,$places=4) Local $dx = 0.00000001 Local $x = $at_point Local $y = $x + $dx Local $slope = Execute(StringReplace($expr,$var,"$y")) - Execute(StringReplace($expr,$var,"$x")) Return Round($slope/$dx,$places) EndFunc ;_SlopeOfTangent()==> Here is a script I had to write for one of my courses in school. It is the same as calculating the derivative of a function to determine the slope of a tangent point. Very simple! www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
jvanegmond Posted April 2, 2007 Share Posted April 2, 2007 That is just too simple... github.com/jvanegmond Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted April 2, 2007 Share Posted April 2, 2007 That is just too simple... would you have prefered it to be over 100 lines, or a full blown #include? Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now