[SOLVED] CSC3100 - Assignment 1 Derivative calculator

49.99 $

Category: Tags: , , , , ,
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon HM1-zacijg.zip (164.7 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
πŸ”’ Securely Powered by:
Secure Checkout
5/5 - (1 vote)

In this assignment, you need to complete a derivative calculator independently.
Function Requirement
In test A, each math expression includes β€œ+”, β€œ-”, β€œ*”, β€œ^”(see the example below)
1. x only appears once in each term of a polynomial
2. x will be the only variable, there will be no more than variables like y, z appear.
3. x will not be the power term
4. All constant numbers are integer, with no float (doubles).
5. The answer should be compact, i.e. no space within bits.
6. There will be no β€œ(β€œ and β€œ)” (brackets)
7. Space can appear in test A
8. In test A, all expressions are valid.
9. Tab will not be tested in oj.
10. Neglect β€œ^1” when the answer power is 1. Example 3: 35*x^6+16*x-6
However, β€œx^1” can appear in test.
An example of an input file for test A Expected output file:
x 1
x^2 2*x
5 * x ^ 7+ 8 * x ^ 2 – 6 *x^1 35*x^6+16*x-6
In test B, all requirements in test A should be satisfied, plus:
1. (no more than 2) functions including β€œsin” (sine function), β€œcos” (cosine function), the function must use a bracket to include variable x both in input and output
Assignment 1 Derivative calculator 1
2. sin and cos are compact without space splited (i.e. no β€œs i n (x) ” situation) .
3. β€œ(β€œ and β€œ)” (brackets);
β€œinvalid”
5. Please don’t use any product-to-sum formula or sum-to-product formula.
6. When there is no need to use the bracket, don’t use it, save it
(example 2: -sin(sin(45*x))*cos(45*x) ).
7. The chain rule should follow expanding from the outside to the inside
8. β€œ++”, β€œ+-”, β€œ- -” not allowed
9. β€œ*-constant” is viewed as the valid answer, when you take derivative f(βˆ’w β‹… x + b) in chain rule.
The answer is fβ€² βˆ— βˆ’w.
10. β€œ+(-”, β€œ-(-” is no need to simplify. Example 3: cos(x)-(-sin(4*x)), more example
cos(cos(x))β†’-sin(cos(x))*(-sin(x))
11. Invalidation occurs only if square brackets do not appear in pairs. Other invalid will not be tested in oj.
An example of an input file for test B Expected output file:
1+ 2.0 * sin(x) 2*cos(x)
cos( sin (45 * x) ) -sin(sin(45*x))*cos(45*x)
sin(x)-cos(4*x) cos(x)-(-sin(4*x))
sin(35-cos(4*x)) + cos(cos(x)) cos(35-cos(4*x))*(-sin(4*x))*4-sin(cos(x))*(-sin(x))
5*((3x+4)+8 invalid
sin(x)-cos(4*x) cos(x)-1*(-sin(4*x))*4
Assignment 1 Derivative calculator 2

  • HM1-zacijg.zip