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
I want to know if there is any efficient method to Run a math expression from string in java , Having some example input and results of that function.
Starting from simple linear functions : a*x+b .To more complex ones
Or is there any good source i can start reading.
I take your task as: take observed input-output and learn some representation which is able to do that transformation with new inputs.
(Some) Neural Networks can learn an approximation-function (Universal approximation theorem
) (and probably other approaches), but there is something important to remark:
Without assumptions about your function (e.g. smoothness), there can't be an algorithm achieving what you want to do! Without assumptions there are infinite many approximation-functions, which are all equally good on your examples, but behave arbitrarily different on new data!
(I'm also ignoring special-cases as: random-data or cryptographic random-generators where this mapping also can't be learned (the former in theory; the latter at least in practice)
Related
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 7 years ago.
Improve this question
I need to track down a java variable in a java file - which variable it got assigned to, which method it was passed to.
How should I begin with?
Should I use line by line parsing or is there any other method?
It looks like you are asked to build a huge mansion; and you start by asking: "should my shovel to dig the cellar be better round; or more rectangular". Meaning: if you don't understand that parsing a java program requires more than "line by line" reading; then you are doomed to fail.
Anyway, depending on your underlying requirements, there are two possible answers:
As suggested by duffymo, you might want to learn using an IDE which allows you to easily identify "variable usage" within a project; and make modifications via "reflection"
Start using a fully fledged Java parser; like https://code.google.com/p/javaparser/wiki/UsingThisParser
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Please explain me the differences over time and space complexities in java for user defined and predefined functions in java. examples like, linked list, list, stack class. please explain this with valid example.
thank you.
There is nothing special in predefined function over user defined. The only thing is predefined has been written by somebody else for you. It depends on algorithm.
Crap code/implementation runs in a crap way. Doesn't matter if its user created or system/API provided. example at a high level is EJBs vs Spring.
Good written code runs pretty and sleek. Again doesn't matter who the hell wrote it.
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 9 years ago.
Improve this question
What is faster?
I want to write an API for processing and calculating with vectors and matrices.
A "Matrix4f" needs 4*4 float values.
Should i write this as 16 fields or a two-dimensional array?
But if i use fields, inheritance is impossible.
This is more a question of maintainability than speed. The speed difference between your two alternatives will almost certainly not be noticeable. The array approach, however, makes more sense in terms of what you are trying to model, and it's simply easier to deal with (say, for instance, you want to create a 5x5 matrix instead, then your array code will be easily reusable whereas your code with 16 fields would require drastic modifications). In short, don't worry about speed when making this decision, worry instead about what makes more sense and what will be easier to manage down the line; then the choice should be clear.
There is no complexity in accessing an array nor in accessing a variable, O(1) so to say.
This is not what you should consider in speed, but your actual algorithms and functions.
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 9 years ago.
Improve this question
I'm looking for an algorithm that is able to find trends in large amounts of data. For instance, if one is given time t and a variable x, (t,x), and given input such as {(1,1), (2,4), (3,9), (4,16)}, it should be able to figure out that the value of x for t=5 is 25. How is this normally implemented? Do most algorithms compute lines of best fit that are linear, quadratic, exponential, etc. and then chooses the line of best fit with the lowest standard deviation? Are there other techniques for finding trends in data? Also, what happens when you increase the number of variables to analyze large vectors?
This is a really complex question, try to start from: http://en.wikipedia.org/wiki/Interpolation
There is no simple answer for a complex problem: http://en.wikipedia.org/wiki/Regression_analysis
A Neural network might be a good candidate. Especially if you want to learn it something nonlinear.
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 9 years ago.
Improve this question
This is kind of unusual question for developers but for some reason i want to post it here and hope to get adequate answer.
Here is a simple example:
I wrote a java function that calculates distance between two geo points. The function is not more than 50 lines of code. I decided to download a source code from ibm that does the same thing but when i opened it i saw that it looks very complicated and is almost thousand lines of code.
What kind of people write such source code? Are they just very good programmers? Should i use their source code or my own?
I have noticed this kind of thing lots of times and i from time to time i start to wonder if it is just me who do not know how exactly to program or maybe i am wrong?
Do you guys have the same kind of feeling when you browse throught some other peoples source code?
The code you found, does it do the exact same calculation? Perhaps it takes into account some edge cases you didn't think of, or uses an algorithm that has better numerical stability, lower asymptotic complexity, or is written to take advantage of branch prediction or CPU caches. Or it could be just over-engineered.
Remember the saying: "For every complex problem there is a solution that is simple, elegant, and wrong." If you are dealing with numerical software, even the most basic problems like adding a bunch of numbers can turn out to be surprisingly complex.