Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

# Scientific Maths - infinite precision Mathematics Library

96 replies to this topic
• Members
• 1323 posts
• Last active: Nov 14 2015 06:56 PM
• Joined: 30 Jan 2013

Scientific Maths() v 3.43 [filename = Maths.ahk]

Aim - Providing high precision Mathematical functions for infinetly large numbers which are not supported natively in AHK

Irrelative functions removed (Antilog, nthRoot, Roots..) and are now located at https://github.com/a...h-Functions.ahk

Highlights --

• SM_Solve() - Solve expressions in variables and expressions in expressions (See documentation) . They can be infinetly large
• Add, subtract ( via SM_Add() ) infinetly large numbers . They can be + , - or decimals ...
• Multiply infinetly large numbers ( via SM_Multiply() ). They can be + , - or decimals ...
• Divide infinetly large numbers (via SM_Divide() ) . They can be + , - or decimals ...
• SM_UniquePmt() - Unique permutaion of a series with respect to a number
• SM_fact() - factorial . uses Multiply() for high end numbers
• SM_Mod() - Mod . Supports large dividends and Divisors
• SM_Floor() - Floor . Supprots large numbers
• SM_Round() - Round . Large Numbers
• SM_Ceil() - Ceil
• SM_Greater - Compare infinitely large numbers
• SM_Prefect - Changes an infinetly large number to most suitable form
• SM_toExp - Convert a number to Exponent form
• SM_fromExp - Convert a sci number to real number
• SM_Pow() - Power . Supprorts large powers and numbers
• SM_e(n) - e to the power n

Please Note that by infinetly large numbers, it doesn't mean that the functions dont support small numbers . They support everything.

Please transfer numbers in functions that handle large numbers as strings like
Evaluate("23899999999999999999999999999999999999999999999999", "2389999999999999999999999999999238999")
Solve() supports Nesting via (...) brackets , factorial via ! sign and power via ^ sign.

Documenation     [ must see before use ]

Changes
CHANGELOG

https://github.com/A...h-functions.ahk - Maths Useful functions collection by me
http://www.autohotke...or-my-homework/ - High School Maths functions
http://www.autohotke...pic.php?t=26435 - Popup calulator (More functions)

Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan

• Members
• 1323 posts
• Last active: Nov 14 2015 06:56 PM
• Joined: 30 Jan 2013

Known Bugs

[NONE]

Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan

• Members
• 1323 posts
• Last active: Nov 14 2015 06:56 PM
• Joined: 30 Jan 2013

Examples - See Documentation

Changelog - https://github.com/a...s-Changelog.txt

Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan

• Members
• 14 posts
• Last active: May 27 2013 10:09 AM
• Joined: 17 May 2013

omg.

this is amazing

I have not found bugs till yet . if i find them , I will post it here .

• Members
• 1323 posts
• Last active: Nov 14 2015 06:56 PM
• Joined: 30 Jan 2013

omg.

this is amazing

I have not found bugs till yet . if i find them , I will post it here .

Thank you. Thank you

I was so anxious . Good that you haven't found bugs .Very good.

Any function you feel is missing in AHK, something that can be added. If yes, please don't hesitate ..

Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan

• Members
• 1704 posts
• Last active: Nov 19 2015 11:58 AM
• Joined: 10 Mar 2011
https://github.com/A...tions/Maths.ahk

yikes man, indent

• Members
• 1323 posts
• Last active: Nov 14 2015 06:56 PM
• Joined: 30 Jan 2013

Hold On, is that too much indentation or too less .

If it seems too much ,it isn't, that's a github property

if it is too less, that's the best I can do.

Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan

• Members
• 1704 posts
• Last active: Nov 19 2015 11:58 AM
• Joined: 10 Mar 2011
too little!

```if count not in 1,3		;Add
{
loop,
{
if (carry)
digit := SubStr(number1,1 - A_Index, 1) + SubStr(number2, 1 - A_index, 1) + 1
else
digit := SubStr(number1,1 - A_Index, 1) + SubStr(number2, 1 - A_index, 1)
```
wat

• Members
• 1323 posts
• Last active: Nov 14 2015 06:56 PM
• Joined: 30 Jan 2013

@guest3456

That's Github . Tab Sizes are bigger. Copy the hell in notepad and see the difference .

Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan

• Members
• 703 posts
• Last active: Apr 02 2016 05:05 AM
• Joined: 07 Jun 2010

I think he means do this:

```if count not in 1,3  ;Add
{
loop,
{
if (carry)
digit := SubStr(number1,1 - A_Index, 1) + SubStr(number2, 1 - A_index, 1) + 1
else
digit := SubStr(number1,1 - A_Index, 1) + SubStr(number2, 1 - A_index, 1)```

• Members
• 1704 posts
• Last active: Nov 19 2015 11:58 AM
• Joined: 10 Mar 2011
lol yes ^^ what he said. you've got a lot of nested if's... i don't know how you can follow the structure of your own code

• Members
• 703 posts
• Last active: Apr 02 2016 05:05 AM
• Joined: 07 Jun 2010

I haven't run through your code fully so i'm not sure if this would ever happen but this particular set of if/else's might have problems:

param defaults to 8.99 if it's ever exactly one of those between numbers.

```if mantsa between 0 and 0.3009
param := 0.99
else if mantsa between 0.3009 and 0.4770
param := 1.99
else if mantsa between 0.4770 and 0.6019
param := 2.99
else if mantsa between 0.6019 and 0.6988
param := 3.99
else if mantsa between 0.6988 and 0.7780
param := 4.99
else if mantsa between 0.7780 and 0.8449
param := 5.99
else if mantsa between 0.8449 and 0.9029
param := 6.99
else if mantsa between 0.9029 and 0.9541
param := 7.99
else
param := 8.99```

If you run this example code you can see what I mean:

```TestNumbers := "0,0.3009,0.4770,0.6019,0.6988,0.7780,0.8449,0.9029,0.9541"
Loop, Parse, TestNumbers, `,
{
mansta := A_LoopField
if mantsa between 0 and 0.3009
param := 0.99
else if mantsa between 0.3009 and 0.4770
param := 1.99
else if mantsa between 0.4770 and 0.6019
param := 2.99
else if mantsa between 0.6019 and 0.6988
param := 3.99
else if mantsa between 0.6988 and 0.7780
param := 4.99
else if mantsa between 0.7780 and 0.8449
param := 5.99
else if mantsa between 0.8449 and 0.9029
param := 6.99
else if mantsa between 0.9029 and 0.9541
param := 7.99
else
param := 8.99

MsgBox % "mansta is: " mansta "`nparam is: " param
}
```

• Moderators
• 1119 posts
• Last active: May 02 2015 06:05 PM
• Joined: 23 Aug 2010

Actually, I believe If x Between y And z has inclusive bounds; it will match if the value is exactly equal to one of the numbers.

• Members
• 703 posts
• Last active: Apr 02 2016 05:05 AM
• Joined: 07 Jun 2010

Actually, I believe If x Between y And z has inclusive bounds; it will match if the value is exactly equal to one of the numbers.

It doesn't, if you run the example code I posted it always shows param as 8.99.

• Moderators
• 6367 posts
• Last active: Nov 30 2018 08:50 PM
• Joined: 18 Mar 2008

It doesn't, if you run the example code I posted it always shows param as 8.99.

I'll bet if you look at these two lines of code long enough you'll see why  :

```mansta := A_LoopField
if mantsa between 0 and 0.3009```