This is correct. I had to minimize the distance between two sets of points by rotating one set of points to match the other. For the problem I was looking at, I had a pre-determined point-association, as opposed to something like Iterative Closest Point, so I just used a distance-squared measure of error between the two sets. To rotate one set to match the second is a rotation matrix, so I had to take a derivative along each component of rotation, and solve for zero, as we do. My biggest hangup is that my undergrad is in applied mathematics and engineering, so I'm used to every solution being analytic. However, in my PhD, which is Computer Science, everything works out well enough with a first-order Taylor (small angle) approximation and a couple iterations. I tried to find suitable analytic solutions for a couple days, even making Maxima hang a couple times, but then I realized I was being dumb and switch to the simpler technique. The red herring is that there is a fairly easy 2d solution for what I'm doing, and I assumed that it would be the same for 3d.
Maxima is an open source computer algebra system, it doesn't show steps but I've used it a lot throughout my studies and I like it! I think the syntax is a bit easier than Mathematica.
Maybe your teacher is using Maxima in a tty.
Maxima 5.41.0 http://maxima.sourceforge.net using Lisp SBCL 1.3.20 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) display(limit((x^3-4*x^2+5*x-2)/(x^3-x^2-x+1),x,1)); 3 2 x - 4 x + 5 x - 2 1 limit(-------------------, x, 1) = - - 3 2 2 x - x - x + 1
(%o1) done
Cool! Here's what I noticed with the first couple things I tried:
$ ./simplify --isolate x 'x^2 = 4' x = 2
What about -2
?
$ ./simplify --isolate x 'x^2 - x - 1 = 0' x = (1 + x) \ 2
Where did you get the n \ 2
syntax for the square root of n
from? Never seen that before.
And obviously that's not the absolute simplest expression for x
. Might be nice to recognize and solve quadratics (and maybe cubics and quartics).
The documentation of Maxima's solve function, for example, gives an overview of some possible solution approaches for equations.
> Macsyma (Project MAC’s SYmbolic MAnipulator[1]) is a computer algebra system that was originally developed from 1968 to 1982 at MIT as part of Project MAC and later marketed commercially. It was the first comprehensive symbolic mathematics system and one of the earliest knowledge based systems; many of its ideas were later adopted by Mathematica, Maple, and other systems.
And then we have:
> Maxima is a descendant of DOE Macsyma, which had its origins in the late 1960s at MIT. It is the only system based on that effort still publicly available and with an active user community, thanks to its open source nature. Macsyma was the first of a new breed of computer algebra systems, leading the way for programs such as Maple and Mathematica. This particular variant of Macsyma was maintained by William Schelter from 1982 until he passed away in 2001. In 1998 he obtained permission to release the source code under GPL. It was his efforts and skill which have made the survival of Maxima possible, and we are very grateful to him for volunteering his time and skill to keep the original Macsyma code alive and well. Since his passing a group of users and developers has formed to keep Maxima alive and kicking. Maxima itself is reasonably feature complete at this stage, with abilities such as symbolic integration, 3D plotting, and an ODE solver, but there is a lot of work yet to be done in terms of bug fixing, cleanup, and documentation. This is not to say there will be no new features, but there is much work to be done before that stage will be reached, and for now new features are not likely to be our focus.
Turns out the commercial packages are just derivatives of open source code - TIL.
Sage's built-in symbolics actually currently rely on faster stuff than sympy - particularly the inhouse Pynac symbolic engine for simple stuff and the venerable Maxima for more complicated things. However, it does include sympy in the default download, and you can use it from within Sage if you wish.
Oh, it might be worth mentioning that Sage runs on top of Python, for those of you for which "Python" was the key word in the title of this post :)
Watch this resonant frequency finding teaching video and then use wxmaxima to simplify the expression
Maxima is somewhat similar to Mathmatica but old-school and free. It's available for Win, OSX, Linux/BSD/Unix.
Writing Python (a fine general purpose programming that sadly lacks closures (which you should not care about at all for this application)) requires giving discrete steps to the computer. Ditto for Fortran (as another commenter suggested; Fortran is the ideal for programming massively parallel computers like the Earth Simulator, where the compiler has to be able to pick up implicit parallelism in the code).
Maxima and Mathematica take a formula and operate directly on it. Maxima has a solve() function, and a sum() function, for example. Functions operate on other functions (in CS terms, functions are "higher order"). You can pass various functions to the float() function to get a decimal result instead of a fractional/rational result, for example.
This should get you started: http://maxima.sourceforge.net/docs/tutorial/en/gaertner-tutorial-revision/Pages/sum01.htm
Of course, you still have to be able to read all of that stuff in order to translate it. "Computer algebra systems" like Maxima and Mathmatica will solve things for you, but if you want to continue on in math (which I have not done), it may not be desirable to use Maxima etc as a crutch for knowing how to solve stuff.
Good luck!
I'd start discussing it with your colleagues and signal your supervisors. Chances are, this is a structural problem at your school (district?), and in the long run you need a better strategy than a quick local fix, which are a stopgap at best. Of course, that doesn't help you now.
The problem with a lot of quick fixes is that even if the students start to appear to start to "get it", chances are their understanding is superficial and mostly procedural. They might be less of a drain on your instructional means and time, which is better for the other students, but I fear that you're just pushing the problem to the next module's teacher. Still, what else are you to do?
I have no idea, but I can offer some remarks:
having them catch up with the rest of the students while they continue to learn will be hard on them and you. If possible at all, it would mean they would have to do extra work and, chances are, they aren't the most motivated and don't have the best situation at home to stimulate and support their learning. Furthermore, often such a fundamental lack of understanding does not come alone, and other subjects might be as problematic as well.
teaching them a separate specialized curriculum to get them somewhat on the way while you continue the original curriculum with the other students will be hard on you and probably problematic to the students that get the alternative curriculum.
a more computational approach might support them. A (free) CAS tool such as maxima can be a great help for them and you to explore and learn mathematical concepts together.
If it matters, it is convenient to work with different bases (including 36) in Maxima via the global variables ibase (input base) and obase (output base). Bear in mind a decimal number with a trailing period (e.g. 123.) is an integer in base 10, whatever the value of the input base. Probably Sympy has something similar. FWIW & HTH.
Oh, the horror! Why emulate a graphing calculator with low resolution black-on-green screens and hilariously slow abilities (get yer TI-84 and run a logistic regression) when I can have the full (and offline) computer algebra system Maxima on a glorious full-color 800x480 touchscreen?
Maxima does precisely the same stuff, including the simplification at the end. (It's also both free and open source.)
(Not too surprising since Mathematica is, ultimately, derived from either Maxima itself or Macsyma, the older CAS Maxima is based on. And, of course, they all use the same math.)
>Can I take advantage of my programming skills to help myself learn mathematics more thoroughly and have more facility in performing calculations and writing proofs?
Study Maxima's source code perhaps.
Jeg er nysgerrig i forhold til, hvorfor du synes, at Geogebra er så vigtigt. Jeg tror ikke, at vi brugte det mere end 2-3 gange, da jeg havde matematik A.
Desuden kan jeg anbefale Maxima som gratis alternativ til Maple. Det er ikke på samme niveau som Maple, men det kan fint bruges til at komme igennem matematik A.
If you're looking to do this symbolically, mathematically, the area of programming that you're interested in is called "computational mathematics" or "computer algebra."
For an interactive example, check out this: https://derivative-calculator.net. Behind the scenes, it uses a computer algebra system called Maxima: http://maxima.sourceforge.net/
Maxima does symbolic maths calculations and much more. Great free option to Mathematica. (Or get a Raspberry Pi 3, and get an automatic free version of Mathematica which performs great for student level tasks)
In Lisp, that would look something along the lines of: (* (/ 3 (/ 2 3)) (expt 2 (* 2 (sqrt 7))) 2)
I wouldn't want to use Lisp as a desktop calculator. If I was doing calculations like that, I'd probably use something more along the lines of Speed Crunch. Lisp is fantastic for symbolic math, though. The open source computer algebra system, Maxima is written in Lisp.
As for arithmetic in programming languages, nearly everything is going to evaluate in the same way. Languages tend to clearly define the order of precedence; usually found in a table in the language manual. Nearly all languages do it as BEDMAS/PEMDAS/BODMAS/etc., where addition and subtraction, multiplication and division, are equal precedence, so it's left associative (read left to right.)
As for reasonably priced calculators, I recommend a Sharp WriteView, or any of the other equivalents from other brands. You can enter expressions in a naturally written form (with actual fractions, superscripts, etc.) and properly orders operations in the previously mentioned manner.
Get used to ALWAYS writing the units with the numbers. Also I found knowing and using Mathmatica or Maxima made my life infinitely easier.
For the lab, take IEE 380 (or learn basic statistics)
That sounds pretty complicated. Someone gave you this task with no means of solving it? Seems strange.
In any case, if you are brand new to Python, I think it might be a rough road ahead if you're stuck at the stage of filling some random arrays, let alone solving the equation. I would advise checking out one of the Python tutorials from the sidebar links.
Also, I'm no math expert so I can't tell you anything about that equation, and given your level of Python knowledge the following will probably be irrelevant anyway. But just in case, I will still mention that if you that if you want to stick to Python for this you can use <code>sympy</code> to do symbolic computation. Outside of pure Python (which might be more ideal) SageMath, Maxima, or even a TI-89 all have the same capabilities really. But like I said, I'm not sure any of those things can actually help your specific case, and you might have bigger problems.
Here's how you can do it: Set the demoivre variable to true first. Then you'll get the sin/cos form in your results instead of the exponential form.
demoivre: true; matrixexp(matrix([0,x],[-x,0]))
For more about this sort of thing, check out the "simplification" section of the Maxima manual: http://maxima.sourceforge.net/docs/manual/maxima_9.html
Hefur kannski ekki alla fídusa sem Wolfram býður upp á, en er open source og ágætt að vinna með. Ræður við allskonar stúss. Getur skoðað þetta hér http://maxima.sourceforge.net/docs/manual/intromax.pdf
Maxima has literal sets (of anything) as a built-in type. (As for symbolic sets, i.e., sets which are not explicitly enumerated, I have done some work on that.)
Examples:
(%i1) S : {[1, 2], [2, x], [u, 3], [h, z]}; (%o1) {[1, 2], [2, x], [h, z], [u, 3]} (%i2) elementp ([2, x], S); (%o2) true (%i3) elementp ([2, z], S); (%o3) false (%i4) S1 : {[2, 4], [h, x], [h, z], [2, x]}; (%o4) {[2, 4], [2, x], [h, x], [h, z]} (%i5) union (S, S1); (%o5) {[1, 2], [2, 4], [2, x], [h, x], [h, z], [u, 3]} (%i6) intersection (S, S1); (%o6) {[2, x], [h, z]} (%i7) setdifference (S, S1); (%o7) {[1, 2], [u, 3]}
Does SymPy offer any way to render the output using proper math symbols?
That's one thing I really like about Maxima, which besides the default plain text output also has GUI front-ends that can render the output (and export to various formats). For example, there's the TeXmacs front-end, which has its own LaTeX-ish rendering engine for the output, and can export to LaTeX, HTML (using MathML), or directly to PDF. There is also an Emacs front-end which is similar.
I just use Maxima for stuff like that. Then I use scipy and matplotlib to work with data and graphs, and LaTeX to typeset everything.
Somehow putting something like that in MS Word just screams feature creep.
You can execute lisp code in maxima - for instance,
(%i1) :lisp (car '(a b c))
A
maxima has plotting capabilities (based on gnuplot). So I supposeyou could execute your lisp code in maxima, then take the data and feed it into the plotting functions. For instance, if you have a set of points, you can plot the points using plot2d - e.g.
plot2d ([discrete, makelist(random(10), 200)])$
You should check the documentation on the plotting commands and "Lisp and maxima" (Sec. 37.1 in the manual) if you want to try this.
For that matter, maxima probably has a Runge-Kutta routine built in somewhere.
You might look into how imaxima.el does this. I took a look and the code's rather involved, but it might contain what you're looking for.
imaxima.el comes with the Maxima program.
I'd use *
for the Hadamard to keep it consistent with your space being a (+,*)
ring/field. For "matrix multiplication" (which is kind of a bad name for tensors anyway), I would use something like a simple .
since it would be perfectly legal in Nim and way closer to actual Mathematics. Maxima had gotten this ~~right~~ (the way I like) long time ago, for example, if you are looking background records.
The problem with tensors is that there exists at least two sensible non-Hadamard products: the tensor outer (cross) product and the tensor inner (dot) product. If you think about matrices, the tensor outer product may not be that common because its result is not a matrix but a rank 4 tensor. Yet, it is a very useful operation, even for real-life applications.
The problem with .
would be that this is used in to qualify namespaces and classes. Otherwise, I would just go for something composite like \*
or |*
or even @
. It would still be better than breaking the +
/ *
syntax symmetry IMHO.
Okay. You aren't solving the issue though. Basically any CAS is going to have similar issues with simplification, including Maxima.
Why didn't you answer the question, out of curiousity?
If you're not specifically working in number theory, you may want to consider another system, like Maxima for general symbolic manipulation, or GNU Octave for numerics (largely compatible with MATLAB by the way).
Also, I wouldn't rely on any CAS for the kind of math homework you get early in high school.
There is a free Mathematica-like program called Maxima and a free Matlab-like program called Octave
Personally I found Maxima just enough more limited than Mathematica that I sprung for a Mathematica license (very affordable if you are a student, or an educator -- a bit steep if you are in government or industry.)
Would Common Lisp be a better starting point, given that it comes with bigint support? Then you could just edit your text files to cuddle the numbers with (list
and )
, and load them in exactly the same way...
Also there's a rather powerful free symbolic maths package available for it.
I have somewhat related question. How to properly write this in maxima?
(%i1) a: x*10+6; (%o1) 10 x + 6 (%i2) b: 6*10^n + x; n (%o2) x + 6 10 (%i3) solve([b/4 = a, n=5], [x, n]); (%o3) [[x = 15384, n = 5]]
Just assuming that someone would like to have a go and implement this paper in Haskell? What are the necessary steps? Some which I can see: * implement symbolic integration (big task :) )
Then how to use it? Should it go via TH or some EDSL?
IT would be TH if we integrate via Maxima
> (1) Freeware alternative to the very expensive Maple and Mathematica that you have to buy in college: [1] http://maxima.sourceforge.net/
That needs two more letters:
The Open University uses Maxima, an open source algebra system in it's course MST210 - Mathematical Methods, Models and Modelling.
That is easier said than done in a general case, what you are talking about is a general purpose algebra system which some clever coders <em>have</em> done see also Mathomatic. Secondly there are numbers that cannot be simply reduced to tractable integer fractions, so at some point you simply must approximate.
> Somebody told me to look into LISP because it was easy to do linear programming with it. Is it true? Or is the same as other programming languages?
i don't think there's any 'objective' answer to this: it depends on so many factors, including personal experiences and preferences. Many people loathe various Lisps because of "too many parentheses!!!"; i don't find them an issue, for the most part - particularly due to the editor i use for programming - and certainly not an issue significant enough to outweigh the other benefits of Lisps.
Having said that, as a data point, you might be interested to know that the Computer Algebra System 'Maxima', which provides functionality around matrices and linear algebra, is written in Common Lisp.
Also, one thing to keep in mind: 'Lisp' can refer to various programming languages. On this subreddit, in my experience, it's often assumed to be referring to "Common Lisp"; but here and in other contexts, it might be referring to a more generic notion of Lisp instead.
Maxima is the best option of this post, just for a simple reason: is Free as in freedom Software.
If you want graphs "that look good and are good " always say that you used Free Software to do them and that by doing that you respected your freedom and thats all you need to be outstanding in your work...
I have my TI-89 (pre-Titanium) from middle school, and while I reach for a CAS (Maxima) on my laptop instead, I still admire the solid build quality, power, and great battery life it had. I also love how it fit in my hands; I used to be able to type pretty well on it—so much easier than my super fancy smartphone—and even wrote a couple (short) papers on it in study hall.
Maxima's tex function outputs an expression in LaTeX. You can enter an expression with ordinary C-like notation (e.g. foo : exp(k*a + b/c)) and then tex(foo) outputs the LaTeX equivalent.
Maxima also has an add-on package to generate MathML, namely maximaMathML.
I tried to use the symbolic package a few months ago and it was very much broken. I am not sure if the package has been fixed, but there certainly are many tutorials out there.
After a while I kinda gave up and started using maxima, I will check the symbolic package again when I get home to my ubuntu/linux Desktop.
I see this is an old post, but I saw it and had to comment. A while back, I had asked a computer-savvy friend, and he recommended Maxima. There is a great page on Wikipedia about Maxima, as well as other "computer algebra systems."