Idazkera eta zenbaki-bildumak

Factor[x^2 + 2*x + 1]

N[Pi, 20]

f[x_] = x^2 + a*x + b

N[Solve[(f[x] == 0) /. {a -> 4, b -> 2}, 
        x]]

Plot[(f[x]) /. {a -> 4, b -> 2}, {x, -4, 
        2}]

ListPlot[{{0, 1}, {1, 0.5}, {2, 1.5}},PlotJoined -> True,PlotStyle,AxesLabel->{x, y}];

ListPlot[{{0, 1}, {1, 0.5}, {2, 1.5}}, PlotJoined -> True, 
        PlotRange -> {{0, 10}, {-1, 2}}];

((3 + 5)^2 - 2*Sqrt[5])/10.

Cos[3.1416]

sorta = Table[{i, N[Log[i]]},  {i,  1, 10}]

ListPlot[sorta]

mat = {{-2, 1}, {-3, 4}}

MatrixForm[mat]

N[LinearSolve[mat, {5, -3}]]

a = 2.0; b = a*Pi;
d = e*Pi /. e -> 2.0;

{a, b, d, e}

Clear[a]; a

Laguntza-eskaera

?*olv*

?? Solve

Aritmetika

N[Pi, 15]

Round[5.25]

Mod[8, 3]

Conjugate[1.5 - 2.6*I]

dat = 
      ReadList["c:/tex/garatu/datuak.txt", Number, 
        RecordLists -> True]

dat[[1, 2]]

Zerrendak eta matrizeak

zer = Table[i^2, {i, 1, 5}]

AppendTo[zer, 36]

MatrixForm[dat]

LinearSolve[dat, {2, 0, -6}]

adjuntu = 
      Table[(-1)^(6 - i - j)*Minors[dat][[3 - i + 1, 
              3 - j + 1]], {i, 1, 3}, {j, 1, 3}]

MatrixForm[(Transpose[adjuntu]/Det[dat]) . dat]

Funtzioak, polinomioak eta ekuazioak

f[x_] = Sin[x]/x; 
    Plot[f[x], {x, -4*Pi, 4*Pi}, PlotRange -> All];

?? PolynomialQuotient

PolynomialQuotient[x^3 - 4*x^2 - 3*x + 1, x^2 - 2*x + 3, x]

PolynomialRemainder[x^3 - 4*x^2 - 3*x + 1, x^2 - 3, x]

Expand[(-4 + x)*(x^2 - 3) - 11]

puntuak = {{0, 2}, {1, 1}, {2, 3}, {3, 2}, {4, 5}};

g[x_] = InterpolatingPolynomial[puntuak, x]

Show[{Plot[g[x], {x, -1, 5}], 
Graphics[
            Table[Disk[puntuak[[i]], {0.1, 0.2}], {i, 1, 
                Length[puntuak]}]]}, 
AspectRatio -> 
          0.5];

Solve[{2*x - y == 5, -3*x - 4*y == -2}, {x, 
        y}]

Limiteak, deribatuak eta integralak

Limit[Sqrt[x^ 2 - 1]/(2*x + 3), x -> Infinity]

\(\(\(\(Trap[f_, x_, n_, x0_, x1_] := 
        TrapLag[Function[x, f], n, x0, x1];\)

    \(TrapLag[f_, n_, x0_, x1_] := 
        Module[{i, h = \((x1 - x0)\)/n, xb = x0, bat = 0, 
            puntuak = {{x0, N[f[x0]]}}, 
\ 
            marrak = {Line[{{x0, 0}, {x0, N[f[x0]]}}]}, f0 = N[f[x0]], 
            f1}, \ 
For[i = 1, i ≤ n, \(i++\), 
            xb = xb + h; f1 = N[f[xb]]; 
            bat = bat + h*N[\((f0 + f1)\)/2]; 
AppendTo[
              puntuak, {xb, f1}]; \ 
AppendTo[marrak, 
              Line[{{xb, 0}, {xb, f1}}]]; 
            f0 = f1]; \ 
Show[{Plot[f[r], {r, x0, x1}, 
                DisplayFunction -> Identity], \ 
ListPlot[
                puntuak, PlotJoined -> True, 
                DisplayFunction -> Identity], 
\ 
              Graphics[marrak]}, 
            DisplayFunction -> $DisplayFunction]; 
\ 
          Print["batura hurbildua = ", bat]; 

          Print["Integral zehatza = ", 
            N[NIntegrate[f[x], {x, x0, x1}], 10]]];\)\)\(\ \)\)\)

