I've tracked down this code: http://www.yorku.ca/marko/ComPhys/NoncomProduct/NoncomProduct.html . However, I suspect it's ancient. It dates, apparently, from 2005. It requires an army of definemore's to work, and requires this code:
Ut:=subs((A+B)^2=(A+B)&*(A+B),(A+B)^3=(A+B)&*(A+B)&*(A+B),(A+B)^4=(A+B)&*(A+B)&*(A+B)&*(A+B),Ut);
to get the non-commuting operators to evaluate properly. clearly, this gets worse as you go to higher order. I'm quite convinced there should be something that works to arbitrary order, though perhaps not for the maple versions this code was writen for.
So, the question: I'm currently using maple 13. Is there a better way to do this in maple 13, or in the latest versions of maple? This might be a good reason to invest in a newer version.
thanks..
Edit: Thank's for the response #acer; I wasn't all that explicit about this, but If there is a much better way to implement this algorithm in the newest versions of maple, please say so. I might actually invest in a new version.. thank's!
I haven't looked at those definemore definitions, but as far as the initial substitutions of powers go you could even in Maple 13 try something like either of these (instead of that hard-coded sequence of substitutions).
subsindets( Ut, `^`, z->`if`(type(op(2,z),posint) and op(1,z)=A+B,
foldr(`&*`,seq(op(1,z),i=1..op(2,z))),
z) );
subsindets( Ut, `^`, z->`if`(type(op(2,z),posint) and op(1,z)<>h,
foldr(`&*`,seq(op(1,z),i=1..op(2,z))),
z) );
Related
does anyone knows a link to examples of solvable 3SAT problems, with also the solution to the problem?
Thanks
You can construct a trivial solveable 3Sat instance, which is solveable in polynomial time. There are several ways to construct trivial solveable 3Sat problems:
Use each variable exactly one times -> each variable setting is a solution
Don't use negations -> each variable is set to true is a solution
...
I don't know a non trivial 3Sat example, which is big and solveable. Ones a year the Sat Competition is held. You can look into the benchmarks, whether there is a 3Sat benchmark.
this is what I did:
download 3 SAT examples, for for example this site:
https://www.cs.ubc.ca/~hoos/SATLIB/benchm.html
in the download items, UF means it is satisfiable, uuf it means it is unsatisfiable.
Then I add these examples to https://msoos.github.io/cryptominisat_web/, which is a version of MiniSAT (SAT solver) in the browser.
Click the play button, and MiniSAT calculates the solution.
MATLAB provides two functions to check code for errors mlint and checkcode.
What are the main differences between them, and why does the MATLAB help say that mlint is not recommended and checkcode should be used instead?
checkcode is just a new name for mlint.
About six or seven years ago, MathWorks decided that for reasons of brand and product integrity they would prefer it if people thought of MATLAB (including the language, the IDE, the graphics, the libraries etc) as a single entity called MATLAB, rather than separable things.
They realised that they had been contributing to the issue by referring (in code, comments, and some marketing material) to the underlying language as "M", which might give the impression that MATLAB was just a wrapper around the "M" language.
They went through the product and purged pretty much every reference to "M", and the mlint command was one of those cases.
However, they have many customers who rely on the existence of the command mlint, and wouldn't want to update their code. So mlint still exists for backward compatibility, but it's deliberately unadvertised, and its help/doc just says that it's no longer recommended, and that you should use checkcode instead.
In modern versions of MATLAB, if you type edit mlint, you'll see that it literally just calls checkcode under the hood.
The functionality is the same as it always has been, it's just a name change. Nevertheless, if you're starting a new project, you should use checkcode, as eventually all those legacy customers will have finally upgraded things, and at that point MathWorks may well decide to finally remove mlint entirely.
I have seen many theories about Theory but the truth is that none of them is good enough to explain why not always use Theory. I do not see a reason (apart of ... well ... that the words Theory and Test are not the same words) why not always use a Theory.
The funny thing is that in all examples out there you could easily setup your test to be either a Test or a Theory and I am sure I am missing something here but I do not see the need to put myself in a philosophical uncertainty about what type of attribute I should use.
Let's suppose that the difference is only for the sake of self documented code. Then, why you use Datapoint and DatapointSource for Theory and something else for Test?
The truth is that I feel that nobody has come with a simple and clean answer that lights where the difference really is. At least one example where Theory makes absolute no sense and Test nicely fit, or the other way...
As a programmer I am.....If the answer is not simple there is something wrong there so.. help me to see what i am missing.
Since you are referring to NUnit, I'll answer WRT what NUnit means by a theory. Note that this is entirely different from how xUnit.Net uses the term.
I got the idea of theories from JUnit and particularly from the work of David Saff. Here's one paper on the subject: http://groups.csail.mit.edu/pag/pubs/test-theory-demo-oopsla2007.pdf Google "saff theories" and you'll find more.
Basically, when creating a test you sometimes have a theory about how the tested code should work. (In this answer, lower case theory is the English word while Theory is the NUnit thing) This is especially common in mathematical reasoning. For example, consider a program that calculates square roots. I could theorize that the square root of any non-negative number is a value such that it gives the original number when multiplied by itself. That's a completely self-contained statement about the computation.
Using NUnit, I could write a test like this...
public void SqrtTest(double value)
{
Assume.That(value >=0 );
double answer = SquareRootOf(value);
Assert.That(answer*answer, Is.EqualTo(value));
}
This test works no matter what number we give it. If the number is negative, the result is inconclusive and doesn't affect the overall outcome. If it is positive, an actual assertion is performed and the test either succeeds or fails.
In the ideal world, the provided values can come from anywhere. In JUnit, they come from Datapoints and I copied that. I also permitted them to be programmer-specified mainly as an interim solution. Ultimately, the idea was that the test framework would support a range of ways to generate data for a Theory, without the intervention of the programmer or tester.
Unfortunately, we are still waiting for that last bit. :-)
Bottom line, I think you should use Theory when you have a theory. Use a test when you just have examples without any logic binding them together. IME that's what happens in most business applications.
One of these days I hope to write a pretty long chapter about Theories.
I am using Eclipse (version: Kepler Service Release 1) with Prolog Development Tool (PDT) plug-in for Prolog development in Eclipse. Used these installation instructions: http://sewiki.iai.uni-bonn.de/research/pdt/docs/v0.x/download.
I am working with Multi-Agent IndiGolog (MIndiGolog) 0 (the preliminary prolog version of MIndiGolog). Downloaded from here: http://www.rfk.id.au/ramblings/research/thesis/. I want to use MIndiGolog because it represents time and duration of actions very nicely (I want to do temporal planning), and it supports planning for multiple agents (including concurrency).
MIndiGolog is a high-level programming language based on situation calculus. Everything in the language is exactly according to situation calculus. This however does not fit with the project I'm working on.
This other high-level programming language, Incremental Deterministic (Con)Golog (IndiGolog) (Download from here: http://sourceforge.net/p/indigolog/code/ci/master/tree/) (also made with Prolog), is also (loosly) based on situation calculus, but uses fluents in a very different way. It makes use of causes_val-predicates to denote which action changes which fluent in what way, and it does not include the situation in the fluent!
However, this is what the rest of the team actually wants. I need to rewrite MIndiGolog so that it is still an offline planner, with the nice representation of time and duration of actions, but with the causes_val predicate of IndiGolog to change the values of the fluents.
I find this extremely hard to do, as my knowledge in Prolog and of situation calculus only covers the basics, but they see me as the expert. I feel like I'm in over my head and could use all the help and/or advice I can get.
I already removed the situations from my fluents, made a planning domain with causes_val predicates, and tried to add IndiGolog code into MIndiGolog. But with no luck. Running the planner just returns "false." And I can make little sense of the trace, even when I use the GUI-tracer version of the SWI-Prolog debugger or when I try to place spy points as strategically as possible.
Thanks in advance,
Best, PJ
If you are still interested (sounds like you might not be): this isn't actually very hard.
If you look at Reiter's book, you will find that causes_vals are just effect axioms, while the fluents that mention the situation are usually successor-state-axioms. There is a deterministic way to convert from the former to the latter, and the correct interpretation of the causes_vals is done in the implementation of regression. This is always the same, and you can just copy that part of Prolog code from indiGolog to your flavor.
How to find out about a particular function or class in which version of Matlab/toolbox it was first introduced? I know I can look through all Release Notes, or Google can help sometime, but is there any better way?
Ditto Jonas ... there is no version history for specific functions.
One other thing you can do (if you didn't know this already) is, in your current version of Matlab, to check the value of exist('func'), where func is the name of the MATLAB function. The value this returns for matlab functions is 2, and for built-in functions it's 5.
If you're going for compatibility in your scripts, I would put a condition to check for that function existence before you use it. Otherwise, if you have multiple versions of MATLAB you can run a script to go through all of them or just do it by hand.
There isn't.
Except, if the place you work at has an active service contract with The MathWorks, you can send a service request and have them do the searching for you (be prepared to argue a bit if they just tell you to google the answer yorself). I do that from time to time in the hope that they'll eventually update the documentation.