+ 16

Challenge : : Differentiation of polynomial.

Make a program which takes a polynomial of x as input and return the differentiated version of the polynomial. For simplicity, we use integer coefficient and power Examples: Input - - - - > 3x^2+4x+1 Output------> 6x+4 Input - - - - > x^4+4x+7 Output - - > 4x^3+4 Bonus : Modify the program to work for fractional coefficient and power. Input - - - > 4x^(1/2)+(1/2)x Output - - > 2x^(-1/2)+(1/2)

2nd Oct 2017, 1:09 PM
AlphaCoder
AlphaCoder - avatar
17 Antworten
+ 7
Your challenge needs Mathematical background and is too complicated for SoloLearn that filled out with Amateur teenage Programmers. Try StackOverflow instead,
2nd Oct 2017, 6:15 PM
Php Sql
Php Sql - avatar
+ 5
I like ur logic..will try and send pgm
2nd Oct 2017, 5:14 PM
GurpreetKaur Rahedi
GurpreetKaur Rahedi - avatar
+ 5
https://code.sololearn.com/cYrmumS9VUWi/?ref=app This is my own answer to the challenge. For powers like 1/2 kindly use 0.5. NOTE: Kindly copy to your own code executor(e.g. Qpython, e.t.c.)...this executor wanna take multiple inputs simultaneously which isn't ideal for this code. Kindly leave a comment and hit a like♥.
2nd Oct 2017, 10:26 PM
EMMANUEL OLUYOYIN OLUWATIMILEYIN
+ 2
My response in Ruby: https://code.sololearn.com/c4N0Ap1DoY2x/?ref=app Modified from my older differential count code. Don't forget spaces around mathematical operators (eg. "x^3 + 12x^2 + 5x" not "x^3+12x^2+5x") when entering input. No fractional coefficient and power yet.
2nd Oct 2017, 7:14 PM
André
André - avatar
+ 2
it's like to differentiate polynomials
3rd Oct 2017, 6:30 AM
Guy Anonymous
Guy Anonymous - avatar
+ 2
Kindly download qpython from playstore or applestore then copy and run my code on it. I need comments in it https://code.sololearn.com/cYrmumS9VUWi/?ref=app
3rd Oct 2017, 9:33 AM
EMMANUEL OLUYOYIN OLUWATIMILEYIN
+ 2
I proposed the same challenge. the response rate was zero. https://www.sololearn.com/discuss/612446/?ref=app here is my solution. instead of ^ as power, I use **, that is more practical (at least in Python) https://code.sololearn.com/c0WWTdNANL48/?ref=app
3rd Oct 2017, 7:17 PM
yuri
+ 2
Can someone explain differentiation?
10th Oct 2017, 1:22 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
Many users dont understand. I should ask them if they understand differentiation?
4th Oct 2017, 2:58 AM
AlphaCoder
AlphaCoder - avatar
+ 1
Hi, So here I give it a try. I don't think it work on some cases but it will work on simple equations. here is my code. https://code.sololearn.com/cjKSXS2VvOSB/?ref=app
10th Oct 2017, 5:24 AM
Gautam Kumar
0
@yuri, this is a string manipulation problem. So if you kindly replace the ** with ^. And why doesn't your program take input. @Emmanuel, your program shows error.
4th Oct 2017, 3:04 AM
AlphaCoder
AlphaCoder - avatar
0
@AlphaCoder I gave the advise of copying my code to another coder executor...such as qpython. My code runs but you won't be able to enjoy/use with sololearn code executor. Kindly download qpython app from playstore. Thanks
4th Oct 2017, 7:06 AM
EMMANUEL OLUYOYIN OLUWATIMILEYIN
0
Or download any other coder executor
4th Oct 2017, 7:08 AM
EMMANUEL OLUYOYIN OLUWATIMILEYIN
0
If u must use Solo learn, run it like this: Your first input can be any number: e.g.: 4 You are to enter numbers as many as ur first input is: e.g.: 3 4 7 2.5 NOTE: These inputs are ur powers of x(I.e. x^3,x^4,x^7,x^(2.5)) NOTE: Don't enter two or more equal numbers here. NOTE: The program automatically re-arranges these inputs in order of increasing numbers(I.e. x^(2.5) comes before x^3 which also comes before x^4, then x^7 comes last) Next u enter numbers as many as the previous enteries: e.g.: 2 7 1 4 NOTE: These inputs serve as ur coefficients of x^(...)I.e.2x^(2.5), 7x^3, 1x^4, 4x^7 On running these inputs u get 5x^(1.5) + 21x^2 + 4x^3 + 28x^6 Thus, if ur first input is 3, u must have 6 other inputs, if it's 10 u must also have 20 other inputs like that and like that. This is why I said another code executor should be used to use at a better ease. Kindly bear with my code. Thanks.
4th Oct 2017, 7:30 AM
EMMANUEL OLUYOYIN OLUWATIMILEYIN
0
If u must use Solo learn, run it like this: Your first input can be any number: e.g.: 4 You are to enter numbers as many as ur first input is: e.g.: 3 4 7 2.5 NOTE: These inputs are ur powers of x(I.e. x^3,x^4,x^7,x^(2.5)) NOTE: Don't enter two or more equal numbers here. NOTE: The program automatically re-arranges these inputs in order of increasing numbers(I.e. x^(2.5) comes before x^3 which also comes before x^4, then x^7 comes last) Next u enter numbers as many as the previous enteries: e.g.: 2 7 1 4 NOTE: These inputs serve as ur coefficients of x^(...)I.e.2x^(2.5), 7x^3, 1x^4, 4x^7 On running these inputs u get 5x^(1.5) + 21x^2 + 4x^3 + 28x^6 Thus, if ur first input is 3, u must have 6 other inputs, if it's 10 u must also have 20 other inputs like that and like that. This is why I said another code executor should be used to use at a better ease. I think this is explanatory enough. Kindly bear with my code. Thanks.
4th Oct 2017, 7:31 AM
EMMANUEL OLUYOYIN OLUWATIMILEYIN
0
If u must use Solo learn, run it like this: Your first input can be any number: e.g.: 4 You are to enter numbers as many as ur first input is: e.g.: 3 4 7 2.5 NOTE: These inputs are ur powers of x(I.e. x^3,x^4,x^7,x^(2.5)) NOTE: Don't enter two or more equal numbers here. NOTE: The program automatically re-arranges these inputs in order of increasing numbers(I.e. x^(2.5) comes before x^3 which also comes before x^4, then x^7 comes last) Next u enter numbers as many as the previous enteries: e.g.: 2 7 1 4 NOTE: These inputs serve as ur coefficients of x^(...)I.e.2x^(2.5), 7x^3, 1x^4, 4x^7 On running these inputs u get 5x^(1.5) + 21x^2 + 4x^3 + 28x^6 Thus, if ur first input is 3, u must have 6 other inputs, if it's 10 u must also have 20 other inputs like that and like that. This is why I said another code executor should be used to use at a better ease. I think this is explanatory enough. Kindly bear with my code. Thanks.
4th Oct 2017, 7:33 AM
EMMANUEL OLUYOYIN OLUWATIMILEYIN
0
It's not the best code, but it should work https://code.sololearn.com/cVGM5enrqRge/?ref=app
13th Oct 2017, 1:30 AM
Faisal
Faisal - avatar