When I type a function into wolfram mathematica (such as EulerEquations[]) it doesn't output a solution, just outputs the same thing I typed in as input.
Does anyone know how to fix this?
EulerEquations[f,y[x],x] will return the Euler-Lagrange differential equation obeyed from y[x]. You'll probably recall these are associated with a variational problem for the functional f. Try entering Dsolve[%,y[x],x] to get the solution, if that's what you're after.
Also, you may need to load the package Needs["VariationalMethods`"], especially if you're working directly in Mathematica and not on Alpha.
Related
What are the differences? Is the only difference that wolfram script is the command line version of mathematica? or are there other benefits?
I think the WolframScript is a bit like Julia's REPL (Read-eval-print loop). Sometimes, typing on the command line is much faster than using GUI. However, the Mathematica/Wolfram gives unconverted results such as 1/3, sqrt(17) rather than approximated real numbers.
It's very convenient for short repetitive calculations. For example, I use it to solve exercises or double-check your answer at the end of each section or chapter. It helps me learn faster.
In my program, I have a large string of numbers that have been compiled together, and I'm switching it back and forth between different base values. But when I switch back to decimal, the computer directly switches to a number using exponential notation. The program I'm using is Scratch, but as long as any algorithms that are given are readable, I should be able to translate.
Essentially, I just need a way to go from like 1.0e13 to 10000000000000. Any ideas?
This script is the best I could muster:
And a sample output:
As well as a project containing the custom block for your convenience: https://scratch.mit.edu/projects/150067538/
Unfortunately, Scratch still rounds numbers, so your answers won't always be 100% exact, but at least they won't be in scientific (e) notation. If somebody else has an even better solution, I'd love to see it.
Like PullJosh said, (Hey again PullJosh!) scratch rounds numbers off the Scientific Notation so it won't be exactly accurate but their is always a solution to a problem!
My theory is that you can put each digit of the scientific notation into a list. This will make the conversion much easier! I will not take a picture of my code but send you the link to it as the code is massive mostly because I added some code that will detect if your scientific notation is a number and it can convert numbers like 1.123e2.
https://scratch.mit.edu/projects/341550388/editor
You can use the code without credit,yay! Just put it in your backpack and you're good to go.
Edit: Also, if you need more help with Scratch and stuff, feel free to follow me # endermite334 (you don't have to) and I will be happy to help you!
I have a simple linear programming problem. After solving it, I get the correct result. I want to speed it up using hot-start feature of MOSEK, but I don't know how to set some parameters like "res.sol.bas.sku", "res.sol.bas.skn", .... I only know an initial solution, i.e, "res.sol.bas.xx", where the value of the variables are stored for a near to optimal solution. Is it possible for me to accelerate the engine using Hot start feature in this way!
Regards
You seem to using MATLAB. Did you read
http://docs.mosek.com/6.0/toolbox/node009.html#238393032
Does it solve the issue?
I remember solving a lot of indefinite integration problems. There are certain standard methods of solving them, but nevertheless there are problems which take a combination of approaches to arrive at a solution.
But how can we achieve the solution programatically.
For instance look at the online integrator app of Mathematica. So how do we approach to write such a program which accepts a function as an argument and returns the indefinite integral of the function.
PS. The input function can be assumed to be continuous(i.e. is not for instance sin(x)/x).
You have Risch's algorithm which is subtly undecidable (since you must decide whether two expressions are equal, akin to the ubiquitous halting problem), and really long to implement.
If you're into complicated stuff, solving an ordinary differential equation is actually not harder (and computing an indefinite integral is equivalent to solving y' = f(x)). There exists a Galois differential theory which mimics Galois theory for polynomial equations (but with Lie groups of symmetries of solutions instead of finite groups of permutations of roots). Risch's algorithm is based on it.
The algorithm you are looking for is Risch' Algorithm:
http://en.wikipedia.org/wiki/Risch_algorithm
I believe it is a bit tricky to use. This book:
http://www.amazon.com/Algorithms-Computer-Algebra-Keith-Geddes/dp/0792392590
has description of it. A 100 page description.
You keep a set of basic forms you know the integrals of (polynomials, elementary trigonometric functions, etc.) and you use them on the form of the input. This is doable if you don't need much generality: it's very easy to write a program that integrates polynomials, for example.
If you want to do it in the most general case possible, you'll have to do much of the work that computer algebra systems do. It is a lifetime's work for some people, e.g. if you look at Risch's "algorithm" posted in other answers, or symbolic integration, you can see that there are entire multi-volume books ("Manuel Bronstein, Symbolic Integration Volume I: Springer") that have been written on the topic, and very few existing computer algebra systems implement it in maximum generality.
If you really want to code it yourself, you can look at the source code of Sage or the several projects listed among its components. Of course, it's easier to use one of these programs, or, if you're writing something bigger, use one of these as libraries.
These expert systems usually have a huge collection of techniques and simply try one after another.
I'm not sure about WolframMath, but in Maple there's a command that enables displaying all intermediate steps. If you do so, you get as output all the tried techniques.
Edit:
Transforming the input should not be the really tricky part - you need to write a parser and a lexer, that transforms the textual input into an internal representation.
Good luck. Mathematica is very complex piece of software, and symbolic manipulation is something that it does the best. If you are interested in the topic take a look at these books:
http://www.amazon.com/Computer-Algebra-Symbolic-Computation-Elementary/dp/1568811586/ref=sr_1_3?ie=UTF8&s=books&qid=1279039619&sr=8-3-spell
Also, going to the source wouldn't hurt either. These book actually explains the inner workings of mathematica
http://www.amazon.com/Mathematica-Book-Fourth-Stephen-Wolfram/dp/0521643147/ref=sr_1_7?ie=UTF8&s=books&qid=1279039687&sr=1-7
I want to implement math function power to double, can you advice algorithm for this?
I've reviewed sources of Java ME Open Source Software - Math but I want to implement it from the scratch.
Thank you!
I don't know J2ME well enough to know, but do you have Math.log() and Math.exp() ?
Then you can simply use this relation:
x^y = exp(y * log(x))
If you don't have the aforementioned two functions, then you should start by implementing those. As far as I know, the above relation is the only reasonable way to compute x^y.
Update: I see the paper linked in kusman's answer shows an alternative way to do pow using the idea of a fractional exponent. Quite cool! But the paper also shows the "normal" way to do things via multiplication of the log, and shows you how to implement Taylor series for exp() and log().