|
Hi
What is a nice function that have the autocorrelation function very near to a dirac function?
http://en.wikipedia.org/wiki/Dirac_delta_function[^]
I mean, I know that for digital communication is often used a Backer sequence, made by -1/+1 symbols
http://en.wikipedia.org/wiki/Barker_code[^]
that gives a very low autocorrelation, and a very sharp peak in its middle point.
I need something similar but more analog-like function.
I was thinking to a chirp function http://en.wikipedia.org/wiki/Chirp[^] ... but I am asking this question to know is someone know that there is a mathematical better/optimal choice.
Thanks
Russell
modified 7-May-13 6:45am.
|
|
|
|
|
There are many programming languages that do string pattern matching, either using regular expressions or using more elegant and powerful mechanisms, like SNOBOL[^].
There are also many programming languages that do tree pattern matching, like Haskell, but you cannot easily write a pattern that attempts to match an element in a list (a right descending tree), unless it is the first element.
Many tasks involve complex, irregular and not very large structured data. The most appropriate programming languages for tackling such tasks should have this kind of pattern matching in their tool box.
Examples of application domains for such a language:
- HTML/XML validation and correction
- C++ source code analysis
- Analysis of email chains
- Automatic chaining of tools in a workflow
- Transformation from syntax to semantics in natural language processing
- Computer algebra
Starting in the eighties, I have made and maintained such a language, Bracmat (GitHub[^],Rosetta Code[^]), and I have used it for all purposes listed above. Problem is, it is not an established programming language and therefore not the right language for production software, so I'm looking for a replacement.
I hope that I am too pessimistic and that there are in fact programming languages with seizable user communities that support the pattern matching facilities that I am looking for. The programming language that I am looking for should have a pattern matching mechanism that:
- allows wild cards not only in the tail part of a pattern, but anywhere in a pattern,
- in the case of matching against a list, is capable of matching any number of consecutive elements anywhere in the list, and not just the 'head' of the list,
- is visually clean, attractive and readable,
- allows 'normal' instructions to be embedded in patterns (evaluation of variables, writing to files, function calls, other pattern match operations, etc.),
- can assign a matched part of the subject to a variable,
- can match part of a subject with the content of a variable,
- uses the same pattern syntax for string pattern matching by treating a string as a special case of a list.
It goes without saying that such a language should have data types to express trees and lists. Ideally, patterns are structured as the data they are meant to match, so it would be helpful to implement patterns as data structures themselves.
Bart Jongejan
|
|
|
|
|
|
Indeed. Bracmat would have been a better programming language if I had been a computer scientist. For software that is going to be maintained by others, Bracmat is currently not a solution. That is why I am looking for a community driven programming language that has pattern matching (on strings, lists, trees, see the list above) in its tool box.
Clarify your answer if I misunderstood you.
Bart Jongejan
|
|
|
|
|
If you posted in Algorithms then it gave the wrong impression that you are looking for help coding a solution of your own.
Try Perl
..www.perl.org
Also have a look at Scala which has a very small syntax to learn, and is suitable for creating a Domain Specific Language of your own. scala-lang.org
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
modified 12-Apr-13 5:39am.
|
|
|
|
|
Neither Perl or Scala can solve this simple problem with a simple pattern: Given a list of pairs, each pair consisting of a first name and a family name, give me two names of different persons that have the same family name. I think Tom[^] (a cousin of Scala, I think) can do it, but the syntax of patterns in that language is very verbose. In Bracmat, you would do:
(Abel.Hirst) (Benjamin.Foster) (Letty.Johnson) (George.Hanson) (Chris.Johnson) (Priscilla.Stein):?list;
!list:? (?name1.?familyName) ? (?name2.!familyName) ? & out$(!name1 and !name2 "have the same family name (" !familyName ")") | out$"No two persons have the same family name";
which outputs
Letty and Chris have the same family name ( Johnson )
The pattern is just ? (?name1.?familyName) ? (?name2.!familyName) ? .
Scala only allows a wild card in the tail of a pattern. Perl 6 seems to have modernized its pattern matching, but the subject is still a string, never a list. Correct me if I'm wrong.
For a perhaps more convincing, but longer, example, see Dinesman's multiple-dwelling problem[^].
|
|
|
|
|
You can do anything in C++. your example can be done as this:
std::string mystdarr[][2] = {{"Abel","Hirst"},{"Benjamin","Foster"},{"Letty","Johnson"},{"George","Hanson"},{"Chris","Johnson"},{"Priscilla","Stein"}, {"",""}};
int arrsize = sizeof(mystdarr)/sizeof(mystdarr[0]);
for (auto it=0; it < arrsize - 1; ++it) {
auto itFound = std::find_if(&mystdarr[it+1], &mystdarr[arrsize-1], [&](const std::string (&cmp)[2]) { return !cmp[1].compare(mystdarr[it][1]); });
if (itFound != (std::string (*)[2])(mystdarr[arrsize-1]))
std::cout << mystdarr[it][0].c_str() << " and " << (*itFound)[0].c_str() << " have the same family name (" << (*itFound)[1].c_str() << ")\n";
}
Or, if you'd like less cryptic code (it's cryptic because built-in arrays in C/C++ are by no means flexible), you can do this:
struct SS
{
std::string firstName;
std::string lastName;
SS(const std::string& fname, const std::string& lname) : firstName(fname), lastName(lname) {};
};
std::vector<SS> myarr;
myarr.push_back(SS("Abel", "Hirst"));
myarr.push_back(SS("Benjamin", "Foster"));
myarr.push_back(SS("Letty", "Johnson"));
myarr.push_back(SS("George", "Hanson"));
myarr.push_back(SS("Chris", "Johnson"));
myarr.push_back(SS("Priscilla", "Stein"));
for (auto it=myarr.begin(); it!=myarr.end(); ++it)
{
auto itFound = std::find_if(it + 1, myarr.end(), [&](const SS& cmp) {return !cmp.lastName.compare(it->lastName);});
if (itFound != myarr.end())
std::cout << it->firstName.c_str() << " and " << itFound->firstName.c_str() << " have the same family name (" << it->lastName.c_str() << ")\n";
}
|
|
|
|
|
Hi All,
I am not sure if i am in the rite place for this question but i want to know if it is possable to create an algorithm based around a name or a word.
The end result for this is to create a unique aesthetic logo derived from an object which can be 3d printed and doesnt look like complete chaos.
If anyone can point me in the rite direction or answer my question it would be a great help. I am a complete novice and have little to know idea what i am talking about so try not to be too wordy in your explinations.
Thanks all,
Angus
|
|
|
|
|
Member 9963602 wrote: I am a complete novice and have little to know idea what i am talking about so try not to be too wordy in your explinations.
Understanding or knowing the problem is the first solution. So define exactly what your aims are and will guide you. . I don't get the part "create an algorithm based around a name or word",please clarify.
“Everything is simple when you take your time to analyze it.”
|
|
|
|
|
What are the approaches used for horizontal/vertical alignment and rectification of inaccurately orientated polylines?
inaccurately alligned structure
I believe as a starting point a graph representation is needed for further processing
Чесноков
|
|
|
|
|
Your problem seem to exists of creating 90 or 180 degree angles between all your lines? I dont think theres an algorithem for that. Personally I would do something different, like holding down the shift hey to only allow 90 degree bends:
WPF-Drawing Canvas Control[^]
|
|
|
|
|
What about creating a grid and moving every point to the nearest valid position? This raises a problem when two points are almost in line, but unfortunately fall into diffferent grid lines. This special case would have to be taken care of manually (and checked after each point aligment performed, as the situation is going to change in time).
Greetings - Jacek
|
|
|
|
|
The other one is on binary tree. I do appreciate the guidline and how to prove that.
Thanks,
Amit
|
|
|
|
|
Both of your questions sound a lot like homework. We don't do homework.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
|
This question is from DATA STRUCTURE & Algorithms
|
|
|
|
|
You have asked for someone else to do your work for you. That's not how things operate here.
Use the best guess
|
|
|
|
|
We have a tree spec and definitions for n and I . What is a statement to prove?
Greetings - Jacek
|
|
|
|
|
Full question is below .
Consider a complete binary tree with an odd number of nodes. Let n be the number of internal nodes (non-leaves) in the tree. Define the internal path length, I, as the sum, taken over all the internal nodes of the tree, of the depth of each node. Likewise, define the external pathlength, E, as the sum, taken over all the leaves of the tree, of the depth of each leaf. Show that E = I + 2n
Can some one guide me for the above subject line I greatly appreciate Thanks in Advance...
|
|
|
|
|
Upcoming (next week!) is the First Anniversary Session of Caltech's online Machine Learning course (http://work.caltech.edu/telecourse[^]) .
It is also the final session. There will be no future sessions.
The course has attracted more than 200,000 participants since its launch last year, and has gained wide acclaim. This is the last chance for anyone who wishes to take the course.
I took this course last fall and I highly recommend this!
It is well done, with video lectures on YouTube (so you don't need to "attend" at a specific time).
There is an on-line forum for discussion with Teaching Assistant(s) and other participants.
The text is an excellent book (a good value on Amazon).
|
|
|
|
|
|
May be an article on the subject would be better?
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
I was rather thinking of going commercial, I made the videos because people wanted to see what I was working on.Right now I'am making android apps using the same technology, they will be on Google Play in about two months time from now.
“Everything is simple when you take your time to analyze it.”
|
|
|
|
|
Hello,
I know that the Traveling Salesman Problem has a solution space of (n-1)! / 2 for n = nodes, when the symetrick TSP is considered.
But, is there any mathematical way to show how big a solution space a Arc Routing Problem, like the Capacitated Arc Routing Problem have? Or any other way to show (describe) why ít is a complex problem?
In all the literature it is only described as NP-hard, and thats it.
Thanks
|
|
|
|
|
The standard way to show a problem is NP is to show that it reduces to a known NP problem. In other words, you show transformations (which must run in P (polynomial) time) that transform any instance of the problem to an instance of a known NP problem.
|
|
|
|
|