digitalmars.D - Automatic Equation and Inequation evaluation.
- Carlos (13/13) Jun 14 2013 I'm interested in this kind of functionalities; Does D have
- John Colvin (3/16) Jun 15 2013 It's not clear what that would do from your example. I presume a,
- Carlos (17/36) Jun 15 2013 algor.brute does the work. IF you know that algorithm you would
- monarch_dodra (11/49) Jun 15 2013 D provides no such thing. AFAIK, there is nothing in Phobos
- Carlos (3/57) Jun 15 2013 OK but if developed it would be included in D ? Right ? It would
- monarch_dodra (5/67) Jun 15 2013 Depends what you mean by "included in D" ? In the standard
- Carlos (4/72) Jun 15 2013 I mean that anyone with the code can use it without installing
- BLM768 (5/7) Jun 15 2013 It could be useful, but only in a very specific type of program,
I'm interested in this kind of functionalities; Does D have something on this ? I thought about something like a "eval" function that would use specified algorithms. something likes this import std.stdio, std.math, std.eval; void main() { eval(Real; a+b^^x+c=56){ algor.brute(&result); } writeln("Positive value is : ", result); }
Jun 14 2013
On Saturday, 15 June 2013 at 02:05:00 UTC, Carlos wrote:I'm interested in this kind of functionalities; Does D have something on this ? I thought about something like a "eval" function that would use specified algorithms. something likes this import std.stdio, std.math, std.eval; void main() { eval(Real; a+b^^x+c=56){ algor.brute(&result); } writeln("Positive value is : ", result); }It's not clear what that would do from your example. I presume a, b and c are defined somewhere and eval solves for x?
Jun 15 2013
On Saturday, 15 June 2013 at 08:46:13 UTC, John Colvin wrote:On Saturday, 15 June 2013 at 02:05:00 UTC, Carlos wrote:algor.brute does the work. IF you know that algorithm you would know what it does. Another question would be if this way of coding makes sense to you. This is what the "eval" function does ( in theory ), It takes The words : Real, Rational, Irrational or R, Q , Q' and from there is defined which numerical group is going to be used for the evaluation. Then it identifies the operators and variables and defines the equation in a format like a text format with a end file character in the end so equations can be as long as you want. After that between {algor.(name)} in name you call the algorithm you want to use for the evaluation there can be predefined algorithm with D but maybe you can define your own algorithms. What do you think does this makes sense or would you implement it other way ?I'm interested in this kind of functionalities; Does D have something on this ? I thought about something like a "eval" function that would use specified algorithms. something likes this import std.stdio, std.math, std.eval; void main() { eval(Real; a+b^^x+c=56){ algor.brute(&result); } writeln("Positive value is : ", result); }It's not clear what that would do from your example. I presume a, b and c are defined somewhere and eval solves for x?
Jun 15 2013
On Saturday, 15 June 2013 at 11:44:03 UTC, Carlos wrote:On Saturday, 15 June 2013 at 08:46:13 UTC, John Colvin wrote:D provides no such thing. AFAIK, there is nothing in Phobos provided that does it either. It should be doable, where the second argument is a string. Something like: auto eq = Equation(Real, "a+b^^x+c=56"); auto result = Equation.brute(); I think it would quite a specialized numerical library though, so I don't think it would find its way into the standard library. I'm not sure any such D Library exists. You'll either have to port an existing library, or link with a C/C++ existing library.On Saturday, 15 June 2013 at 02:05:00 UTC, Carlos wrote:algor.brute does the work. IF you know that algorithm you would know what it does. Another question would be if this way of coding makes sense to you. This is what the "eval" function does ( in theory ), It takes The words : Real, Rational, Irrational or R, Q , Q' and from there is defined which numerical group is going to be used for the evaluation. Then it identifies the operators and variables and defines the equation in a format like a text format with a end file character in the end so equations can be as long as you want. After that between {algor.(name)} in name you call the algorithm you want to use for the evaluation there can be predefined algorithm with D but maybe you can define your own algorithms. What do you think does this makes sense or would you implement it other way ?I'm interested in this kind of functionalities; Does D have something on this ? I thought about something like a "eval" function that would use specified algorithms. something likes this import std.stdio, std.math, std.eval; void main() { eval(Real; a+b^^x+c=56){ algor.brute(&result); } writeln("Positive value is : ", result); }It's not clear what that would do from your example. I presume a, b and c are defined somewhere and eval solves for x?
Jun 15 2013
On Saturday, 15 June 2013 at 12:36:26 UTC, monarch_dodra wrote:On Saturday, 15 June 2013 at 11:44:03 UTC, Carlos wrote:OK but if developed it would be included in D ? Right ? It would be very useful I think.On Saturday, 15 June 2013 at 08:46:13 UTC, John Colvin wrote:D provides no such thing. AFAIK, there is nothing in Phobos provided that does it either. It should be doable, where the second argument is a string. Something like: auto eq = Equation(Real, "a+b^^x+c=56"); auto result = Equation.brute(); I think it would quite a specialized numerical library though, so I don't think it would find its way into the standard library. I'm not sure any such D Library exists. You'll either have to port an existing library, or link with a C/C++ existing library.On Saturday, 15 June 2013 at 02:05:00 UTC, Carlos wrote:algor.brute does the work. IF you know that algorithm you would know what it does. Another question would be if this way of coding makes sense to you. This is what the "eval" function does ( in theory ), It takes The words : Real, Rational, Irrational or R, Q , Q' and from there is defined which numerical group is going to be used for the evaluation. Then it identifies the operators and variables and defines the equation in a format like a text format with a end file character in the end so equations can be as long as you want. After that between {algor.(name)} in name you call the algorithm you want to use for the evaluation there can be predefined algorithm with D but maybe you can define your own algorithms. What do you think does this makes sense or would you implement it other way ?I'm interested in this kind of functionalities; Does D have something on this ? I thought about something like a "eval" function that would use specified algorithms. something likes this import std.stdio, std.math, std.eval; void main() { eval(Real; a+b^^x+c=56){ algor.brute(&result); } writeln("Positive value is : ", result); }It's not clear what that would do from your example. I presume a, b and c are defined somewhere and eval solves for x?
Jun 15 2013
On Saturday, 15 June 2013 at 13:23:07 UTC, Carlos wrote:On Saturday, 15 June 2013 at 12:36:26 UTC, monarch_dodra wrote:Depends what you mean by "included in D" ? In the standard library, I wouldn't know (but I don't think so). But that doesn't mean it couldn't be distributed as a trusted and reliable third party library.On Saturday, 15 June 2013 at 11:44:03 UTC, Carlos wrote:OK but if developed it would be included in D ? Right ? It would be very useful I think.On Saturday, 15 June 2013 at 08:46:13 UTC, John Colvin wrote:D provides no such thing. AFAIK, there is nothing in Phobos provided that does it either. It should be doable, where the second argument is a string. Something like: auto eq = Equation(Real, "a+b^^x+c=56"); auto result = Equation.brute(); I think it would quite a specialized numerical library though, so I don't think it would find its way into the standard library. I'm not sure any such D Library exists. You'll either have to port an existing library, or link with a C/C++ existing library.On Saturday, 15 June 2013 at 02:05:00 UTC, Carlos wrote:algor.brute does the work. IF you know that algorithm you would know what it does. Another question would be if this way of coding makes sense to you. This is what the "eval" function does ( in theory ), It takes The words : Real, Rational, Irrational or R, Q , Q' and from there is defined which numerical group is going to be used for the evaluation. Then it identifies the operators and variables and defines the equation in a format like a text format with a end file character in the end so equations can be as long as you want. After that between {algor.(name)} in name you call the algorithm you want to use for the evaluation there can be predefined algorithm with D but maybe you can define your own algorithms. What do you think does this makes sense or would you implement it other way ?I'm interested in this kind of functionalities; Does D have something on this ? I thought about something like a "eval" function that would use specified algorithms. something likes this import std.stdio, std.math, std.eval; void main() { eval(Real; a+b^^x+c=56){ algor.brute(&result); } writeln("Positive value is : ", result); }It's not clear what that would do from your example. I presume a, b and c are defined somewhere and eval solves for x?
Jun 15 2013
On Saturday, 15 June 2013 at 14:42:38 UTC, monarch_dodra wrote:On Saturday, 15 June 2013 at 13:23:07 UTC, Carlos wrote:I mean that anyone with the code can use it without installing anything but the compiler package. And third party could be the first choice before it could be included.On Saturday, 15 June 2013 at 12:36:26 UTC, monarch_dodra wrote:Depends what you mean by "included in D" ? In the standard library, I wouldn't know (but I don't think so). But that doesn't mean it couldn't be distributed as a trusted and reliable third party library.On Saturday, 15 June 2013 at 11:44:03 UTC, Carlos wrote:OK but if developed it would be included in D ? Right ? It would be very useful I think.On Saturday, 15 June 2013 at 08:46:13 UTC, John Colvin wrote:D provides no such thing. AFAIK, there is nothing in Phobos provided that does it either. It should be doable, where the second argument is a string. Something like: auto eq = Equation(Real, "a+b^^x+c=56"); auto result = Equation.brute(); I think it would quite a specialized numerical library though, so I don't think it would find its way into the standard library. I'm not sure any such D Library exists. You'll either have to port an existing library, or link with a C/C++ existing library.On Saturday, 15 June 2013 at 02:05:00 UTC, Carlos wrote:algor.brute does the work. IF you know that algorithm you would know what it does. Another question would be if this way of coding makes sense to you. This is what the "eval" function does ( in theory ), It takes The words : Real, Rational, Irrational or R, Q , Q' and from there is defined which numerical group is going to be used for the evaluation. Then it identifies the operators and variables and defines the equation in a format like a text format with a end file character in the end so equations can be as long as you want. After that between {algor.(name)} in name you call the algorithm you want to use for the evaluation there can be predefined algorithm with D but maybe you can define your own algorithms. What do you think does this makes sense or would you implement it other way ?I'm interested in this kind of functionalities; Does D have something on this ? I thought about something like a "eval" function that would use specified algorithms. something likes this import std.stdio, std.math, std.eval; void main() { eval(Real; a+b^^x+c=56){ algor.brute(&result); } writeln("Positive value is : ", result); }It's not clear what that would do from your example. I presume a, b and c are defined somewhere and eval solves for x?
Jun 15 2013
On Saturday, 15 June 2013 at 13:23:07 UTC, Carlos wrote:OK but if developed it would be included in D ? Right ? It would be very useful I think.It could be useful, but only in a very specific type of program, so it's unlikely that it would be bundled with the D compiler. It would almost certainly be distributed as a separate download from its own site.
Jun 15 2013