I'm curious of any consideration has been giving for transpiling from one CAS syntax to another instead of or right before sage.repl.preparse().
--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/z3XBhQOCh9E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/d4b01e0b-8e7b-42f8-bfbb-f05f6e894b1fo%40googlegroups.com.
So one goal as briefly mentioned was to be able to write/use a common language for expressing CAS.
There are at least two rather complete parsers for the "Wolfram Language" whichrender stuff likefoo[x_]:= Sin[x]+Log[x]into trees / intermediate forms/ Lisp s-expressions.(compare to Wolfram's "FullForm" which is essentially lisp with [] instead of (), and moving parens... x+y becomes Plus[x,y] or in lisp, (Plus x y). )
I wrote (and posted) a lisp language parser for Mathematica's language,years ago.
A top-down recursive descent parser.
At that time, (maybe still?) thelanguage did not have a context-free grammar, much less one that waswritten down.
I'm not sure what you are aiming to do.
But to make any non-trivial use of Mathematica language ( i.e. other than algebraic expressions like a*b+c)you need to have semantics for pattern matching, language features , conditionals, iteration,numerics (bizarre bigfloat), and routines like Integrate[], Solve[] etc.
You cannot map these 1:1 to anything currently in Sage, though I suppose Sage couldgobble up a version of Mathics. or you could look at the lisp/Maxima code.
I think openmath has lost out to mathml, but they are both, IMO really terriblyunreadable, and for no good reason. There is at least one front end forMaxima that (I think) uses MathML. As long as no human has to read it,it might be OK except for being about 25X more verbose than needed.If all you care about is algebraic expressions with standard operators, + * / - ^then the task is a simple homework assignment for an undergradcourse in programming languages/ compiling.
RJF
On Saturday, July 4, 2020 at 12:29:27 PM UTC-7, Nils Bruin wrote:On Saturday, July 4, 2020 at 9:10:33 AM UTC-7, Rocky Bernstein wrote:So one goal as briefly mentioned was to be able to write/use a common language for expressing CAS.This goal (or perhaps a little more broadly, a common language for expressing mathematical objects) has been around for a long time and has proven rather difficult. You should probably look into efforts that went into OpenMath (https://www.openmath.org/) and evaluate what works and does not work there.One of the early design goals of Sage was actually exactly to be a compatibility/translation layer between different CA systems and libraries. That's where the "expect" interfaces come from and several of those interfaces (libmaxima, libgap) since then were better integrated to allow translation of information on a binary level rather than just via character streams.The overarching language was not particularly modelled on Mathematica, but rather on Magma, which matches Python fairly well.I'd expect that you'll run into the same kind of issues that Sage has run into if you try to replicate its efforts on a Mathematica-modelled platform.
--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/z3XBhQOCh9E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/b7e13235-6acd-48c4-8d1f-d1c82c563e89o%40googlegroups.com.
On Saturday, July 4, 2020 at 9:10:33 AM UTC-7, Rocky Bernstein wrote:So one goal as briefly mentioned was to be able to write/use a common language for expressing CAS.This goal (or perhaps a little more broadly, a common language for expressing mathematical objects) has been around for a long time and has proven rather difficult.
You should probably look into efforts that went into OpenMath (https://www.openmath.org/) and evaluate what works and does not work there.
One of the early design goals of Sage was actually exactly to be a compatibility/translation layer between different CA systems and libraries. That's where the "expect" interfaces come from and several of those interfaces (libmaxima, libgap) since then were better integrated to allow translation of information on a binary level rather than just via character streams.
The overarching language was not particularly modelled on Mathematica, but rather on Magma, which matches Python fairly well.I'd expect that you'll run into the same kind of issues that Sage has run into if you try to replicate its efforts on a Mathematica-modelled platform.
--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/z3XBhQOCh9E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/c9e83147-87a4-4acb-b748-e8ff17a9c190o%40googlegroups.com.
You could take a look at what Albert Rich has done for testing Rubi in different systems.Also, the theorem proving people using Coq want to match up with CAS.Also, the history of formalizing mathematics (Frege, Russell, etc) mayinfluence your thinking. Maybe discourage you; see the history of tarpits.
My view is colored by the fact that different CAS do not even agreeon the semantics of sin(x) or Sin[x], e.g. how it simplifies.MathML does not care, I suspect. OpenMath used to say somethinglike "the usual sine(x)" which is a cop-out. What is sin(2*x)?
If you really want to make them all talk to each other, I think
you have to pick one CAS, preferably the most full-featuredone available (maybe insist on it being free?) and thentranslate everything to it. To compare an expression inMaple and Mathematica, convert them both to the sameCAS. e.g. one , or the other, or both to (say) Maxima.Even this is tough ... to translate maple sin(x) to Maxima, youneed to invent maple_sin_in_maxima(x).etcI don't think openmath will suffice.
On Friday, July 3, 2020 at 6:42:42 PM UTC-7, Rocky Bernstein wrote:(I posted a much longer and more detailed version of this the other day, but I don't see it posted. So here is a shorter version)I'm curious of any consideration has been giving for transpiling from one CAS syntax to another instead of or right before sage.repl.preparse().In particular, I was thinking about using Mathematica syntax.If this gets through and there's interest, I can fill in more details.
--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/z3XBhQOCh9E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/9ce8d876-62b7-4beb-a6dd-71ea20d4ff37o%40googlegroups.com.
To unsubscribe from this group and all its topics, send an email to sage-devel+unsubscribe@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/9ce8d876-62b7-4beb-a6dd-71ea20d4ff37o%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/z3XBhQOCh9E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/e1a8646f-7b8f-4ada-aa82-6df389996550o%40googlegroups.com.
Clearly, adding the ability to parse some Mathematica code fits well into that goal. If nothing else, it could be a helpful step in converting existing Mathematica user code so that it can work in Sage, and that's part of being a viable alternative.
Clearly, adding the ability to parse some Mathematica code fits well into that goal. If nothing else, it could be a helpful step in converting existing Mathematica user code so that it can work in Sage, and that's part of being a viable alternative.This is an important point that I am sorry we did not mention earlier; thanks, William. I have definitely had many requests for such an automated tool in the past from colleagues with a lot of Mma stuff.
--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/z3XBhQOCh9E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/8dd1a617-6bcc-40e3-a1c7-89efb2927597o%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/050a44ed-e31b-4ddb-8687-fc9dcd53e3c1n%40googlegroups.com.
To unsubscribe from this group and all its topics, send an email to sage-...@googlegroups.com.
You of course realize that in expressing good intentions, you are not alone, and certainlynot first.The devil is in the details. Parsing Mathematica expressions into an intermediateform (like a Lisp symbolic expression) is the easy part.Here's a detail that came up in another mailing list.What is Infinity or Inf in Mma?
Is it the same as in your favorite other CAS? Or in yourfavorite text?
Mma says 1/Inf = 0. It also says -1/Inf =0. From whichwe might conclude that 1=-1. Do we have to get aroundthis? If so, how? If you have a system that has amore nuanced version of infinity, what do you do?There are other similar issues.Another point -- that if two CAS come up with the "same"answer, it must be right, is wishful thinking. In certainsimple domains I would treat equal results as strongly confirmatory.There used to be a list of system-independent bugs --caused by common simplistic thinking, wheremathematics taught in high school is used asthe basis for manipulating more sophisticatedideas.Sorry to provide a bit more rain on your parade.
Have fun with the easy parts and see how far youcan get with the hard parts!
RJF
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/7ad837b4-fa7e-4d5c-a008-6d11e03df84bo%40googlegroups.com.
User choice by option: If you want loose compatibility, then Inf in Mma. If you want strict compatibility there is a strict compatibility library and you can define SageInf in Mma.
--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/z3XBhQOCh9E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/e0924dda-7720-4485-94e3-50d444f6d89co%40googlegroups.com.
On Tue, Jul 14, 2020 at 12:12 AM Rocky Bernstein
<rocky.b...@gmail.com> wrote:
>
> I think we've beat this to death. So let's agree to disagree.
>
> This kind of thing is not intended for someone like you, but rather, someone like me who is just getting started in Sage and CAS and wants to go through a number of simple Mma tutorials and see roughly corresponding results translated to another system. If that works out, I am happy, and may try more ambitious things.
>
> The specific examples showing how the various systems are hopelessly incompatible or where there are subtleties and vagueness are interesting. However I suspect none of this is going to matter. At least not in the short term, if ever. This is for casual, non-mission-critical, and educational use. After I have something that isn't vaporware (if I get to that stage), you can pop up again and warn people of the dangers. I hear you, and you have some valid points. Now please go away.
>
> There were the hacks one used to do with calculators where you'd divide a number of times by a number and then multiply it back and get something slightly off. Using that, Homer Simpson was able to disprove Fermat's Theorem by finding a solution to the equation a**12 + b**12 = c**12 in TI calculator math. Somehow though, calculators and mathematics were both able to survive this ordeal.
I think this is a laudable goal, and while RJF's admonitions are
valid, I don't think it should discourage you from trying to get
something working.
I think even if you can get some simple cases
working it would be very impressive and useful.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CAOTD34YgEMj%2Bim%2BAE7AHekQ-R7rpP6-Cek2owAX8%2BJt_jcOceQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CANCp2gbv4qJLSpUgu-ie2gaPaU_etJTCG_JbMSTXtvJnV2fphA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CAEQuuAVtYh-FFhsuU%2BsFQAKRVCb0m6UKcjHTLCnNH1TZ6ps3EQ%40mail.gmail.com.