11
2
Given a polynomial in one variable with rational coefficients, output an equivalent expression containing only 1
, variables, and definite integrals. For example, -x2 can be expressed as ∫x∫111dtxdu.
E := 1 | var | ∫EEEdvar
Any reasonable input/output method is allowed.
Examples:
Your score will be the your code length multiplied by the number of ∫
symbols used on the test cases. You should be able to score your program. Lowest score wins.
Test cases:
4/381*x^2+49/8*x^3-17/6
311/59*x^2-92/9*x^3-7/15*x
333/29*x^3+475/96*x^8
Golfing is going to be difficult, because I can't golf just the code or just the output, and I therefore do not know if a change will help or hurt my score until I try it, which sucks in my opinion.
Don't let the score restrict your creation. You are welcomed to answer with mainly one part of the score well optimized, even if the other one badly left.
related. Duplicate? – Olivier Grégoire – 2018-04-17T08:20:01.737
@OlivierGrégoire Inverse work – l4m2 – 2018-04-17T12:06:41.813
This is an interesting challenge, made much worse by its scoring system. I could instantly claim a score of 0, irregardless of my code's length, simply by assigning
chr(8747)
(or equivalent) to a variable, and using that as the sign, incurring zero occurrences of the symbol. I'd strongly recommend making this a vanilla code golf challenge. – caird coinheringaahing – 2018-04-17T21:38:53.5603@cairdcoinheringaahing No matter you use any output format, e.g.
0=[1,1,1]
, it's still counted as "1∫
". Thus you can only get 0 score on test case1
andx
– l4m2 – 2018-04-18T04:31:26.1831Personally, I think this would be better as a code-golf question. Any solution will be impressive, so I don't think there's a need to require as few integrations as possible. – mbomb007 – 2018-04-23T14:58:49.573
Also, that way you can change the test cases or add more without changing the score of each answer, which I think is really important. What if someone's program doesn't work for input of
0
, for example, or-1
? Does it need to if the test cases above are the only ones? – mbomb007 – 2018-04-23T16:52:17.830@mbomb007 https://codegolf.meta.stackexchange.com/a/2507 It's not a pure golf cuz some way to shorten makes the result expression long that's not what I so want
– l4m2 – 2018-04-23T18:19:54.507@mbomb007 polynomial mean no negative exponent – l4m2 – 2018-04-23T18:20:32.443
@l4m2 The expression is going to be huge no matter what if the only integer we can use is
1
... – mbomb007 – 2018-04-23T18:44:00.653@mbomb007 not that large as you think – l4m2 – 2018-04-23T18:54:14.117