Trap[0.4*r^4 - 2*r^3 - 2*r^2 + 10*r + 20, r, 20, 0.0, 5.0]

Estatistika

zer = {-1, 6, 4, -3};

{Mean[zer], Variance[zer], Max[zer]}

Sum[zer[[i]], {i, 1, Length[zer]}]/Length[zer]

StandardDeviation[zer]

Random[Real, {1, 14}]

<< Statistics`ContinuousDistributions`

ban[x_] = PDF[NormalDistribution[0, 1], x]

Plot[ban[x], {x, -3, 3}];

Programazioa

?? If

i = 1; While[i ≤ 5, a = i^2; Print[a]; i = i + 1]

f[x_] = 
        Which[x < 0, -1, 4 ≥ x ≥ 0, 1, x > 4, 
          2];
Plot[f[x],{x, -5, 5},PlotLabel->"funtzio ez-jarraia",
Ticks -> {{-4, 0, 4}, {-1, 
                1}},PlotRange -> {{-5, 5}, {-1.5, 
                2.5}},
PlotStyle -> Thickness[0.01]];

Grafikoak

ParametricPlot[{Cos[t], Sin[t]}, {t, 0, Pi/6}, 
        AspectRatio -> 1];

Show[
        GraphicsArray[
{{Graphics[{RGBColor[1, 0, 0], 
                  Line[{{1, 2}, {3, 1}}]}], 
              Graphics[
                Polygon[{{0, 0}, {2, 2}, {2, 
                      0}}]]}, 
{Graphics[
                Circle[{2, 2}, {1, 2}]], 
              Graphics3D[Cuboid[{1, 2, 4}]]}}]];

Adibidea: Pytagoras-en Teoremaren frogapen grafikoa

<< Graphics`Arrow`

triangelua = 
        Graphics[{Thickness[0.006], 
            Line[{{1, 1}, {2, 1}}], 
Line[{{1, 1}, {1, 
                  2}}], Line[{{2, 1}, {1, 
                  2}}]}];
karratukoloredunak = 
        Graphics[{{RGBColor[1, 1, 
                0], 
Polygon[{{1, 0}, {2, 0}, {2, 1}, {1, 
                    1}}]}, 
{RGBColor[1, 0, 1], 
              Polygon[{{0, 1}, {1, 1}, {1, 2}, {0, 
                    2}}]}, 
{RGBColor[0, 1, 1], 
              Polygon[{{2, 1}, {1, 2}, {2, 3}, {3, 
                    2}}]}}];
luzerak=Graphics[{Text["a",{0.85, 1.4},{0, -1},{1, 0}],
Text["b",{1.5, 0.65},{0, -1},{1, 0}],
Text["d",{1.65, 1.4},{0, -1},{1, 0}],
Text["(a^2)+(b^2)=(d^2)?",{3.2, 0.9},{0, -1},{1, 0}]}];

gezia = 
        Graphics[{Thickness[
              0.01], 
Arrow[{4, 1.5}, {5, 1.5}, 
              HeadWidth -> 1. , 
              HeadLength -> 
                0.04]}];
karratukoloredunak2 = 
        Graphics[{{RGBColor[1, 1, 
                0], 
Polygon[{{7, 0}, {8, 0}, {8, 1}, {7, 
                    1}}]}, 
{RGBColor[1, 0, 1], 
              Polygon[{{6, 1}, {7, 1}, {7, 2}, {6, 
                    2}}]}, 
{RGBColor[0, 1, 1], 
              Polygon[{{8, 1}, {7, 2}, {8, 3}, {9, 
                    2}}]}}];
