Talk:Unicode polynomial equation: Difference between revisions

From Rosetta Code
Content added Content deleted
(Variety is the spice of life, celebrate! ☺)
Line 28: Line 28:
|Unicode || x⁵ - 2x⁴ + 42x³ + 40x + 1 || x⁵ - 2x⁴ + 42x³ + 40x + 1 || x⁵ - 2x⁴ + 42x³ + 40x + 1
|Unicode || x⁵ - 2x⁴ + 42x³ + 40x + 1 || x⁵ - 2x⁴ + 42x³ + 40x + 1 || x⁵ - 2x⁴ + 42x³ + 40x + 1
|-
|-
|MediaWiki || x<sup>5</sup> - 2x<sup>4</sup> + 42x<sup>3</sup> + 40x + 1|| <nowiki>x<sup>5</sup> - 2x<sup>4</sup> + 42x<sup>3</sup> + 40x + 1</nowiki>|| x5 - 2x3 + 42x3 + 40x + 1
|MediaWiki || x<sup>5</sup> - 2x<sup>4</sup> + 42x<sup>3</sup> + 40x + 1|| <nowiki>x<sup>5</sup> - 2x<sup>4</sup> + 42x<sup>3</sup> + 40x + 1</nowiki>|| x5 - 2x4 + 42x3 + 40x + 1
|}
|}


Line 42: Line 42:


:Hi NevilleDNZ, I guess we take different views on what would make an interesting task. That's OK. --[[User:Paddy3118|Paddy3118]] 09:15, 19 November 2011 (UTC)
:Hi NevilleDNZ, I guess we take different views on what would make an interesting task. That's OK. --[[User:Paddy3118|Paddy3118]] 09:15, 19 November 2011 (UTC)

Cheers for that. Thank Zeus that we are all different. Imagine if we were all the same. That face in the mirror in the morning would be that of "Sheldon Cooper"... this is probably OK. But then when you fled back to bed for conform, you would discover your hot date from last night also is a "Sheldon Cooper". Variety is the spice of life, celebrate! [[User:NevilleDNZ|NevilleDNZ]] 09:33, 19 November 2011 (UTC)

Revision as of 09:33, 19 November 2011

Suggested improvements

This proposal does not limit the syntax in any way. It does not mention parenthesis. Meanwhile, 1+1/x is not a polynomial (and neither is x^1/x), and limiting supported syntax to only that unicode which can represent polynomials would still allow for a variety of ambiguities, such as:

cry
c₁y¹+c₂y²
∑ (1+xⁿ)xⁱ

I recommend explicitly listing the characters which should be supported, and eliminating the parts of the task description which refer to negative exponents. Another alternative would be to change the task name and explicitly document the syntax being supported. --Rdm 19:12, 18 November 2011 (UTC)

re: Openended - I've added a specific list of unicode that should be supported. e.g. {⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ⁻ ⁺ · × ⁄ ↑ ⏨} (I hope I have not missed any interesting ones).
  • re: cry - The task is for polynomials of one variable, and "x" is the tradition "unknown". However I am inclined to think that the first lowercase letter (excluding "e") could be used as the "unknown", eg z, y etc.
  • re: c₁y¹+c₂y² - The examples in the text are with real coefficients. Allowing c₁ & c₂ would make the coefficients symbolic, and thus the task a whole lot harder. Similarly allowing complex numbers might stress some contributors: z⁵ - (1+2i)z⁴ + (405+4i)z³ + (403+4i)z + 5+2i or z⁵ - 1⊥2 z⁴ + 5⊥4 z³ + 3⊥4 z + 5⊥2. I have left manipulation of complex numbers to a future task.
  • re: negative exponents / misnamed? - it seemed a shame to restrict the exponent to just +ve Integers. And it is only as very minor code adjustment to allow -ve exponents in a "finite power series" and it does not detract from polynomials. Is there a better name for equations such as: x⁻⁵ - 2⁄x⁴ + 42x⁻³ + 40/x + 1x⁻⁰ + 40x + 42x³ - 2x⁴ + x⁵? Maybe "finite power series"?
  • re:∑ (1+xⁿ)xⁱ - true.. if n and the bounds of the ∑ are known, then it could be a polynomial. But again, let us avoid symbolic manipulation. A simple array of real coefficients is what is required.
ThanX for the feedback. NevilleDNZ 05:46, 19 November 2011 (UTC)
I find this task objectionable, if for no other reason than promoting bad typography. The unicode super-/subscripts are only good for when you don't have a way to mark up text. They are generally too small, inflexible, and unpleasant to look at. And, I don't see any practical merit in parsing such strings: I don't see why a human would carefully type out those difficult symbols as input data to a program, and if it's generated by machines, you might as well tell the machine to do a better job by writing structured/properly marked up data. --Ledrug 03:00, 19 November 2011 (UTC)

I'm sorry that you find this task objectionable, which languages have built in "mark up text"? I am using unicode because unicode is standardised, and widely supported. wikitext on the other hand is a non-standard e.g. {AsciiDoc, BBCode, Creole, deplate, Markdown, MediaWiki, Org-mode, PmWiki, POD, reStructuredText, Setext, Textile, Texy!, txt2tags, etc. etc. etc. also XML & HTML & Latex) and not built in to many languages.

The other problem with "markup" is that inevitably when a polynomial is cut and pasts it gets broken:

Comparing cut and pasting of polynomials.
Method Example Markup Paste result
Unicode x⁵ - 2x⁴ + 42x³ + 40x + 1 x⁵ - 2x⁴ + 42x³ + 40x + 1 x⁵ - 2x⁴ + 42x³ + 40x + 1
MediaWiki x5 - 2x4 + 42x3 + 40x + 1 x<sup>5</sup> - 2x<sup>4</sup> + 42x<sup>3</sup> + 40x + 1 x5 - 2x4 + 42x3 + 40x + 1

I would agree that program should be agnostic of input and output formats. So providing a way (plugin, template or library) to read/write data from unicode and/or wikitext would be an effective way for supporting it. Do you suggest a task for every different kind of markup, or do you have a particular favourite wikitext? I am happy to suggests improvements if you create a task to which implements your favourite markup.

ThanX for the feedback. NevilleDNZ

Format of the task

"Given a string containing any untidy Unicode polynomial..."

I think that mention of 'any' goes on to make this a difficult task. How about just limiting the task to parsing a very limited subset of the formats you mentioned that are more likely to be used in practice? Or how about chucking the emphasis on parsing and making the trask more about outputting an input polynomial in a normaized format? (That should address some of the issues that Ledrug pointed out above, and that I share). --Paddy3118 05:02, 19 November 2011 (UTC)

I have added "Specific examples of Unicode and polynomial texts to be parsed as test cases" and removed the word "any". This should about cover the ugliest polynomials I can imagine. ThanX NevilleDNZ 05:53, 19 November 2011 (UTC)

Hi NevilleDNZ, I guess we take different views on what would make an interesting task. That's OK. --Paddy3118 09:15, 19 November 2011 (UTC)

Cheers for that. Thank Zeus that we are all different. Imagine if we were all the same. That face in the mirror in the morning would be that of "Sheldon Cooper"... this is probably OK. But then when you fled back to bed for conform, you would discover your hot date from last night also is a "Sheldon Cooper". Variety is the spice of life, celebrate! NevilleDNZ 09:33, 19 November 2011 (UTC)