Task 1

Install/Open Julia using one of the mentioned options.

Task 2

Calculate the solution of $$x - 10 + e^\pi = \sin(2.5)$$


In [1]:
sin(2.5)-exp(π)+10


Out[1]:
-12.542220488675312

Task 3

Calculate the exact value of y for $$ y = \frac13 + \frac35 + \frac57 + \frac{7}{11} + \frac{11}{13} $$ and convert the exact value to a floating point number.


In [4]:
y = 1//3 + 3//5 + 5//7 + 7//11 + 11//13
display(y)
Float64(y)


46999//15015
Out[4]:
3.13013653013653

Task 4

Create a string according to the following template and replace any occurence of '?' with the appropriate value.

"For x = 4.2 it holds that $\sin(x/2*\pi)$ = ? and $\cos(x/3*\pi)$ = ?"


In [8]:
"For x = 4.2 it holds that sin(x/2*π) = $(sin(4.2/2*π)) and cos(x/3*π) = $(cos(4.2/3*π))"


Out[8]:
"For x = 4.2 it holds that sin(x/2*π) = 0.3090169943749472 and cos(x/3*π) = -0.30901699437494756"

Task 5

We picked up the following encrypted message from a super secret agency who must not be named.

"Whc1atzcd,th3mc1and5zcc1anzc1ac1an5w,th3r,zc1abc1utzcc1a5k5zcn,thozc1aqc1u,th35t,thi,thon5?"

Fortunately we recently aquired the instructions how to decipher the message. The required steps have to be performed in the given order and are as follows:

  • convert numbers to letters
    • 1 -> l, 3 -> e, 5 -> s
    • remove all remaining numbers
  • remove n letters in front of vowels with n being:
    • 2 for a,u
    • 3 for o,e,i
  • replace za and zc with spaces

Decipher the message.

Hint: r"[aou]" matches the vowels a,o or u. r".{3}" matches any three characters.


In [ ]:
riddle = replace("What demands an  answer,  but asks no  questions?","  ","za")
riddle = replace(riddle," ","zc")
riddle = replace(riddle,r"([au])",s"cl\1")
riddle = replace(riddle,r"([oei])",s"nth\1")
riddle = replace(riddle,"l","1")
riddle = replace(riddle,"e","3")
riddle = replace(riddle,"s","5")
display(riddle)
riddle = replace(riddle,"1","l")
riddle = replace(riddle,"3","e")
riddle = replace(riddle,"5","s")
riddle = replace(riddle,r".{2}([au])",s"\1")
riddle = replace(riddle,r".{3}([oei])",s"\1")
riddle = replace(riddle,r"z[ac]"," ")

Task 6

Find a string for which the regular expression r"bb|[^b]{2}" matches.

Bonus: What does this regular expression actually mean?


In [16]:
ismatch(r"bb|[^b]{2}","adf")


Out[16]:
true