banaketa = 
        ListPlot[{{8, 0}, {8, 1}, {7, 1}, {7, 0}, {8, 0}, {7, 
              1}, 
{7, 2}, {6, 2}, {6, 1}, {7, 1}, {7, 
              2}, {6, 1}}, 
          PlotJoined -> True, 
PlotStyle -> 
            Thickness[0.004], 
          DisplayFunction -> 
            Identity];
zatiak = 
        Graphics[{{RGBColor[1, 0, 1], 
              Polygon[{{8, 1}, {9, 2}, {8, 
                    2}}]}, 
{RGBColor[1, 0, 1], 
              Polygon[{{7, 2}, {8, 2}, {8, 
                    3}}]}, 
{RGBColor[1, 1, 0], 
              Polygon[{{7, 2}, {8, 2}, {8, 1}}]}, {RGBColor[1, 1, 0], 
              Polygon[{{9, 2}, {8, 2}, {8, 
                    3}}]}}];
zatibatura = 
        ListPlot[{{7, 2}, {9, 2}, {8, 3}, {8, 1}, {9, 2}, {8, 
              3}, 
{7, 2}, {8, 1}}, 
          PlotJoined -> True, 
PlotStyle -> 
            Thickness[0.004], 
          DisplayFunction -> Identity];
kokapen=Graphics[{Text["1",{6.3, 1.55},{0, -1},{1, 0}],
Text["2",{6.7, 1.2},{0, -1},{1, 0}],
Text["3",{7.7, 0.5},{0, -1},{1, 0}],
Text["4",{7.3, 0.2},{0, -1},{1, 0}],
Text["1",{8.3, 1.55},{0, -1},{1, 0}],
Text["2",{7.7, 2.2},{0, -1},{1, 0}],
Text["3",{7.7, 1.55},{0, -1},{1, 0}],
Text["4",{8.3, 2.2},{0, -1},{1, 0}]}];

Show[{karratukoloredunak, luzerak, triangelua, 
            gezia, 
karratukoloredunak2, banaketa, zatiak, 
            zatibatura, kokapen},
AspectRatio -> 0.335,PlotRange -> All,
PlotLabel->"Pytagoras-en Teoremaren frogapen geometrikoa"];

Adibidea: Funtzioaren grafikaren azterketa

f[x_] = x^3 - 4. *x^2 - 2. *x + 1. ;
df[x_] = D[f[x], x];
ddf[x_] = D[f[x], {x, 2}];

Plot[{f[x], df[x], ddf[x]}, {x, -4, 5}, 
        PlotStyle -> {RGBColor[0, 0, 0], RGBColor[0, 0.8, 0.5], 
            RGBColor[1, 0, 0.4]}];

?Re

Solve[f[x] == 0, x]

{f[-1], f[0], f[1], f[5]}

Solve[df[x] == 0, x]

{df[-1], df[0], df[3]}

{f[-0.23], f[2.89]}

Solve[ddf[x] == 0, x]

{ddf[-1], ddf[2]}

Adibidea: 2 ezezgun eta bi ekuazioen sistemak

ek1 = 3*x - 4*y == 2;
ek2 = -5*x + 2*y == -5;

sol = {Solve[ek2 /. Solve[ek1, y], 
              x][[1]][[1]], Solve[ek2 /. Solve[ek1, x], 
              y][[1]][[1]]}

kx = x /. sol; ky = y /. sol; f1[x_] = y /. Solve[ek1, y]; 
    f2[x_] = y /. Solve[ek2, y];

Show[{Plot[{f1[x], f2[x]}, {x, kx - 1, kx + 1}, 
            PlotStyle -> {Hue[ .6], 
                Hue[ .9]}, 
PlotRange -> {{kx - 1, 
                  kx + 1}, {ky - 1, ky + 1}}, 
            DisplayFunction -> 
              Identity], 
Graphics[{Disk[{kx, ky}, {0.025, 
                  0.025}], 
Text[{kx, ky}, {kx + 0.3, 
                  ky - 0.1}, {0, -1}, {1, 
                  0}]}]}, 
DisplayFunction -> $DisplayFunction, AspectRatio -> 1];