+ 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)
17 ответов
+ 7
Your challenge needs Mathematical background and is too complicated for SoloLearn that filled out with Amateur teenage Programmers. Try StackOverflow instead,
+ 5
I like ur logic..will try and send pgm
+ 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♥.
+ 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.
+ 2
it's like to differentiate polynomials
+ 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
+ 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
+ 2
Can someone explain differentiation?
+ 1
Many users dont understand. I should ask them if they understand differentiation?
+ 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
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.
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
0
Or download any other coder executor
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.
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.
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.
0
It's not the best code, but it should work
https://code.sololearn.com/cVGM5enrqRge/?ref=app