xZZTx Posted November 4, 2008 Share Posted November 4, 2008 I was just looking for a delta function and im kinda shocked i didn't find 1... is there really no delta in autoit or did i just not look well.. Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times.. Link to comment Share on other sites More sharing options...
JRowe Posted November 4, 2008 Share Posted November 4, 2008 Func Delta($val1, $val2) If $val1 = $val2 Then Return 1 EndIf Return 0 EndFunc Usage : $a = Delta(40, 20) $b = Delta(20,20) $a = 0 $b = 1 It's a relatively simple thing, unless you're thinking of a different delta. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 4, 2008 Share Posted November 4, 2008 Maybe he meant this kind of Delta (absolute difference): $iDelta = _Delta(2, -3) ConsoleWrite("Delta(2,-3) = " & $iDelta & @LF) Func _Delta($iX, $iY) Return Abs($iX - $iY) EndFunc Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
xZZTx Posted November 4, 2008 Author Share Posted November 4, 2008 Yes thats the delta i was talking about.. but is no one else shocked that it is not included?! it has almost all the other math functions but not a simple delta?! just seems a bit odd Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times.. Link to comment Share on other sites More sharing options...
Malkey Posted November 4, 2008 Share Posted November 4, 2008 (edited) Yes thats the delta i was talking about.. but is no one else shocked that it is not included?! it has almost all the other math functions but not a simple delta?! just seems a bit oddSilly me thought you meant the Differentiation Delta. I thought no one would want a function that subtracted two variables, my mistake. Anywho, this script is supposed to find the gradient at a point on a curve as delta X approaches zero. Local $iX_Value = 1 Local $Equation = "x^3 +3*x^2" Local $dfx = DeltaX($iX_Value, $Equation) MsgBox(0, "", " dy/dx of (" & $Equation & ") at " & $iX_Value & " along X-axis is " & @CRLF & _ $dfx & " Or, a gradient of " & Round(_ATan2($dfx, 1) * 180 / (4 * ATan(1)), 2) & " Degrees") ; $x is distance along x-axis ; $sEq is equation eg. "3*x^2" ; Returns (Delta Y)/(Delta X) , the gradient, of a curve scribed by the equation, $sEq, ; at the point on the curve ,$x along the x-axis. Func DeltaX($x, $sEq) Local $dfx = 0 Local $mean = 0 Local $y = StringReplace($sEq, "x", "$x") ;ConsoleWrite( " $y = " & $y & @CRLF) Local $ydx = StringReplace($sEq, "x", "($x+$dx)") ;ConsoleWrite( " $ydx = " & $ydx & @CRLF) For $a = -0.0000001 To 0.0000001 Step 0.0000002 $dx = $a $mean += (Execute($ydx) - Execute($y)) / $dx ;ConsoleWrite("$dx = " & $dx & " $mean = " & $mean & @CRLF) Next Return Round($mean / 2, 8) EndFunc ;==>DeltaX Func _ATan2(Const $nY, Const $nX) Return ATan($nY / $nX) + ((($nY <= 0) And ($nX < 0)) + (($nY > 0) And ($nX < 0))) * 4 * ATan(1) EndFunc ;==>_ATan2 Edited November 4, 2008 by Malkey Link to comment Share on other sites More sharing options...
JRowe Posted November 4, 2008 Share Posted November 4, 2008 Err, we seem to be experiencing an overload of delta. Good work, guys! [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
xZZTx Posted November 8, 2008 Author Share Posted November 8, 2008 well if any 1 does not get what i mean by delta it would be if $A = 10 then $A = 4 the delta would be -6 and from that if $A = 6 then Delta = 2 just had to clear that up Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times.. Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 8, 2008 Share Posted November 8, 2008 well if any 1 does not get what i mean by delta it would beif $A = 10 then $A = 4 the delta would be -6 and from that if $A = 6 then Delta = 2just had to clear that upThen your "Delta" is just the "-" subtraction operator. Why would you need a function for that? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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