10 ms·
SageMath – Open-Source Mathematical Software System
- messe 8y agoSage is something I keep meaning to learn. Every time I've tried it though, it just didn't feel as polished and integrated as Mathematica.
- sdenton4 8y agoUnfortunately, the Mathematica language is a 'write-only' language; reading and debugging code months after use is... difficult. And that means it's hard to build up libraries which depend on libraries. The Sage community is great, and pushes a lot of code for research problems; things that are technically possible in Mathematica, which someone might work up into a notebook at some point, with a lot of effort, grow into reliable libraries in Sage.
- sampo 8y agoIt is true that stuff like (to take a random example) Total@Map[Function[{L}, Min @@ Table[dist[func[Array[c[#, k]&, n]]][L], {k, m}]], dd] is normal and common in Mathematica code. Like with Perl, the culture has started from small scripts making heavy use of shorthands provided by the language, and slowly evolved to writing larger codebases. Some of this can, on an individual level, be fixed by adopting a clearer coding style. But like Perl 5, the language kind of lures you to use the shorthands a lot.
- gh02t 8y agoIt's also cultural- line breaks, indentations, and parenthesis help a lot to make Mathematica more readable, but there's a strong tendency to do things in one liners like you show. Even the official docs are like this. I think even then it can have some readability problems, but it would certainly improve things quite a bit if the community would use a better style.
- shawn 8y agoThis isn’t true. It depends how you write your Mathematica. If you define modules, it’s nearly the same as as a scripting language.
- slx26 8y agoI used Sage a couple years ago for a cryptography course. I share your opinion, many times Sage was confusing or even frustrating. But I'd still say it's a great project, very capable, and... Mathematica is really expensive. Sage being open source and free is a real asset. This said, I don't think you should "learn" much Sage. At least if you know Python already. Just search for what you need when you need it, write the script you want... and that's it. Unless you are using it daily, at least.
- abdullahkhalids 8y agoI am unfortunately forced to use Mathematica because my scientific collaborators do so. While I have become very proficient at it, I don't like the interface or the language very much. Its a functional language put into an interface suitable for iterative programming. Loading external libraries is very non-intuitive, and just being able to separate a single program over many files that you can simultaneously edit is hard. I am looking forward to the day I can switch to Sage and return to coding in emacs.
- noobermin 8y agoI got my PhD in computational plasma physics in a group that heavily used matlab. I'm lucky enough that my advisor was okay with me using numpy and friends instead as long as my plots and figures looked okay. Today, I run a one-man show for my post-doc doing simulations for an experimental group, so I thankfully get to continue this mode of work. And thank god I didn't have to face losing the ability to run my scripts after leaving the university (this happened to a couple of fellow graduates I know!) and today, when I want to run something on the supercomputer, I just run it; I don't have to worry about how many licenses are still on the license server or whatever the fuck. I get how Matlab is a thing and people like it, but potentially having analysis delayed because of lack of licenses seems somewhere between primitive and barbaric in 2018.
- 3rdAccount 8y agoI used Matlab in undergrad and Python a lot in industry. I got a Mathematica license recently being impressed with the documentation and the sheer breadth of stuff built into the language in a consistent manner. I ran into an issue when I found out that my license could only have 4 kernels activated at a time. I was able to close out the old sessions with the task manager, but I almost (exaggeration) punched my computer when the message popped up about licensing. Wtf? How much did I pay for this? Maybe I'll just stick with Python & Julia for what I need. I just traded one frustration for another.
- a-dub 8y agoFair, but it would be really interesting to pit an avid MATLAB person against an avid numerical Python person in a data analysis race. I've found that you can generally do most things you can do with MATLAB in Python, but the experience in MATLAB is buttery smooth while the experience with numerical Python is clunky and obnoxious (whether it be all the useless textual noise in the code itself, the inferior quality of the plotting and visualization capabilities or the fact the Python scientific computing library ecosystem is so disjoint (this thing can handle pandas frames, this other thing needs numpy vectors, this other thing expects Python lists, whatever). I had high hopes for Julia, I have a test for it. How annoying is it to plot(sin(0:0.01:6*pi)) out of the box? For the extreme challenge question, how annoying is it to also open a new plot window and plot(cos(0:0.01:6:pi)) alongside it. I want to be able to pan around and inspect these complicated functions. So far, it has not yet passed the qualifiers.
- ur-whale 8y agoMathematica has lots of drawbacks, chief among which : if you write Mathematica code, you're building on top of an expensive, closed-source bunch of opaque algorithm that are neither guaranteed to be correct (can't see what they do) nor to continue behaving the way they did when you wrote your code (you're at the mercy of Wolfram changing what the code does). As far as I'm concerned, this essentially precludes doing anything publishable using Mathematica.
- noobermin 8y agoYou can say that, but I know lot of scientists and mathematicians who extensively use Mathematica in their research.
- 3rdAccount 8y agoDon't other languages cause issues as well? If you wrote your python code in 2.7, it probably won't run in 3.6 without some modifications. Although, with Python everything is free and you can work anywhere without your boss needing to buy a license.
- dbdjfjrjvebd 8y agoThe main point is auditability. Closed source libraries can have errors that can't be audited by the scientific community.
- 3rdAccount 8y agoThat I would agree with. I probably won't peek under the hood and fix any bugs with numpy, but someone else probably will.
- 3rdAccount 8y agoKip Thorne (pretty famous physicist) uses Mathematica for his work almost exclusively if i understand an interview they did with him correctly.
- placebo 8y agoIt's great to see lots of amazing projects and that people get to have more choice and can avoid being locked into one solution, but one thing I'd like to see more in a description of any product (open source or not) especially when there's a learning curve involved, is the use cases where it would make more sense to take on the effort involved in the learning curve for this particular product rather than others that seems similar to it (at least to the uninitiated).
- lvh 8y agoI'll give it a shot: Sage is what happens when you build a computer algebra system on a giant pile of existing open source libraries and give it a nice, consistent interface and a ton of starving postdocs to write cool integrations and features. If you're a programmer and you've used Mathematica or Maple and you've ever found yourself wishing that you'd have something like that except in a real programming environment, Sage is it. Sage is Python (with some syntactical extensions).
- lvh 8y agoSage is wonderful. It has a huge number of uses but I mostly use it for cryptography. Sage has the best (certainly open source) support I know of for a myriad of things like group theory and elliptic curves. Here's a short example for how easy it is to play around with a tiny elliptic curve: sage: p = 19; p.is_prime() True sage: K = GF(p); K Finite Field of size 19 sage: E = EllipticCurve(K, [5, 9]); E Elliptic Curve defined by y^2 = x^3 + 5*x + 9 over Finite Field of size 19 sage: E.count_points(), E.order(), E.gens() (19, 19, [(4 : 6 : 1)]) There are far too many things to name that sage can do, but the CLI has a great autocomplete. Here's an example: let's say you have ECDH with point compression, and you specify only an x coordinate. Point compression limits the effectiveness of invalid curve attacks, where an attacker gives you a maliciously picked Diffie-Hellman value that isn't actually on the curve you're supposed to be on. However, if the x coordinate doesn't map to a point on the curve, it's necessarily on its "nontrivial quadratic twist". Sage makes this easy to play with because sage makes pretty much everything easy to play with: sage: E.lift_x(6, all=True) [] sage: E.quadratic_twist() Elliptic Curve defined by y^2 = x^3 + 6*x + 13 over Finite Field of size 19 sage: E.quadratic_twist().lift_x(6, all=True) [(6 : 6 : 1), (6 : 13 : 1)] If you want to do a full-on invalid curve attack, the easiest way to do that is with Sage. You look up how the explicit formulas work in the EFD[efd], you write a ladder, you figure out how to create other elliptic curves for which the short Weierstrass doubling formulas still work (which parameter doesn't appear in the formula?), and then just let sage generate every possible curve and see which ones have the poor cryptographic properties you're after. There's a reason the introduction to Cryptopals Set 8[set8] sends with the words: > By the time you're done, you will have written an ad hoc, informally-specified, bug-ridden, slow implementation of one percent of SageMath. [efd]: https://www.hyperelliptic.org/EFD/g1p/auto-shortw.html https://www.hyperelliptic.org/EFD/g1p/auto-shortw.html [set8]: https://cryptopals.com/sets/8 https://cryptopals.com/sets/8
- mmirate 8y agoAren't both of those attacks all-but-negated by djb's Curve25519?
- lvh 8y agoEffectively, yes. Curve25519 has a few tricks that make this hard to do: it defines a curve compression format that mandates using 32-byte public keys and uses a single-coordinate ladder. It has the same property that points not on the curve are on the twist, but the twist is also secure. Curve25519's main innovation was to make the secure thing the default and the obvious thing to do: it was not the first twist-secure curve, it was not the first curve to have point compression that forces a point to be on the curve or the twist, plain old NIST P-256 had both of thsose. We also had a 1-coordinate ladder for Weierstrass prior to Curve25519, but it was far less used than effective point compression. But it is true that it is not incorrect to use P-256 without point compression which makes it easy to have these sorts of problems, and it is incorrect to do so in Curve25519, because the spec encompasses more than just the mathematical object of the curve. Curve25519 and its sister curve Ed25519 are really good at what they were designed for. Unfortunately people also use them for things that they're not good at, and then you get bugs like the Monero double spend. Montgomery curves necessarily don't have cofactor 1 -- so that's an example of a bug that could only have occurred on X25519.
- revskill 8y agoSorry, you're late. I was interested in SageMath long time ago, but it was close source at that time. Now i have no more interest in learning it anymore. Thanks anyway.
- detaro 8y agoSageMath has always been Open Source.
- deleted 8y ago[deleted]
- deleted 8y ago[deleted]
- severine 8y ago2011 discussion: https://news.ycombinator.com/item?id=2088871 https://news.ycombinator.com/item?id=2088871
- partycoder 8y agoThe initial issue with Sage was its packaging due to its large number of dependencies. That is largely a non-issue now for the end user. Now there is also SageMathCloud, that makes it even more convenient to adopt.
- pitiburi 8y agoYou are waaaay outdated. "SageMathCloud is Now CoCalc" since May 2017. Go google it. And it's not free _at all_, except for very basic stuff. Your pricing depends on what you need, from hundreds to thousands of dollars. Not a criticism, only a heads up for the guys reading the comments.
- jimhefferon 8y agoCoCalc is an open source system. It is convenient to pay for a setup, which is how they hope to get revenue to pay developers.
- williamstein 8y agoWe also provide a nice easy to install Docker image of Cocalc here: https://github.com/sagemathinc/cocalc-docker https://github.com/sagemathinc/cocalc-docker
- antt 8y agoBy very basic stuff you mean "Doing everything a cas can do". The expenses come when you want to connect it to the internet, because people started using the full linux distro you get as a botnet, and increasing performance.
- pitiburi 8y agowow, many times downvoted for redirecting people to an up to date situation so they can chose the plan best suited for they convenience. Gosh, HN is getting brutal. Btw, very nice job to the guys at CoCalc in general, as a collaboration tool, and specially at courses based on Jupyter Notebooks. EDIT: and now some guys going through my old posts in different threads giving me negative votes. Really?Wow.Just wow.
- noobermin 8y agoWhen I was in college, about six or so years ago, I used Sage for my physics classes. At some point I stopped using it because it didn't really stand up to Mathematica, which we got for free. My professor said, funnily enough, "sage has been taken over by mathematicians!" talking about how it has a lot of support for math uses but not as much for things like solving ODEs that is more of use for physicists and engineers. It's funny now seeing most of the comments here talking about crypto, which I read about in examples for Sage at the time (finite fields) whilst not knowing what it could be used for other than research. These days I'm a computational scientist, so I end up using numeric tools anyway (numpy is my life). That said, it'd be great to have access to an open source symbolic tool for the times I need them. How has Sage improved for engineer/science types in the last few years?
- antt 8y agoIf you know what you're doing the axiom bindings make it the most powerful cas in terms of symbolic manipulation. Mathematica is optimized for giving you results you need in undergrad classes. Sage is not optimized at all, but can solve problems useful to researchers. It's the difference between osx and linux.
- ChrisLomont 8y ago>Mathematica is optimized for giving you results you need in undergrad classes What makes you think this? Mathematica is used in all sorts research projects, technical fields, finance, and so on. I've seen Mathematica required or recommended in many, many job listings, especially for quants. I've never seen Sage there. For evidence, here [1] is what you get for searching for Mathematica on Indeed.com. Note pretty much every one of those jobs lists several math related packages. Not one mentions Sage. Unfortunately you cannot run the same search on Sage, since there is an ERP package that shows up instead. However, from browsing those listing again I find zero hits for the math package Sage. [1] https://www.indeed.com/jobs?q=Mathematica&l= https://www.indeed.com/jobs?q=Mathematica&l= [1] https://www.indeed.com/jobs?q=Mathematica&l= https://www.indeed.com/jobs?q=Mathematica&l=
- 8y ago
- williamstein 8y agoHi - I am the guy who started Sage. If you have any questions I can try to answer them here.
- noobermin 8y agoI made this comment below, but about 6 or so years ago, I found it could be used for science and engineering purposes like solving ODEs but it seemed a little bit rough at that. Today, is it improved for use for science types? Do Sage and Cocalc find users in this area?
- williamstein 8y agoI am a pure mathematician (number theorist) and the vast majority of the 600+ Sage developers over the years come from research mathematics. We generally view the numerical python ecosystem (numpy, scipy, pandas, etc.) as the place where development on engineering code happens for Python. So Sage itself isn't directly better for engineering, but I think the Python ecosystem has overall improved during the last six years...
- the_clarence 8y agoJust want to say thanks. Sage is the best thing that exists when it comes to creating a proof of concept in a cryptographic attack. I’ve used your thing for years and pretty much everyone in the cryptanalysis field use it. Good job.
- davidcorbin 8y agoI use Sage on a daily basis rather than Mathematica as an undergrad. Love it and plan on contributing in the future!
- devwastaken 8y agoI've been looking at how wiki frameworks of today are really separated from data processing and mathenatics. I'm wondering if Sage could be used to solve arbitrary equations and output data that can then be graphed customely, something like how wolframalpha can take any equation and allows manipulation of data sets.
- yesenadam 8y agoI downloaded Sage a few years ago, when I was getting into algebraic number theory. That was my first experience with Python, notebooks, numpy/scipy etc. Now I do almost all my programming - which is mostly maths-related graphics and image manipulation/processing, but all kinds of stuff - with Sage, in Cython. Usually with the CLI (and a text editor), occasionally with the notebook (to run individual lines and for the better error messages). I love being able to choose the C or Python way to do something. I can quickly get from initial idea to working program, and it runs fast. It's just a pleasure to use. Thank you williamstein!!
- thereticent 8y agoPlease donate. I just donated $50 to start things out.
- kingkingking 8y agoThis is one of the best test comments ever. Its bigly.
- whitedeveloper 8y agoThis is one of the best test comments ever. Its bigly.