JavaPlot: How can I use the fit method of GNUPlot? - java

I have a set of 6 points. Now I want to create a trend line (fifth-degree polynomial). I don't have much experience with GNUPlot, yet, but I found the "fit" method which should do exactly what I want. The problem is that I don't know how to call the method within JavaPlot. Even if it wasn't implemented in JavaPlot it should be possible to use that method somehow, right? The JavaPlot website even states:
Moreover, is flexible enough to give special parameters to gnuplot, even if the library does not support it (yet).
Does anyone know how I can plot a fitted (trend) line in JavaPlot?

JavaGnuplotHybrid might be a solution. It allows hybrid programming with Java and gnuplot, which means all gnuplot features are supported. You need to learn some bit about gnuplot first though.
For more details:
Project page: https://github.com/mleoking/JavaGnuplotHybrid
Wikipedia: https://en.wikipedia.org/wiki/JavaGnuplotHybrid

Related

JOpenChart dates on x axis

I am trying to use JOpenChart, unfortunately, the documentation stinks, not even a javadoc as far as I can see.
My problem is that I am trying to use a date on the x axis, and I don't see how this is done. The tutorial implies that I need to use ObjectChartDataModel, but the constructor takes DataSet[] instead of DefaultDataSet[], which is probably fine. I assume one can polymorph to the other (hard to know for sure because, no javadoc is provided), but it takes an Object[] as a second parameter and I have no idea what that is.
Does anyone know this tool that can either answer my question or at least point me at where the documentation exists. The only documentation he seems to offer is this: http://jopenchart.sourceforge.net/tutorial.html which is nice, but doesn't really cover all the bases.
May I suggest http://www.jfree.org/jfreechart/ or if you can afford it http://www.jidesoft.com/products/charts.htm. I've used both and they each have their strengths. The chart you are trying to use I never had much luck with.

Java Library for Steady State Solution for DTMCs

I have been using jMarkov for analyzing CTMCs. This appears to be the most well defined Java library for this purpose. One of the part in my analysis also requires Steady State Solution of a DTMC. Though jMarkov manual mentions that it can handle DTMCs as well but the authors seem to have ignored the case. The documentation of the library, hence, seems to be incomplete.
Can someone guide me through jMarkov OR point me to a part in the manual that can be useful? If there exists another library I could use, that would be great as well. Additionally, I would be okay if someone could point me to a Java implementation that just helps me find Eigenvector of a Matrix.
Thanks!
Maybe not for you but for someone else who wants to try jMarkov, there are thw possible solutions for this issue:
First, i think jMarkov claims to handle DTMC as any DTMC can be transformed into a CTMC in a normalization process. So you have to transform your DTMC into a CTMC in order to take advantage of jMarkov.
Second, I'm sure jMarkov also allows to handle DTMC without normalization. If you specify your problem a little bit we could build an example from your problem.
Regards,

image pattern matching in java

Earlier i was searching for fingerprint recognisation in java, but didn't find anything how to implement. So, now i have decided to just matching the pattern of two images of fingerprint after getting fingerprint manually. And then, compare their pattern. And i think, this can be done by comparing two image and matching their pixel similarity (as per my finding).
So, now i am looking for any API/library/SDK/framework or anything available in Java, for comparing pattern of two images and getting the percentage match between them.
I'll appreciate any idea !!
Have a look at WEKA. There might be something in there for your needs, but as Stefan Kendall already mentioned it's not easy at all.
Also, http://opencv.willowgarage.com/wiki/ might be useful, but unfortunately there is no java version yet.
I haven't used it, or even properly studied it - but from what I have seen, this project may help you. (Currently it is for Java and .NET):
http://sourceforge.net/projects/biometricsdk/

Simplest way to allow users to specify output format

I have written an application which outputs data as XML. However, it would be nice to allow the user to completely customize the output format so they can more easily integrate it into their applications.
What would be the best way to approach this problem? My initial thoughts are to define a grammar and write a parser from the ground up.
Are there any free Java libraries that can assist in parsing custom scripting(formatting?) languages?
Since I already have the XML, would it be a better approach to just 'convert' this with a search & replace algorithm?
I should specify here that 'users' are other programmers so defining a simple language would be fine, and that the output is potentially recursive (imagine outputting the contents of a directory to XML).
Just looking for general advice in this area before I set off down the wrong track.
EDIT: To clarify... My situation is a bit unique. The application outputs coordinates and other data to be loaded into a game engine. Everybody seems to use a different, completely custom format in their own engine. Most people do not want to implement a JSON parser and would rather use what they already have working. In other words, it is in the interests of my users to have full control over the output, asking them to implement a different parser is not an option.
Have you considered just using a templating engine like Velocity or FreeMarker.
I would have created a result bean as a POJO.
Then I would have different classes working on the result bean. That way you can easily extend with new formats if needed.
E.g
Result result = logic.getResult();
XMLOutputter.output(result, "myXMLFile.xml");
Format1Outputter.output(result, "myFormat1File.fo1");
Format2Outputter.output(result, "myFormat2File.fo2");
If you are planning to provide this as an API to multiple parties, I would advise against allowing over-customization, it will add unnecessary complexity to your product and provide just one more place for bugs to be introduced.
Second, it will increase the complexity of your documentation and as a side affect likely cause your documentation to fall out of sync with the api in general.
The biggest thing I would suggest considering, in terms of making your stream easier to digest, is making the output available in JSON format, which just about every modern language has good support for (I use Gson for Java, myself).

Java library for creating straight skeleton?

I have as an input a 2D polygon with holes, and I need to find it's straight skeleton, like in the picture:
(source: cgal.org)
Maybe there is a good Java library for it?
And if not, can you point me to the good explanation of the algorithm, so I could implement it myself? (I haven't found good resources on Google)
I wrote this a little while back. Not sure if it's robust enough.
https://github.com/twak/campskeleton
(edited for 2018...)
See http://www.sable.mcgill.ca/~dbelan2/roofs/roofs.html which contains an applet.
You may be able to use the JTS Topology Suite. It is a very capable library that I've used on a number of projects - never for straight skeleton, but it may be possible.
Edit:
Ah. I see that "Straight Skeleton" is a technical term. The wikipedia article references several algorithms. Have you looked at those?
As I understand it, you have a (convex?) polygon. From it, you subtract 1 or more (potentially non-convex) polygons. You want to turn the result into a set of polygons without holes. Are there extra rules that you're trying to apply?
I have a hard time coming up with a set of rules from the example that you provided. The outer polygons are non-convex; so it doesn't seem like you're trying to find a convex set to represent the result (which is a relatively common task).
If you could use the breakdown shown below, the algorithm is pretty simple. Can you clarify?
Can I ask u what is your purpose for finding Straight skeleton? Is it personal or commercial? I would be interested in knowing how you r using it to solve real time problems? I do have a java library that does that. My algorithm is listed here http://web.stcloudstate.edu/rsarnath/skeleton/definition.htm

Categories

Resources