Last active
October 25, 2017 08:13
-
-
Save hjnowakowski/92812593083646353f3e24d146637164 to your computer and use it in GitHub Desktop.
Numerical methods notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Funkcja plot | |
Plot[x^2, {x, -Pi, Pi] | |
Plot[x^2, {x, -Pi, Pi}, PlotStyle -> {Orange, Thickness[0.0067]}] | |
Plot[x^2, {x, -Pi, Pi}, | |
PlotStyle -> {Orange, Thickness[0.0067], Dashing[{.03, .03}]}] | |
Show[r1, r2, PlotRange -> All, PlotLabel -> "sratatata"] | |
E = Table[Cos[ArcTan[2]], {23, 4, 34323423424345}] //nie dziala | |
ListPlot[E, PlotStyle -> [Pink]] | |
//Pętle | |
Do[tresc, {iterator, start, stop, krok}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dwwjw[w_,v_] := Module[{t, n = Length[w], m = Length[v]}, | |
t = Table[byleco, {n+m}]; | |
Do [t[[i]]=w[[i]], {i, n}]; | |
Do [t[[i+n]]=v[[i]], {i, m}]; | |
Print[Join[w, v]]; | |
Print[t]; | |
] | |
w1 = {"a", "b", "c", 1, 2, 56}; | |
w2 = {"d", "e", "f", "lalalala"}; | |
dwwjw[w1, w2] | |
In[51]:= skew[v_] := Module[{n = Length[v], suma=0 }, | |
Do[suma = suma + v[[i]]^2,{i, n}]; | |
Return[suma] | |
] | |
w = {1, 2, 3, 4, 2}; | |
skew[w] | |
Out[53]= 34 | |
In[55]:= polpi[f_] := Module[{}, Print[Sqrt[skew[f]]//N]] | |
In[54]:= polpi[w] | |
5.83095 | |
tp[p_] := Module[{t}, | |
t = Table[1, {i, p + 1}, {j, i}]; | |
Do[t[[i, j]] = t[[i - 1, j - 1]] + t[[i - 1, j]], {i, 3, p + 1}, {j, | |
2, i - 1}]; | |
Print[t // MatrixForm] | |
] | |
tp[7] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(*szukanie elementu minimalnego*) | |
elmin[w_] := Module[{m = w[[1]], d = Length[w], ile=0, gdzie={}}, | |
Do[If[w[[i]]<m, m=w[[i]]], {i,2,d}]; | |
Do[If[w[[i]]==m,ile++;gdzie=Append[gdzie, i]], {i, d}]; | |
Print[m]; | |
Print["Elementem minimalnym tablicy jest ", m ,"i ma indeks ", gdzie, " występuje tyle razy: ", ile] | |
] | |
t = {0, -2, 3, Pi, -E, 1, -3}; | |
elmin[t]; | |
(* Sumuje Z *) | |
zorro[w_, z_] := Module[{m ,s=0}, | |
m = Table[RandomInteger[{-z,z}],{w}, {w}]; | |
Print[m//MatrixForm] | |
If[w==1, Return[m[[1,1]]]] | |
Do[s+= m[[1,i]], {i,w}]; | |
Do[s+=m[[w-i+1, i]], {i,2,w-1}]; | |
Do[s+=m[[w,i]],{i,w}]; | |
Print[m // MatrixForm]; | |
Print[s] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment