Existing Tools for Simple Math Expression Equivalence Logic [closed] - matlab

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
This question has some good responses, but has been moved to a more appropriate forum at this link.
Online systems, such as ALEKS, Cengage's WebAssign, and even Khan Academy employ some kind of logical matching for polynomial expressions and numerical values (ie, fractions). What unpaid tools (libraries, command line programs, scripts, etc) exist that can provide expression/numerical matching? For example, a student enters the expression
but the following expression is equivalent and would also be acceptable:
The question about how to do this mathematically has an excellent answer in this post, and a question addressing one particular way to implement this has a partial answer in this post. Sympy looks promising, but the command line Maxima could work, and so could the WolframAlpha API, Maple, MatLab, and any number of symbolic computer algebra systems.
It's fine to talk about things that "could work", but what tools are already being used? How has this already been implemented? Can anyone speak from experience about what online math learning programs are using on the backend? Give examples or direct to existing projects.
To clarify the question, I'm talking about logically comparing simple expressions(middle/high school math), minimally complicated, with canonical forms typically easy to obtain. The implementation will be online (html+nifty_tool) and input will most likely be captured as a string unless someone can suggest a better input method for math learners - a LaTeX front-end perhaps?

Providing that you could translate the student's input into Python it would be easy enough to verify the equality of expressions in most cases. For instance,
>>> from sympy import *
>>> var('p')
p
>>> f_1 = 2*p**2*(p+5)-8
>>> f_2 = 2*(p**2+4*p-4)*(p+1)
>>> f_1.expand()==f_2.expand()
True
If you have an input widget that enables a student to enter expressions of the kind displayed in your question, and that outputs LaTeX, say, then you might be able to use a parser such as https://github.com/alvinwan/tex2py to get the inputs you need for sympy.

