Top answers


Suppose that you have a <p> element with an id of 'id1'. Use javascript to set the inner html of this element to 'hello!'

We will do this in 2 steps to make it easier to understand. Firstly, we need to obtain the actual &lt;p&gt; element with javascript. To do this, we use the following command:var p = document.getElementById('...
JC
Answered by Jamie C. Javascript tutor
1579 Views

Find the integers n such that 4^(n)-1 is prime.

4^(n)-1 factors to (2^(n)-1)(2^(n)+1) by difference of two squares by definition of a prime (only has factors 1 and itself (given that itself isn't 1))So Exactly one of the brackets should = 1 for 4^(n)-1 to...
GH
Answered by George H. Maths tutor
3322 Views

Give a segment of python code that will print the numbers 1 to 7, each one on a new line

for x in range(1,8) : print(x) The range(1,8) function gives us an array of numbers from 1 to 7. The number on the right is the upper bound of the numbers which is why only 1 to 7 is returned.From here, a fo...
JC
Answered by Jamie C. Python tutor
4113 Views

Given that y = x^2 +2x + 3, find dy/dx.

We use a typical rule for polynomials in the form y = a x b , where a and b are real numbers. Also, for a polynomial equation y = a x b +c x d +.... , dy/dx = d( a x b )/dx + d(c x d )/dx + ...With this info...
JC
Answered by Jamie C. Maths tutor
6127 Views

How to differentiate e^x . sin(x)

e x sin(x) is a product of two functions: e x and sin(x). This means we can use the product rule. Let e x = u and sin(x) = v The differential of uv is u'v + v'u where u' and v' are the two functions differen...
BW
Answered by Brent W. Maths tutor
44903 Views