Question

Write a Python function evaluateFunction() that takes one floating point number x as its argument and returns 3√(log|x| )+3(x^3) The math module has a square root function and a logarithm function

Answer #1

The Python code is

` `` def evaluateFunction(x): x=float(x) import math ans=3*math.sqrt(math.log(math.fabs(x)))+3*(x**3) print(ans) evaluateFunction(2.5) `

The output is

49.746692286242975

The image of code is

Here we use Jupyter notebook for python

python pls
Create function math_life()
this function takes one or more argument.
If this function called with no argument, raise typeError. The
math_life() function returns to a function defined inside. this
will take a one argument. For the second argument, it will
calculate second function passed to math_life(). You should assume
that the math_life() passed x functions, when it called the x times
it will calculate the xth function passed to math_life() arguments
when it called x+1 time it again...

Write a function find square root(x) that takes as input a
number x and as output returns the square root of x. Your results
should converge to at least 6 decimal places. matlab question

Write a function named “highestScore” that
takes an array of floating point scores and its size as parameters
and return the highest of these scores.
The function prototype:
float highestScore(float scores[], int size);

Write a Python program using that takes a number as input and then
prints if the number is even or odd. The program should use a
function isEven that takes a number as a parameter and returns a
logical value true if the number is even, false otherwise.

5.34 Write a function statement() that takes as input a list of
floating-point numbers, with positive numbers representing deposits
to and negative numbers representing withdrawals from a bank
account. Your function should return a list of two floating-point
numbers; the first will be the sum of the deposits, and the second
(a negative number) will be the sum of the withdrawals.
>>> statement([30.95, -15.67, 45.56, -55.00, 43.78])
[120.29, -70.67]

TO BE DONE IN PYTHON: Write a function `lowest_integer()` which
takes 2 input arguments:
1)a function `g` representing an increasing function
g(x)
2) a number `gmin`,
and returns an integer `nmin` such that
nmin>0
is the smallest integer that satisfies
g(nmin)>gmin.
test:
def g(n):
return 2*n
print(lowest_integer(g, 10))
Output: 6

Write a Python function that takes a filename as a parameter and
returns the string 'rows' if a file was written row by row, and
'columns' if the file was written column by column. You would call
the function with a command like filetype = myfunc(filename).

Using C++
Write a template function that accepts an integer
parameter and returns its integer square root.
The function should return -1, if the argument passed is not
integer.
Demonstrate the function with a suitable driver program .

In Python: This will require you to write several functions, and
then use them in a program. Logical Calculator The logical
calculator does math, but with logical operators. In logic, we
represent a bit with 0 as false and a bit with 1 as true. The
logical operators are NOT, AND and OR. Bitwise logical calculations
operate on each bit of the input. The NOT operator works on just
one three-bit argument. NOT 011 = 100 The AND operator works...

In
C: write the function definition for a function called COMPOSITENUM
that takes one double argument called num. The function will
declare, ask and get another double from the user. Compare the
double entered by the user to NUMband return to a 0 if they are the
same, a -1 if num is less than the double entered by the user and 1
if it is greater.

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 1 minute ago

asked 6 minutes ago

asked 13 minutes ago

asked 13 minutes ago

asked 27 minutes ago

asked 27 minutes ago

asked 33 minutes ago

asked 34 minutes ago

asked 37 minutes ago

asked 38 minutes ago

asked 48 minutes ago

asked 56 minutes ago