JSThePatriot Posted December 10, 2006 Author Share Posted December 10, 2006 Obviously you all know about http://www.nr.com/. So, no need for me to post a link And the books.I think much of the C version should be possible to implement in au3 code. And yes I know and you know that the power in this case is not in speed but ease of use.. If we need raw speed for this kind of thing we should do it in a low level language. Or just by one of those nice libraries out there and use dllcall.Interesting. I am missing some posts. I am going to have to start at the beginning again.If there is a C library that is already created I can certainly create a plugin to encompass that functionality. That may be better as I stated before for more complex functions.The easy functions should be in a UDF. I dont think AutoIt is quite ready to start bundling Plugins like they do UDF's so we need to get a good chunk of them into UDF's, and the rest into a plugin. I can do both, and plan to do that. =DI really appreciate everyones support so far.If everyone wants to continue contributing please just provide headers for your functions with the proper information as described in the standards for UDF submission guidelines. I will include it in the Math Library of Functions.Thanks,JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
RazerM Posted December 10, 2006 Share Posted December 10, 2006 I don't think that would be right, if you wanted the reciprocal of 1/2 it would be 2/1 which is 2 not 1/1/2 like yoursDo you want a string returned like "2/1" or the actual value. If you do want the value then my function returns the correct value. If we pass 1/2 or 0.5 to my function it will return 1/0.5 which is 2 or 2/1. That is the reciprocal of 1/2. My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
HackerZer0 Posted December 11, 2006 Share Posted December 11, 2006 @HackerZer0: Why would you need functions for polynomials and quadratic formulas? To help with your homework?that also, but i was also thinking that with the quadratics, you could implement simple physics into a game or visual presentation... Earn money on CASHCRATE by sitting around doing nothing.. Link to comment Share on other sites More sharing options...
ConsultingJoe Posted December 11, 2006 Share Posted December 11, 2006 Do you want a string returned like "2/1" or the actual value. If you do want the value then my function returns the correct value. If we pass 1/2 or 0.5 to my function it will return 1/0.5 which is 2 or 2/1. That is the reciprocal of 1/2.LOL, My Bad, Your right. I got a 'C' in math Check out ConsultingJoe.com Link to comment Share on other sites More sharing options...
JSThePatriot Posted December 11, 2006 Author Share Posted December 11, 2006 LOL, My Bad, Your right. I got a 'C' in mathI'll remember that about your math submissions jk. lolJS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Uten Posted December 11, 2006 Share Posted December 11, 2006 that also, but i was also thinking that with the quadratics, you could implement simple physics into a game or visual presentation...There are some really good books called "math for game developers" or something similar out there. I bet you can find them as pdf or chm files with some patience and a search engine. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
BobiusMaximus Posted January 12, 2007 Share Posted January 12, 2007 I'd be interested in an easy way of finding the sin, or inverse sin, cos and tan of angles, I think it could be really useful for this program I'm trying to make, but IDK how to do them. -Bob Photoshop User and Noob AutoIt user. Link to comment Share on other sites More sharing options...
smstroble Posted January 12, 2007 Share Posted January 12, 2007 (edited) Threw together an _IsPrime function...Nevermind upon furthur research RazerM allready made one, and its a little bit better than mine. Edited January 12, 2007 by smstroble MUHAHAHAHAHA Link to comment Share on other sites More sharing options...
gear Posted January 18, 2007 Share Posted January 18, 2007 If you want to know more about math functions, you can go to http://functions.wolfram.com, there are almost all the functions you want to learn and use.Gear Link to comment Share on other sites More sharing options...
4gotn1 Posted January 18, 2007 Share Posted January 18, 2007 (edited) expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.1.14 (beta) Author: 4gotn1 Script Function: Tests if a number is even or odd. Returns 1 - If the number is even. Returns 2 - If the number is odd. #ce ---------------------------------------------------------------------------- Func _IsEven($eVal) Local $a = $eVal / 2 Select Case Round($a, 0) = $a Return 1 Case Round($a, 0) <> $a Return 0 EndSelect EndFunc #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.1.14 (beta) Author: 4gotn1 Script Function: Returns Pi of a circle #ce ---------------------------------------------------------------------------- Func _Pi($cRadius) $Sqrd = $cRadius * $cRadius Dim $vNum = ( 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609 * $Sqrd ) Dim $rNum = Round( $vNum, 12 ) Return $rNum EndFunc #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.1.14 (beta) Author: 4gotn1 Script Function: Converts to _Celcius and to _Fahrenheit Usage: _Celcius(32) will convert to 0 degrees celcius _Fahrenheit(0) will convert to 32 degrees fahrenheit Returns: The converted temperature #ce ---------------------------------------------------------------------------- Func _Celcius($fTemp) Local $Decimal = 5 / 9 Local $cTemp = $Decimal * ($fTemp - 32) Local $tNum = Round($cTemp, 2) Return $tNum EndFunc Func _Fahrenheit($cTemp) Local $Decimal = 9 / 5 Local $fTemp = ($cTemp * $Decimal) + 32 Local $tNum = Round($fTemp, 2) Return $tNum EndFunc Here's a quick _IsEven() and _Pi() i made a while ago -edit- Got bored, added a Fahrenheit and Celcius conversion func(s) too Edited January 18, 2007 by 4gotn1 Link to comment Share on other sites More sharing options...
Lakes Posted January 18, 2007 Share Posted January 18, 2007 Anyone have some example code to calculate/plot (draw any line) between two points, (IE plot a line to draw at any angle),I`m sure I`ve seen this in the forum before, but I can`t find it now.. Thanks. 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
Joke758 Posted January 18, 2007 Share Posted January 18, 2007 I agree with more Math UDF's. @trids expandcollapse popup;=============================================================================== ; ; Function Name: _Permutations ; Description:: Returns the number of permutations of size r, when taken from a set of size n ; Parameter(s): $n - The number of elements in the set ; $r - How many elements from this set to count permutations ; Requirement(s): None ; Return Value(s): Success - Number of Permutations, Failure - 0 and @error = 1 ; Author(s): RazerM ; ;=============================================================================== ; Func _Permutations($n, $r) If $r > $n Then Return SetError(1, 0, 0) Return _Factorial($n)/_Factorial($n-$r) EndFunc ;=============================================================================== ; ; Function Name: _Factorial ; Description:: Returns the product of all positive integers less than or equal to $number ; Parameter(s): $number - Any positive number greater than 0 ; Requirement(s): None ; Return Value(s): Success - Factorial of $number, Failure - -1 and @error = 1 ; Author(s): joke758, RazerM ; ;=============================================================================== ; Func _Factorial($number) If $number < 1 Then Return SetError(1, 0, -1) Local $n = 1 For $i = 1 To $number $n *= $i Next If $n = 0 Then Return SetError(1, 0, -1) Else Return $n EndIf EndFunc ;==>Factorial [u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own! Link to comment Share on other sites More sharing options...
DTV Posted March 9, 2007 Share Posted March 9, 2007 (edited) Post removed, Thanks tmo. Edited March 9, 2007 by DTV Link to comment Share on other sites More sharing options...
tmo Posted March 9, 2007 Share Posted March 9, 2007 (edited) @DTV: try ConsoleWrite(2^10)oÝ÷ Ù©ÝÊ°Y[zË«¦¸¬yÛkÉ«¢+Ù ½¹Í½±]É¥Ñ ÉxÀ¸Ô¤oÝ÷ Ù©ÝÊ°Y[yëÞj+zË«¦¸¬yئi×+(殶s`¤gVæ2ôæWwFöäFW&Föâb33c¶bÂb33c¶FbÂb33c·7F'BÂb33c¶67W&7 b33c·Òb33c·7F'@ Fð b33c·Òb33c·ÒWV7WFR7G&æu&WÆ6Rb33c¶bÂgV÷C·gV÷C²ÂgV÷C²b33c·gV÷C²òWV7WFR7G&æu&WÆ6Rb33c¶FbÂgV÷C·gV÷C²ÂgV÷C²b33c·gV÷C² VçFÂ&÷VæBWV7WFR7G&æu&WÆ6Rb33c¶bÂgV÷C·gV÷C²ÂgV÷C²b33c·gV÷C²Âb33c¶67W&7Ò &WGW&âb33c·¤VæDgVæ0 ¤6öç6öÆUw&FRôæWwFöäFW&FöâgV÷C·ã2³"§ÓgV÷C²ÂgV÷C³2§ã"³"gV÷C²Â Edited March 9, 2007 by tmo Link to comment Share on other sites More sharing options...
crashdemons Posted March 14, 2008 Share Posted March 14, 2008 This may be too stupid to include, but I use it time and time again - I have also posted it elsewhere. Convert/Find a point on a (one-dimensional)range when the range is resized or rescaled. the idea being a point (2) on a line segment (from 0 - 10) could be converted to a proportional point on a line segment from (-10 - 73) Func _ConvertRange($i, $n, $x, $nb, $xb) ;converts a number in a range of numbers ;proportionally to number in another range ;despite whether the numbers are negative or not $C = ((($i - $n) / ($x - $n)) * ($xb - $nb)) + $nb Return $C EndFunc I'd also like to request a function - since I can't seem to find it. An Arcsine function with an adjustable precision...(ASin only seems to work towards 14 places?) My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.) Link to comment Share on other sites More sharing options...
buzonjl Posted March 14, 2008 Share Posted March 14, 2008 integrals?, equation systems, derivatives, physic formulas, etc. ? Link to comment Share on other sites More sharing options...
Alek Posted March 14, 2008 Share Posted March 14, 2008 (edited) This may be too stupid to include, but I use it time and time again - I have also posted it elsewhere. Convert/Find a point on a (one-dimensional)range when the range is resized or rescaled. the idea being a point (2) on a line segment (from 0 - 10) could be converted to a proportional point on a line segment from (-10 - 73) Func _ConvertRange($i, $n, $x, $nb, $xb) ;converts a number in a range of numbers ;proportionally to number in another range ;despite whether the numbers are negative or not $C = ((($i - $n) / ($x - $n)) * ($xb - $nb)) + $nb Return $C EndFuncoÝ÷ Øýu©l¢X¤zÚ+z«²Öºw-ìw!ƧßÛlyé¡ø§v+@ ܲ)Þ~éܶ*'Â+ajvë-i¹^¦·È¨¢åÊÇËhÂä¶Û5âZqë?ªê-ze·¬¶§)ඬ(!¶¯y¸§¶«m²-¶h²Ù²ªê- ïz´Zªº_ºw-ÛºØ$²X¤z,²Ú,ئ-Ö°)^j ³¥«¢+ÙÕ¹} ½¹ÙÉÐ ÀÌØíÍ}$°ÀÌØíÍ}%}1½ÜôаÀÌØíÍ}%}!¥ ôÈÀ°ÀÌØíÍ}=}1½ÜôÀ°ÀÌØíÍ}=}!¥ ôÄÀÀ¤(IÑÕɸ ÀÌØíÍ}=}!¥ ´ÀÌØíÍ}=}1½Ü¤¼ ÀÌØíÍ}%}!¥ ´ÀÌØíÍ}%}1½Ü¤¤¨ ÀÌØíÍ}$´ÀÌØíÍ}%}1½Ü¤¤¬ÀÌØíÍ}=}1½Ü)¹Õ¹ Edited March 14, 2008 by Alek [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
Paulie Posted March 15, 2008 Share Posted March 15, 2008 It's been done i know, but here is a quick-fix quadratic that i use when i leave my calculator in my locker. MsgBox(0,"", _Quadratic(1,4,2)) Func _Quadratic($a, $b, $c) $ID = ($b^2)-(4*$a*$c) If $ID<0 or $a = 0 then Return "#Undef" $Result1 = (-1*$b+Sqrt($id))/(2*$a) $Result2 = (-1*$b-Sqrt($id))/(2*$a) Return "x= "&$Result1&" or "&$Result2 EndFunc Link to comment Share on other sites More sharing options...
martin Posted March 15, 2008 Share Posted March 15, 2008 It's been done i know, but here is a quick-fix quadratic that i use when i leave my calculator in my locker. MsgBox(0,"", _Quadratic(1,4,2)) Func _Quadratic($a, $b, $c) $ID = ($b^2)-(4*$a*$c) If $ID<0 or $a = 0 then Return "#Undef" $Result1 = (-1*$b+Sqrt($id))/(2*$a) $Result2 = (-1*$b-Sqrt($id))/(2*$a) Return "x= "&$Result1&" or "&$Result2 EndFunc That's a good one, but it would be more useful as a function if it returned results rather than a string. Also, there is no reason it couldn't return results if $a is zero. $Ans = _Quadratic(1, 4, 2) If @error = 1 Then MsgBox(0, 'ERROR', 'Cannot solve that.') Else MsgBox(0, "", "x = " & $Ans[0] & " or x = " & $Ans[1]) EndIf Func _Quadratic($a, $b, $c) Local $Result[2] If $a = 0 Then If $b = 0 Then Return SetError(1, 2,0) $Result[0] = -$c / $b $Result[1] = $Result[0] Return $Result EndIf $ID = ($b ^ 2) - (4 * $a * $c) If $ID < 0 Then Return SetError(1, 1, 0) $Result[0] = (-$b + Sqrt($ID)) / (2 * $a) $Result[1] = (-$b - Sqrt($ID)) / (2 * $a) Return $Result EndFunc ;==>_Quadratic Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Paulie Posted March 15, 2008 Share Posted March 15, 2008 (edited) If $a = 0 then in the quadratic formula:-b +- sqrt( (b^2) - (4*a*c)) 2aThen when you divide by 2a, are you not dividing by zero? thus undefined? Edited March 15, 2008 by Paulie 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