Wolfram Mathematica

Informatics 1, Practice 8

Based on a notebook by Rudolf Csikja.

Arithmetics

Task 1

Calculate the following formulas. You can’t just copy and paste the formulas, use the palettes from the menu.

(Sqrt[((2-(Sqrt[2]))/(2+(Sqrt[2])))])+(Sqrt[((2+(Sqrt[2]))/(2-(Sqrt[2])))])

((sin(60°))^(Sqrt[8]))+(((3^10)+(3^11))/((3^12)-(3^10)))+((((1/49)))^((Subscript[log, (Sqrt[7])])(2)))

Task 2

Simplify the following complex number, try symbolic and numeric calculation as well:  ((5+7i)/(3-5i)).

Calculate every 5th root of 2+3i.

Task 3

Show that (e^((Sqrt[163])π))is surprisingly close to an integer. How close is it?

Task 4

Transform the number (Subscript[5543, 7]) (which is in base 7) to base 13.

Logic

Task 5

Which one is greater

(2^300) or (3^200),

(Subscript[log, 2])(3) or (Subscript[log, 3])(5)?

Task 6

Show that A=>(B∨A) is a tautology (it is true for every value of A and B).

Task 7

Create the variables x and y, choose any real number as values for them. Write an If statement that gives the greater one as a result.

Lists

Task 8

Make a list of numbers which have two digits and divible by 3.

Make a list which devides the inteval [-π,π] into 30 equal parts (contains 31 numbers from -π to π).

Task 9

Make the following list with list-arithmetic:

Task 10

Find an expression which produces this: {{(x^2),(y^2),(z^2)},{(x^3),(y^3),(z^3)},{(x^4),(y^4),(z^4)}}

Table[(a^n),…]

Task 11

Make a list of 100 random integers ranging between -5≤n≤5

Make a list of 100 random numbers out of n∈{-1, -2, 1, 2}

Task 12

On a competition there are 7 competitors: {a,b,c,d,e,f,g}, Produce all of the possible top 3 results (ordering matters). How many of these are there?

Task 13

Produce the elements of the Descartes product H×H={(1,1), (1,2), (1,3),…,(2,1), (2,2), (2,3),…,(10,10)} with H={1,2,…, 9,10}, but only those elements in the form (u,v) where u and v have different parity (if u is odd, then v is even or the other way around).

Functions

Task 14

Define a function A which calculates the area of a circle, given its radius.

Task 15

Define a list, where the input is a list of real positive numbers and the output is a two-element list. The first element of the output should be the avarage of the elements, the second should be the geometric mean.

Task 16

Define the function f(x)=(x^3)(e^x). Plot f, f' and f'' on a single figure on the interval [-5,1] !

Task 17

Define the factorial funcion f(n)=n! Use recursion: f(0)=1, f(n)=n·f(n-1)

Task 18

Write the gcd function with Euclidean algorithm.

Eukl[a_,b_]:=...

Task 19

Define the following function:

g(n):={({{n/2, if n is even}, {3n+1, if n is odd}})

Calculate for a given number n the number of applications of g needed to reach 1.
Use NestWhile to generate a list: {n, g(n), g(g(n)), ... 1}

Plot the number of iterations against the number with a ListPlot.

Task 20

Select the composite numbers from {1,2...1000} (use a pure function for a number not being a prime)

Task 21

Make a table of values where the element with index (i,j) is the sum of the jth powers over the complex ith roots if 1 (i=1…10, j=1…10).

(Subscript[a, i,j])=(∑_((z^i)=1))(z^j)

Task 22

Define a function with two arguments which are both a function and calcuate the integral if their product over [-1,1].
f(ϕ,ψ)=(∫_(-1)^1)ϕ(x)ψ(x)dx

Make a table of f(x↦(x^i),x↦(x^j)). And for the Legendre polynomials!