Borbély Gábor

1. Feladat

a)

(((((Sin[Pi/4]+1)/(Sin[Pi/4]-1))-((Sin[Pi/4]-1)/(Sin[Pi/4]+1))))^2)

b)

Divide[Divide[1+(Sqrt[5]),2], Divide[1-(Sqrt[5]),2]]

c)

Expand[(((1+x))^5)-(x^5)]

d)

Simplify[(((((Sin[Pi/4]+1)/(Sin[Pi/4]-1))-((Sin[Pi/4]-1)/(Sin[Pi/4]+1))))^2)]

2. Feladat

a)

1+(1*(1-1))

b)

1+{1,{1}}[[2,1]]

3. Feladat

a)

Tipus[x_,y_]:=Head[x]===Head[y]

Tipus[3,-2]
Tipus["három", "3"]
Tipus["három", 3]

b)

PozitivEgeszE[x_]:=If[IntegerQ[x],x>0,False]

PozitivEgeszE["három"]
PozitivEgeszE[-2]
PozitivEgeszE[2]

4. Feladat

x=3
n=3
(x^n)
ClearAll[x,n]

5. Feladat

n=3
g[x_]:=If[n<1,3,n]
f[x_]:=x>0
l=Range[n]-n
Select[l,f]

6. Feladat

Show[
Plot[Sin[x], {x,-2Pi, 2Pi}] ,
Plot[((Sin[x])/x), {x,-2Pi, 2Pi}, PlotStyle->Dashed] ,Plot[Tan[x],{x,-Pi/2, Pi/2}, PlotStyle->Dotted]
]

7. Feladat

Show[
Plot[((Sin[x])/x), {x,-10Pi,10Pi}, Filling->Axis, PlotRange->All],
ListPlot[Table[{x,0},{x,-10Pi, 10Pi, Pi}],PlotStyle->Red]
]

8. Feladat

Tobbszor[L_]:=Length[Select[L, EvenQ]]>Length[Select[L, OddQ]]

Tobbszor[{1,2,3}]
Tobbszor[{0,1,2,3,4}]

9. Feladat

Vegzodesek[x_]:=Table[StringTake[x,-i],{i,1,StringLength[x],1}]

Vegzodesek["vakáció"]

10. Feladat

ReplaceTextElement[x_]:=x//.{TextElement[a_, b_]->{b,a}, TextElement[a_]->a, Association[Rule["GrammaticalUnit",Entity["GrammaticalUnit",b_]]]->b}

text=Import["http://sandbox.hlt.bme.hu/~gaebor/ea_anyag/InfoMC/trump.txt", "Text"];

analyzed=ReplaceTextElement[TextStructure[text,"PartsOfSpeech"]];

analyzed2=Join @@Table[s[[2]],{s,analyzed}]
analyzed3=Table[w[[1]],{w,analyzed2}]

pairs=Table[{analyzed3[[i]],analyzed3[[i+1]] },{i,1, Length[analyzed3]-1}]
SortBy[Counts[pairs],Value]

Az {"Noun", "Punctuation"} pár a leggyakoribb!