Take a look at STACK, which is an automated system for assessing students' math answers. STACK is based on Maxima. The main web site appears to be: http://www.stack.ed.ac.uk/
I found some other links that could be interesting to you:
Moodle plugin for STACK: https://moodle.org/plugins/qtype_stack
Resources for the Moodle plugin at Github: https://github.com/maths/moodle-qtype_stack
Some description about how STACK uses Maxima: https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/CAS/Maxima.md
I'm actually not sure how STACK makes use of Maxima to determine whether an answer is correct. If the form of the answer doesn't matter, then ratsimp(answer - expected) should be 0 if answer is equivalent to expected. But if the form of the answer must be verified as well, the comparison becomes more complicated. I can imagine some ways to do that, but I don't know what STACK actually does.
I see the issues forum for the Github project (https://github.com/maths/moodle-qtype_stack/issues) seems to have a fair amount of traffic, so perhaps if you run into problems you can ask for help there.

Related

Non documented jsonb_to_tsvector function [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I am using PstgreSQL v12, and there is a native function \df jsonb_to_tsvector... But it is not described at pg guide functions-json neither other page. It is a interesting function, can I use it, is reliable? Or it is a kind of "lost in namespace" bug?
Important: even if google found it, I see citation absence (or absence of "also see" section) as a PG Guide bug. It is a jsonb_* native function: all must be cited at pg guide functions-json.
NOTES
At this old page of 2018 we can found something as:
CREATE TABLE test (id int, payload jsonb);
INSERT INTO test VALUES
(1,'{"glossary":{"title":"example glossary","GlossDiv":{"title":"S","GlossList":{"GlossEntry":{"ID":"SGML","Abbrev":"ISO 8879:1986","SortAs":"SGML","Acronym":"SGML","GlossDef":{"para":"A meta-markup language, used to create markup languages such as DocBook.","GlossSeeAlso":["GML","XML"]},"GlossSee":"markup","GlossTerm":"Standard Generalized Markup Language"}}}}}'::jsonb)
,(2,'{"menu":{"id":"file","popup":{"menuitem":[{"value":"New","onclick":"CreateNewDoc()"},{"value":"Open","onclick":"OpenDoc()"},{"value":"Close","onclick":"CloseDoc()"}]},"value":"File"}}'::jsonb)
,(3,'{"x":[1,2,3]}'::jsonb)
;
-- it is running and results are fine!
SELECT id, jsonb_to_tsvector('english', payload, '["all"]') FROM test;
SELECT id, jsonb_to_tsvector('english', payload, '["numeric","key"]') FROM test;
... and that it is "2 years lost".
(edited after answered)
Voting the IDEAL GUIDE
At answer comments #a_horse_with_no_name explain my position, "... with your logic, array_to_tsvector would need to be listed with the array functions...",
and that his position is the opposit.
The Stackoverflow community is democratic, we can use an efficient voting mechanism. I am creating a Wiki answer to you vote below as an alternative answer... Let's do an experiment. Each answer is an postion alternative:
vote this answer below for "no See also section" and no citations. You agree that Guide is good as it is, and a hub page not need to cite other functions.
vote this other answer below for "See also section" or completeness of citations. You agree that the Guide is not good, and a hub page need to cite other functions.
Time to vote at postgresql.org/docs?
I never understood why "our" PostgreSQL guide at postgresql.org/docs does not offer "See also" sections.
Almost all Wikipedia articles have a "See also" section, and almost all popular programming languages:
PHP example, PostGIS example, etc. or "see also" box like Python guide.
In a good programming language it is not difficult to classify and define groups of native functions, on the basis of shared characteristics.
PostgreSQL have a big community, so it is easy also to check consensus about defining groups of similar native functions... And sometimes is more easy: all functions with the prefix array_ are in the set of "all native array functions", all functions with the prefix jsonb_ are in the set of "all native JSONb functions".
It is also a kind of "completeness princicle for Guides": a Guide's page that explain "all functions of group G" need to explain, or at least to cite, all functions of the G group. The page "JSON functions" is for all native JSON functions, the page "ARRAY functions" is for all native JSON functions.
PS: about "native function" definition in this context, extensions are excluded from it. For example jsonb functions and array functions of extensions, like hstore are not native.
Problem: is there, at postgresql.org/docs, a democratic mechanism to vote, like here?
The function is documented in the text search functions
reduce each value in the document, specified by filter to a tsvector, and then concatenate those in document order to produce a single tsvector.
This answer is a Wiki (your vote goes to nobody) and is not a real answer, it is a kind of voting experient... I is a "place to vote" an alternative position. The two alternatives are:
here
and the
a_horse_with_no_name answer.
Position here: the Guide needs a "see also" section or similar thing
"See also section" or function name citations, for completeness in a "all native functions of group" page. Example: the page Guide of all native ARRAY functions, the page of all all native JSON functions, etc.
Vote here if you agree that the Guide is not good, and a hub page need to cite other functions.

Do tagless algebra needs laws? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I read the wonderful blog from JOHN A DE GOES regarding to tagless final. In the section 5.Fake Abstraction, he has mentioned:
Unfortunately, these operations satisfy no algebraic laws—none
whatsoever! This means when we are writing polymorphic code, we have
no way to reason generically about putStrLn and getStrLn.
For all we know, these operations could be launching threads, creating
or deleting files, running a large number of individual side-effects
in sequence, and so on.
He is correspond to the following tagless algebra:
trait Console[F[_]] {
def putStrLn(line: String): F[Unit]
val getStrLn: F[String]
}
Does it mean, writting laws for tageless algebra is not possible or do I misunderstand something.
A few things:
John A De Goes, while is very knowledgeable has also a lot of opinions and express them as if they were inferred from mathematics without making a clear distinction - this posts is a part of series where he basically pitches that tagless final is often a bad solution and ZIO is a good one
paragraph says that tagless final often doesn't follow algebraic laws which means that we cannot e.g. consider IO monid/semigroup and similar. Which is true. But it doesn't mean that these constructs cannot obey some contracts (called laws) because the do and that is the whole point of Cats Effect
nobody can force you to write laws for algebras, because laws are basically some particular way of writing specification/tests where you write a separate test for some class of interfaces and then for every implementation you can instantiate this test to check if your implementation fulfill contracts - and yes, nobody can force you to write test for your code. However, that can be said about virtually everything we code, and TTFI give you benefit of making it easier to specify a common behavior of widely different implementations, and then writing your code and tests carefully, sticking to the part of contract that is vital for a particular piece of code while also making these dependencies on contracts explicit
So yes, nobody can force you to write laws for your algebras, but people who implement them in libraries actually do this, and if you write your own algebras, you are encouraged to do so, so this argument is stretched and eristic.

Swift primitive data types source code (e.g. UInt64, Float ...) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I want to implement an "Int512" type with integer literals support and all the stuff standard types (like Int64) have. There's not much docs / info over the Internet on this matter, so I figured that the best thing is to dig the sources and do it in the same way.
I have checked out https://github.com/apple/swift but having difficulties with finding there Int64 implementation.
Is that the right thing to look in? And if so, maybe someone knows where the sources for primitive types are.
There is no "explicit" Int64 implementation. Since most numeric types are somehow similar, the swift source files are being generated by a tool named gyb (generate your boilerplate), to be found here: https://github.com/apple/swift/blob/master/utils/gyb.py
This tools reads .gyb files and creates the source code. In your case, its the file
https://github.com/apple/swift/blob/master/stdlib/public/core/IntegerTypes.swift.gyb
This could be good starting point; just check for 'Int32' and do the appropriate stuff for 'Int512' :-)

Is this a good alternative to Moose Perl? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I have been a searching for alternative to Moose (Modern object-oriented Perl)
Because Moose is slow I have seen several post relation to this issue, I not want that.
Example from the same creator: https://www.youtube.com/watch?v=ugEry1UWg84&feature=youtu.be&t=260
So I found this alternative from the same creator of moose:
https://metacpan.org/pod/MOP#DESCRIPTION
MOP - A Meta Object Protocol for Perl 5
This module implements a Meta Object Protocol for Perl 5 with minimal overhead and no non-core dependencies (eventually).
Work with UNIVERSAL::Object:
https://metacpan.org/pod/UNIVERSAL::Object
Is this a good choice and alternative to Moose, does someone test this software ?
Related post:
https://www.perlmonks.org/?node_id=1220917
Thanks.
Note: I forget to mention I know about Moo, Mouse, etc, maybe exist something better ?
MOP is very low level, Moxie is based on it; but it's still a proof of concept.
There are faster and lighter alternatives that have been tested in production: Moo and Mouse.
In which context do you use Moose and find it slow ? There is of course an overhead involved, but most of it happens at startup time (compilation) ; then, at runtime, most features are cheap (as long as you make your classes immutable), as explained in the documentation. Over the time Moose has become the de facto standard for object oriented programming and it has a very, very wide ecosystem (a search on MooseX on metacpan returns 820 results). Don't give up on it to early.
If you really need faster startup time (like in vanilla CGI environment for example), the most relevant alternative to Moose is Moo, Minimal Object Orientation. It is really light-weithg, has no XS dependency, while implementing a significant subset of Moose (also, its syntax is fully compatible with Moose so you upgrade to Moose anytime later if you need some piece of functionality that you find missing in Moo). It also has a rich ecosystem.

Which new features are (or will be) added to Scaladoc in Scala 2.10? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Among all the various incomplete lists of features going into Scala 2.10, there are various mentions of improvements to Scaladoc. But it's unclear which ones there are, and which ones are actually going in -- e.g. one of the lists of improvements says "fixes to Scaladoc" with links to various pull requests, some of which got rejected.
Can anyone summarize what's actually changed between Scala 2.9 and 2.10 milestone 4, and maybe indicate what else is planned for 2.10 itself?
Also, are they finally going to fix the problem of not being able to link to methods? E.g. littered throughout my code I have things like this:
/**
* Reverse the encoding computed using `encode_ngram`.
*/
def decode_ngram(ngram: String): Iterable[String] = {
DistDocument.decode_ngram_for_counts_field(ngram)
}
where I want to refer to another method in the same class, but AFAIK there's simply no way to do it. IMO it should be something obvious like [[encode_ngram]] -- i.e. I definitely shouldn't need to give an absolute class (which would make everything break as soon as I pull out a class and stick it somewhere else), and I shouldn't need to give the parameter types if the method name itself is unambiguous (i.e. non-polymorphic).
Several new features, as well as many bugfixes are coming, but there's no definitive list of all the fixes that are in, yet. Of the more notable new features:
Implicitly added members will now be visible. A good example is to look at scala.Array, where methods like map which you might've assumed you had are now visible in the Scaladoc.
Automatically-generated SVG inheritance diagrams, for a bird's eye view of relationships between classes/traits/objects at the package-level and then also at the level of individual classes etc. For example, see the Scaladoc diagrams nightly at both the package-level (click "Content Hierarchy") as well as at the class-level.
Method-linking in some limited form should go into 2.10 (not in the nightly yet). (It's actually not totally trivial to implement in its complete form, due to practical stuff like overloading, as you noted.)
Improved use cases A member with a use case isn't doubly generated anymore, and they're now a bit clearer and simpler than before.
(Less-notable) Keyboard shortcuts for navigating Scaladoc have been added, they're explained here and here
For a more exhaustive list of bugfixes, it might be a good idea to write to scala-internals-- there's a good chance someone will compile a list of all major bugfixes in the past year for you there.