Equation Solver - $solve
mIRC Code
+ 1 likes
Please Register to submit score.
| Average Score | 7.6 (of 7 scores) |
| Date Added | Dec 19, 2007 |
| Last Updated | Dec 16, 2008 |
| Tags | cubic equation linear quadratic solver |
Description
Snippet to find multiple solutions to any equations
Usage:
*$solve(<equation>)
Things to Note:
*That will return what the solution is.
*Only one unknown can be in the equation.
*Currently the unknown has to be x
*If there is no "=" in the equation it will assume the equation equals 0.
*Functions supported: sin,asin,cos,acos,tan,atan,log,sqrt
*You can input equations as you would write them, e.g. 2sin(2x) = 1
*It will return a string with solutions separated by commas.
*returns $false if it cannot solve even 1 solution.
*put a bracket around the expression when using a function. Such as sin(x) or sqrt(x). This will not be required in the next update.
Examples:
*$solve(2x+4=-20) will return -12
*$solve(10x^2 - 17x=-3) will return 1.5,0.2
*$solve(x^3/6 + x^2/2 + x/3) will return 0,-1,-2
*$solve(2sin(2x) = 1) will return 15
*$solve((0.01x^8-0.4x^6+10x^3)-20x=1) will return 5.962365,2.874398,1.549226,-0.050063,-1.329
Usage:
*$solve(<equation>)
Things to Note:
*That will return what the solution is.
*Only one unknown can be in the equation.
*Currently the unknown has to be x
*If there is no "=" in the equation it will assume the equation equals 0.
*Functions supported: sin,asin,cos,acos,tan,atan,log,sqrt
*You can input equations as you would write them, e.g. 2sin(2x) = 1
*It will return a string with solutions separated by commas.
*returns $false if it cannot solve even 1 solution.
*put a bracket around the expression when using a function. Such as sin(x) or sqrt(x). This will not be required in the next update.
Examples:
*$solve(2x+4=-20) will return -12
*$solve(10x^2 - 17x=-3) will return 1.5,0.2
*$solve(x^3/6 + x^2/2 + x/3) will return 0,-1,-2
*$solve(2sin(2x) = 1) will return 15
*$solve((0.01x^8-0.4x^6+10x^3)-20x=1) will return 5.962365,2.874398,1.549226,-0.050063,-1.329
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 19, 2007 4:55 pm
Posted on Dec 19, 2007 4:55 pm
Ooh, something mathematic.
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 19, 2007 4:59 pm
Posted on Dec 19, 2007 4:59 pm
| Code: |
*$solve(2x+4=-20) will return -12 |
so this can do algebra? can you only use x as a variable?
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 19, 2007 5:02 pm
Posted on Dec 19, 2007 5:02 pm
Yes it can do algebra, it solve much more complicated equations than this. x is currently the only variable, I was going to add $solve(<equation>,<var>) and then it would solve for that variable, but it seemed a bit pointless. If you think it would be a lot better than I'll do it.
I would like to know how I can increase the score of 6, what is there to improve? Would really appreciate any tips you all have. Thanks
I would like to know how I can increase the score of 6, what is there to improve? Would really appreciate any tips you all have. Thanks
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 19, 2007 5:04 pm
Posted on Dec 19, 2007 5:04 pm
| Quote: |
x is currently the only variable, I was going to add $solve(<equation>,<var>) and then it would solve for that variable, but it seemed a bit pointless. If you think it would be a lot better than I'll do it. |
nah that fine, i was just wondering
And i didn't give it a six, i give it an eight, i really like this :P
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 19, 2007 5:45 pm
Posted on Dec 19, 2007 5:45 pm
thanks a lot,
I would just like to point out that it's different from all other solvers that it finds all the solutions for all quadratics and cubics and up to whatever, including trig functions as well. Thanks mountaindew, this is my first snippet I've submitted so I would really like constructive criticism if you have any. :)
I would just like to point out that it's different from all other solvers that it finds all the solutions for all quadratics and cubics and up to whatever, including trig functions as well. Thanks mountaindew, this is my first snippet I've submitted so I would really like constructive criticism if you have any. :)
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 19, 2007 5:47 pm
Posted on Dec 19, 2007 5:47 pm
i gave ya 9 outta 10 just cause i cant read it lol and i suck @ math so yeah.`-.-´
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 19, 2007 6:59 pm
Posted on Dec 19, 2007 6:59 pm
sweet as.!!!!! nicely done
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 19, 2007 8:18 pm
Posted on Dec 19, 2007 8:18 pm
Personnally, I would appreciate very much if you could post a fully-commented version so as to understand the internals of your solver. As is actually, I can only judge the coding (which by the way, is very good) and not the algorithm. And that's annoying. I like to appreciate algorithms as well as what the coder did to do it!
;)
;)
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 19, 2007 8:57 pm
Posted on Dec 19, 2007 8:57 pm
lol i dont think any of us can understand the coding :P
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 19, 2007 9:43 pm
Posted on Dec 19, 2007 9:43 pm
Very good coding, but the examples used provided returned errors:
First example: -26
Second example: $false
Third example : returned correct with the answer you provided
Fourth example: 0
Fifth example: $false
Sixth example: $false
And here are a few of the tests I ran:
$solve(4x*2=20): $false (However $solve(x*2*4=20) worked)
$solve(x*3+4=7): Returned the correct answer (1)
Doesn't seem to support things like 4x. =(
First example: -26
Second example: $false
Third example : returned correct with the answer you provided
Fourth example: 0
Fifth example: $false
Sixth example: $false
And here are a few of the tests I ran:
$solve(4x*2=20): $false (However $solve(x*2*4=20) worked)
$solve(x*3+4=7): Returned the correct answer (1)
Doesn't seem to support things like 4x. =(
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 20, 2007 4:26 am
Posted on Dec 20, 2007 4:26 am
Thanks for the feedback guys, Rebellious, I've tested all the examples and all the 4x's and they all work. Not sure why they don't with yours. Would be greatful if anyone else can test it? Thanks
$solve(4x*2=20) returns 2.5. I've made the parser include things like 4x. Maybe I uploaded a dodgy version version I'll check.
$solve(4x*2=20) returns 2.5. I've made the parser include things like 4x. Maybe I uploaded a dodgy version version I'll check.
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 20, 2007 7:31 am
Posted on Dec 20, 2007 7:31 am
Haha yeah, I uploaded a dodgy version, sorry guys, updated and fixed :)
TropNul I'll try to add comments later on today or by tomorrow if I get time.
However I need some help with a regsubex expression, I coded this over 6 months ago and only learnt regex over the weekend especially for this. I have forgotton it all...
I need it so that if there is a letter before an x, the x gets replaced to (x). Eg, sinx becomes sin(x) and cosx becomes cos(x) etc. I'm not sure if this is possible but if xx could be (x)(x) as well?
Note: the log function in mIRC seems to be bugged. Rather than being the standard base 10, it works at base 2.718281306 which is really weird. Anyone know how to get base 10 in mIRC? For this reason the log solve function is acting very strangely. It was base 10 in previous versions of mIRC..
TropNul I'll try to add comments later on today or by tomorrow if I get time.
However I need some help with a regsubex expression, I coded this over 6 months ago and only learnt regex over the weekend especially for this. I have forgotton it all...
I need it so that if there is a letter before an x, the x gets replaced to (x). Eg, sinx becomes sin(x) and cosx becomes cos(x) etc. I'm not sure if this is possible but if xx could be (x)(x) as well?
Note: the log function in mIRC seems to be bugged. Rather than being the standard base 10, it works at base 2.718281306 which is really weird. Anyone know how to get base 10 in mIRC? For this reason the log solve function is acting very strangely. It was base 10 in previous versions of mIRC..
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 20, 2007 10:27 am
Posted on Dec 20, 2007 10:27 am
I got the same error on many different mIRC's (Primarily 6.21 & 6.31), another example: $solve(4x=20)
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 20, 2007 10:27 am
Posted on Dec 20, 2007 10:27 am
| Quote: |
| another example: $solve(4x=20) |
Sorry for the d-post.
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 20, 2007 5:31 pm
Posted on Dec 20, 2007 5:31 pm
Really? I get 4x = 20 returns 5. Ok I've replaced the code with the one I have exactly. I then deleted my code and pasted the one on here and it still gave me 5. So the one uploaded is definitely the right one now. Sorry about the mix up :)
ty for testing it though
TropNul I have added comments to my code to how it works. If you need anything else clearing up just let me know.
ty for testing it though
TropNul I have added comments to my code to how it works. If you need anything else clearing up just let me know.
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 20, 2007 7:23 pm
Posted on Dec 20, 2007 7:23 pm
Excellent. It seems to work now. :)
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 20, 2007 8:54 pm
Posted on Dec 20, 2007 8:54 pm
Really appreciate the commented version. :*).
Thank you very much. Now I'll read it with more pleasure. :)
Good job !
Thank you very much. Now I'll read it with more pleasure. :)
Good job !
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 21, 2007 11:26 am
Posted on Dec 21, 2007 11:26 am
Thanks for feedback guys :)
Could anyone help me with this at all? I want to just do $solve(sinx = 0.23) without having to do sin(x). Cheers
| Quote: |
| However I need some help with a regsubex expression, I coded this over 6 months ago and only learnt regex over the weekend especially for this. I have forgotton it all... I need it so that if there is a letter before an x, the x gets replaced to (x). Eg, sinx becomes sin(x) and cosx becomes cos(x) etc. I'm not sure if this is possible but if xx could be (x)(x) as well? |
Could anyone help me with this at all? I want to just do $solve(sinx = 0.23) without having to do sin(x). Cheers
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 21, 2007 1:16 pm
Posted on Dec 21, 2007 1:16 pm
Here's a solution.
Usage (as an identifier): $rtrig.x(string)
I've included only sin, cos and tan functions. You can add what you want in the alternating group " (sin|cos|tan) ".
Cordialement :)
| Code: |
alias rtrig.x { return $regsubex($1-,/(sin|cos|tan)(x+)/g,\1 $+ $regsubex(s,\2,/(x)/g,$+($chr(40),x,$chr(41)))) } |
Usage (as an identifier): $rtrig.x(string)
I've included only sin, cos and tan functions. You can add what you want in the alternating group " (sin|cos|tan) ".
Cordialement :)
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 21, 2007 1:19 pm
Posted on Dec 21, 2007 1:19 pm
It seems that backslashes are truncated when posting. I can't seen any of them in my last post.
Here's the code with plain 'backslash' in it which are to be replaced for sure.
alias rtrig.x {
return $regsubex($1-,/(sin|cos|tan)(x+)/g,'backslash'1 $+ $regsubex(s,'backslash'2,/(x)/g,$+($chr(40),x,$chr(41))))
}
Here's the code with plain 'backslash' in it which are to be replaced for sure.
alias rtrig.x {
return $regsubex($1-,/(sin|cos|tan)(x+)/g,'backslash'1 $+ $regsubex(s,'backslash'2,/(x)/g,$+($chr(40),x,$chr(41))))
}
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 21, 2007 1:21 pm
Posted on Dec 21, 2007 1:21 pm
Last try ...
[code=mirc]
alias rtrig.x {
return $regsubex($1-,/(sin|cos|tan)(x+)/g,\1 $+ $regsubex(s,\2,/(x)/g,$+($chr(40),x,$chr(41))))
}
[/code=mirc]
[mirc]
alias rtrig.x {
return $regsubex($1-,/(sin|cos|tan)(x+)/g,\1 $+ $regsubex(s,\2,/(x)/g,$+($chr(40),x,$chr(41))))
}
[/mirc]
[code=mirc]
alias rtrig.x {
return $regsubex($1-,/(sin|cos|tan)(x+)/g,\1 $+ $regsubex(s,\2,/(x)/g,$+($chr(40),x,$chr(41))))
}
[/code=mirc]
[mirc]
alias rtrig.x {
return $regsubex($1-,/(sin|cos|tan)(x+)/g,\1 $+ $regsubex(s,\2,/(x)/g,$+($chr(40),x,$chr(41))))
}
[/mirc]
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 21, 2007 1:24 pm
Posted on Dec 21, 2007 1:24 pm
The BBCODE tags are just
| Code: |
| & |
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 21, 2007 1:25 pm
Posted on Dec 21, 2007 1:25 pm
.. [.code] and [./code] without the .'s ;)
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 21, 2007 1:43 pm
Posted on Dec 21, 2007 1:43 pm
Yep, but backslashes are truncated. Maybe I should double-backslash.
test:
test:
| Code: |
| \\ |
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 21, 2007 1:44 pm
Posted on Dec 21, 2007 1:44 pm
Wow ! ok ok now, here's the code lol.
| Code: |
alias rtrig.x { return $regsubex($1-,/(sin|cos|tan)(x+)/g,\\1 $+ $regsubex(s,\\2,/(x)/g,$+($chr(40),x,$chr(41)))) } |
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 21, 2007 2:08 pm
Posted on Dec 21, 2007 2:08 pm
Wow thanks a lot! I added the code (under the trans alias) and you in the credits :)
Updated it guys.
Unfortunately I found another bug, if you have more than one function in the code, the solver doesn't work. So if you try to solve (sinx)(cosx)=0.2 no luck. I rooted the problem to be the with parser, after it sorts out the first function, it doesn't continue to the next one, it just stops.
The parser does this: $parser(sin(30)-3.4) returns 0.5-3.4 and then you can put that into $calc. However if you do (sin(30)+sin(30)-3.4), it returns 0.5+0-3.4. I really have no idea how to solve it. the stript function doesn't need any editing, it's just the regsubex of the parser, but I have no idea how to do it, I know next to nothing about regex now.
It's not that important anyway, but just would be nice to have a complete solver. Thanks a lot for before though TropNul :)
Updated it guys.
Unfortunately I found another bug, if you have more than one function in the code, the solver doesn't work. So if you try to solve (sinx)(cosx)=0.2 no luck. I rooted the problem to be the with parser, after it sorts out the first function, it doesn't continue to the next one, it just stops.
The parser does this: $parser(sin(30)-3.4) returns 0.5-3.4 and then you can put that into $calc. However if you do (sin(30)+sin(30)-3.4), it returns 0.5+0-3.4. I really have no idea how to solve it. the stript function doesn't need any editing, it's just the regsubex of the parser, but I have no idea how to do it, I know next to nothing about regex now.
| Code: |
| alias parser return $regsubex($regsubex($1,/(?<=sin|asin|acos|atan|cos|tan|log|sqrt)(\\d+)/g,(\\t)),/((?:sin|asin|acos|atan|cos|tan|log|sqrt).+?\\051)/g,$($ $+ $stript(\\t,1) $+ $chr(40) $+ $stript(\\t) $+ $chr(41) $+ .deg,2)). |
It's not that important anyway, but just would be nice to have a complete solver. Thanks a lot for before though TropNul :)
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 22, 2007 4:29 am
Posted on Dec 22, 2007 4:29 am
I've done something that does what you need without the use of $stript.
Tell me if it suits exactly your needs.
Cordialement :)
| Code: |
| alias parser { return $regsubex($1-,/((?:sin|asin|acos|atan|cos|tan|log|sqrt)\\050(?:\\d+(?:\\.\\d+)?)\\051)/g,$($ $+ \\1 $+ .deg,2)) } |
Tell me if it suits exactly your needs.
Cordialement :)
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 22, 2007 12:12 pm
Posted on Dec 22, 2007 12:12 pm
I think that another bug will raise up once you fix this one. :s
Because, the $regsubexes are not named, it conflicts with previous $regmls and recalling for a previous match if another $regsubex was called. Therefore, just by naming differently each $regsubex, it shall be fixed. If that fixes future bugs, then great, otherwise, I'll help again. :)
(Or any other person who knows regexps !)
Cordialement
Because, the $regsubexes are not named, it conflicts with previous $regmls and recalling for a previous match if another $regsubex was called. Therefore, just by naming differently each $regsubex, it shall be fixed. If that fixes future bugs, then great, otherwise, I'll help again. :)
(Or any other person who knows regexps !)
Cordialement
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 22, 2007 12:23 pm
Posted on Dec 22, 2007 12:23 pm
you should have it work for Y also, ex. Y=2x+5 < mx+b equation for linear graphing. i think that that would be a good thing to try =] good job
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 22, 2007 5:39 pm
Posted on Dec 22, 2007 5:39 pm
Hey TropNul I'm extremely grateful for all your help! You're code works well, except you're right, theres a bug. But I don't think it's because of what you said, I spent an hour or so trying to figure out what it was because it was very confusing. I would try to solve sin(x)=90 (which should return $false) and it would always return -2. It would return false under the old parser and even through all the checks to make sure the answer was legit it still always returned -2. It turned out that the parser couldn't support negative numbers with the functions, so sin(-2) wouldn't work. I'm not quite sure but all I need to add is a -? somewhere in the regsubex line? I've also given them different names so that shouldn't be a problem.
@Korvin, thanks for the feedback :) However it's impossible to add another variable such as Y, this is because you can only solve 1 variable per equation. eg if you consider y + x = 1. This has infinite number of solutions. This primarily solves any single equation. To solve simultaneous equations its infinitely more complicated. I have done it in C# but I think it's pretty much close to impossible in mIRC.
You could still solve for any variable in y=mx + c. If you know any 3 values and you are left with a fourth variable.
@Korvin, thanks for the feedback :) However it's impossible to add another variable such as Y, this is because you can only solve 1 variable per equation. eg if you consider y + x = 1. This has infinite number of solutions. This primarily solves any single equation. To solve simultaneous equations its infinitely more complicated. I have done it in C# but I think it's pretty much close to impossible in mIRC.
You could still solve for any variable in y=mx + c. If you know any 3 values and you are left with a fourth variable.
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 22, 2007 7:35 pm
Posted on Dec 22, 2007 7:35 pm
TropNul, I have found another bug in the parser, and remembered the pain reason I used stript in the first place, it was to calculate what was in the bracket before the function.
Eg if you try to solve for sin(2x) = 1, it won't work. stript would take sin(2*45) = 1 or whatever x was and calculate that to be 90. Is there anyway to incorporate that into your current parser (as well as supporting negatives)? Sorry for all the trouble!
Eg if you try to solve for sin(2x) = 1, it won't work. stript would take sin(2*45) = 1 or whatever x was and calculate that to be 90. Is there anyway to incorporate that into your current parser (as well as supporting negatives)? Sorry for all the trouble!
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 23, 2007 6:09 am
Posted on Dec 23, 2007 6:09 am
There you are.
1> supports negative numbers inside the trigonometric functions, like sin(-30) for example.
2> calculates directly the contents of the argument of the trigonometric function (still not using $stript).
Cordialement :o)
1> supports negative numbers inside the trigonometric functions, like sin(-30) for example.
2> calculates directly the contents of the argument of the trigonometric function (still not using $stript).
| Code: |
| alias parser { return $regsubex($1-,/((sin|asin|acos|atan|cos|tan|log|sqrt)\\050(-?\\d+(?:\\.\\d+)?)\\051)/gx,$($\\2($calc(\\3)) $+ .deg,2)) } |
Cordialement :o)
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 23, 2007 6:12 am
Posted on Dec 23, 2007 6:12 am
Oops, I've forgotten the /x in the /gx options. It's of no use here (I used it for my tests). Just remove it. :)
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 23, 2007 6:30 am
Posted on Dec 23, 2007 6:30 am
In the trans function there are these 2 lines which could be optimized a bit imho.
Basically, both of them does the same thing, except for the first which considers only the 'x' character after a digit.
They could be replaced by this single line.
;o)
| Code: |
| %eq = $regsubex(%eq,/(\\d)x/g,\\t*x) %eq = $regsubex(%eq,/(\\d[a-z])/g,$remove(\\t,$regsubex(\\t,\\d+,\\t)) $+ * $+ $regsubex(\\t,\\d+,\\t)) |
Basically, both of them does the same thing, except for the first which considers only the 'x' character after a digit.
They could be replaced by this single line.
| Code: |
| %eq = $regsubex(a,%eq,/(\\d)([a-z])/g,\\1*\\2) |
;o)
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 23, 2007 10:32 am
Posted on Dec 23, 2007 10:32 am
Dude thankyou so much! Updated n done. It's pretty much finished now :)(unless there are any more unwanted requests :P). No but seriously I don't know what else to add to it now, it works exactly as it should.
Btw, where did you learn your regsubex stuff really well? I would love to learn it, it's incredibily useful.
Btw, where did you learn your regsubex stuff really well? I would love to learn it, it's incredibily useful.
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 23, 2007 10:54 am
Posted on Dec 23, 2007 10:54 am
Without all comments and spaces, it's only 2.1kb :o)
EDIT: I actually found another bug :( in the parser it can't do sin(2*3) for example, the parser doesn't recognise it with the * or / or whatever's in the middle for some reason. I uploaded the updated version of you want to test it.
EDIT: I actually found another bug :( in the parser it can't do sin(2*3) for example, the parser doesn't recognise it with the * or / or whatever's in the middle for some reason. I uploaded the updated version of you want to test it.
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 23, 2007 11:47 pm
Posted on Dec 23, 2007 11:47 pm
Fixed. (I hope lol) :)
NB:
When you put this fix in your source, remember to include the \\ as they are!
In your last update, I see the parser function as follows:
(All the \\ are absent :s.)
That apart, here's from where I've started regexps.
http://www.scriptsdb.org/tutar.php?id=1 (french site)
Then, I've used these also.
http://www.cs.utah.edu/dept/old/texinfo/regex/regex.html
http://www.pcre.org/pcre.txt
http://en.wikipedia.org/wiki/Regular_expression
http://www.regular-expressions.info/
http://www.expreg.com/ (french site)
and some more sites found on google. :)
The $regsubex identifier is just a possibility that can be used once you know regexp.
I only learnt regexps and then made applications using mIRC mainly.
Now I'm learning Perl. But that's another chapter lol.
Cordialement :)
| Code: |
| alias parser { return $regsubex($1-,/((sin|asin|acos|atan|cos|tan|log|sqrt)\\050(-?\\d+(?:\\.\\d+)?(?:[\\*\\/\\+-]\\d+(?:\\.\\d+)?)*)\\051)/g,$($\\2($calc(\\3)) $+ .deg,2)) } |
NB:
When you put this fix in your source, remember to include the \\ as they are!
In your last update, I see the parser function as follows:
| Code: |
| alias parser return $regsubex($1-,/((sin|asin|acos|atan|cos|tan|log|sqrt)50(-?d+(?:.d+)?)51)/g,$($2($calc(3)) $+ .deg,2)) |
(All the \\ are absent :s.)
That apart, here's from where I've started regexps.
http://www.scriptsdb.org/tutar.php?id=1 (french site)
Then, I've used these also.
http://www.cs.utah.edu/dept/old/texinfo/regex/regex.html
http://www.pcre.org/pcre.txt
http://en.wikipedia.org/wiki/Regular_expression
http://www.regular-expressions.info/
http://www.expreg.com/ (french site)
and some more sites found on google. :)
The $regsubex identifier is just a possibility that can be used once you know regexp.
I only learnt regexps and then made applications using mIRC mainly.
Now I'm learning Perl. But that's another chapter lol.
Cordialement :)
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 25, 2007 1:05 pm
Posted on Dec 25, 2007 1:05 pm
Ahh right the backslashes :)
Thanks mate, all fixed. All done.
I've updated the code one last time again :P
Thanks a bunch for all your help, good luck with perl. I moved from mIRC to C# because I never used mIRC for chatting or whatever, just for scripting. What made you choose to learn perl out of all the languages out there?
Also cheers for the links, I'll check them out. There's one more thing I would like to add to the $trans code which is to do )<letter> --> )*<letter> but I'm going to try to do that myself following your links ;) It's a really simple one I know :P
Merry Christmas
Thanks mate, all fixed. All done.
I've updated the code one last time again :P
Thanks a bunch for all your help, good luck with perl. I moved from mIRC to C# because I never used mIRC for chatting or whatever, just for scripting. What made you choose to learn perl out of all the languages out there?
Also cheers for the links, I'll check them out. There's one more thing I would like to add to the $trans code which is to do )<letter> --> )*<letter> but I'm going to try to do that myself following your links ;) It's a really simple one I know :P
Merry Christmas
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 26, 2007 3:09 am
Posted on Dec 26, 2007 3:09 am
I have no particular reason of learning Perl, except for its 'Magnificient' implementation of regular expressions lol.
Apart from that, I think it's a powerful language worth knowing.
After knowing some Perl, maybe I'll start with TCL and later with Python. I know some C already and that helps a lot.
Merry Christmas also and a Happy New Year.
PS: For the $trans issue, trying to do it yourself is the first step to start re-learning regexps. Good luck !
PS: In fact, no regexps are 'simple' before you understand what you're writing. For example in this pattern /(.)/, there's
everything or 'maybe not'. Now, try to find out why I said 'maybe not'. ;)
Apart from that, I think it's a powerful language worth knowing.
After knowing some Perl, maybe I'll start with TCL and later with Python. I know some C already and that helps a lot.
Merry Christmas also and a Happy New Year.
PS: For the $trans issue, trying to do it yourself is the first step to start re-learning regexps. Good luck !
PS: In fact, no regexps are 'simple' before you understand what you're writing. For example in this pattern /(.)/, there's
everything or 'maybe not'. Now, try to find out why I said 'maybe not'. ;)
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 16, 2008 8:58 am
Posted on Dec 16, 2008 8:58 am
I never got round to finishing that bit of the parser where if in the input equation you have a bracket ) followed by a letter, it is replaced by )*<letter>. So that )x --> )*x
Any help anyone? Then I can finally declare this snippet finished.
Any help anyone? Then I can finally declare this snippet finished.
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 16, 2008 12:11 pm
Posted on Dec 16, 2008 12:11 pm
Great script! i will test it later. looks really impressive & since this is basically all we do in math i can understand it! lol. great stuff, can't wait to try it out.
Some ideas for more scripts, or integrating them;
similtaniouos equations
quadratic eq.
inequalities
factorisation eq.
etcetc, just some ideas if you fancy doin some more math :L
Some ideas for more scripts, or integrating them;
similtaniouos equations
quadratic eq.
inequalities
factorisation eq.
etcetc, just some ideas if you fancy doin some more math :L
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 16, 2008 1:20 pm
Posted on Dec 16, 2008 1:20 pm
THanks for your comments, I've already done this in csharp. Simultaenous equations are very very complicated in computing and I believe beyond the capacity of mIRC scripting language. I have a multiple solution simultaneous equation solver if you're interested. This script also does quadratics and gives all solutions to them. Factorisation is possible but unfortunately don't have time to implement them into mIRC though have done all these things in csharp. You're welcome to edit the script how you wish though :)
mIRC Snippet:
Equation Solver - $solve
Posted on Dec 16, 2008 4:43 pm
Posted on Dec 16, 2008 4:43 pm
haha, ok no worries. nice work x]








