Last modified: 2008-04-23 15:09:56 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T15216, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 13216 - Enable trigonometrical functions to #expr
Enable trigonometrical functions to #expr
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
ParserFunctions (Other open bugs)
unspecified
All All
: Normal enhancement with 4 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
: easy, patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-01 22:58 UTC by René Kijewski
Modified: 2008-04-23 15:09 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
changed Expr.php (14.15 KB, text/plain)
2008-03-01 23:26 UTC, René Kijewski
Details
Patch against rev32536 (6.10 KB, patch)
2008-04-09 16:49 UTC, René Kijewski
Details

Description René Kijewski 2008-03-01 22:58:37 UTC
There are several cases, when trigonometrical functions like sine or cosine could be usefull. I experienced this issue as I missed a proper functionality to calculate the (co)sine to do a polar projection.

It would be nice if expressions like {{#expr:sin (pi*1.5)}} would be working without workarounds like [[mw:Extension:MathStatFunctions]] or Taylor polynoms. I propose a patch enabling (unary) sin, cos, tan, asin, acos, atan, exp and ln, (binary) ^, and pi as a constant.

(Lacking a proper diff tool I used de.wp to do the diff)
http://de.wikipedia.org/w/index.php?title=Benutzer%3ARevolus%2FExpr.php&diff=43186472&oldid=43185892
Comment 1 Robert Leverington 2008-03-01 23:15:24 UTC
Could you just post the file you made because a wiki diff is very unusable as it converts tabs to 4 spaces making troubles when applying the patch; if you just post the file someone can then generate the unified diff. Thanks.
Comment 2 René Kijewski 2008-03-01 23:26:50 UTC
Created attachment 4687 [details]
changed Expr.php
Comment 3 visi-on 2008-03-02 07:57:05 UTC
Please add also the functions: abs, trunc, floor and log
Thanks
Comment 4 Tim Starling 2008-03-03 01:52:05 UTC
Why would you need to do a polar->cartesian transformation in wikitext? 
Comment 5 René Kijewski 2008-03-04 14:41:44 UTC
It's not needed in wikitext, but in geo location templates. Take Russia for an example: it's very long from east to west and very northern. So if you take the normal cartesian map, it looks strange, stretched. Almost every Wikipedia uses geo locating, so almost every Wikipedia could be needing it.

The functions abs, trunc, floor and log are maybe even more important. By now you have to do everything with cases and polynoms. I change would make #expr some more intuitive and I think it could relieve are parser from some parsings and recursions as well, as you would not need templates to do this anymore.
Comment 6 René Kijewski 2008-04-09 16:49:30 UTC
Created attachment 4797 [details]
Patch against rev32536

This patch implements sin, cos, tan, asin, acos, atan, exp, ln, abs, floor, trunc, ceil, ^, and the constants pi and e.
Comment 7 Raimond Spekking 2008-04-23 15:09:56 UTC
Applied with r33780 with slight modifications (adding two error messages).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links