Konikak

"c:\Archivos de programa\Wolfram Research\Mathematica\4.2\AddOns\StandardPackages\Garatu" 
karpetan "Konikak.m" paketea gorde eta kargatu, ala beheko moduluak exekutatu eta elipsea ala
hiperbolari dagokion funtzioa burutu emandako parametroekin.

<< Garatu`Konikak`

Adibidea:Elipsea

\(Elipsea[ardluze_, ardzabal_, koordx_] := 
      Module[{prop, koordy, fok, l1, l2, pt}, 
If[
          ardluze < 
            ardzabal, 
Print["Lehenengo ardatza bigarrena baino luzagoa izan behar du."], 
If[
            Abs[koordx] > 
              Abs[ardluze], 
Print["Aukeratutako x-ren koordenatua jatorritik urrutiegi dago."], 
koordy = 
              ardzabal*Sqrt[1 - \((koordx/ardluze)\)^2]; 
            pt = {koordx, 
                koordy}; 
fok = {Sqrt[
                  ardluze^2 - ardzabal^2], 0}; 
l1 = 
              Abs[\((pt - fok)\) . {1, I}]; 
            l2 = Abs[\((pt + fok)\) . {1, I}]; 
            prop = ardzabal/
                ardluze; 
Show[{Graphics[{Thickness[0.008], 
                    Circle[{0, 0}, {ardluze, 
                        ardzabal}]}], 
Graphics[{Disk[
                      pt, {0.1, 0.1}], Disk[fok, {0.1, 0.1}], 
                    Disk[\(-fok\), {0.1, 0.1}], 
{Thickness[
                        0.008], Line[{pt, fok}], 
                      Line[{pt, \(-fok\)}]}}], 
Graphics[{Text[
                      StyleForm[N[pt], FontSize -> 12, 
                        FontWeight -> "Bold"], 
pt + {0, 0.2}, {0, \(-1\)}, {1, 0}], 
Text[
                      StyleForm[{N[fok[\([1]\)]], 0}, FontSize -> 12, 
                        FontWeight -> "Bold"], 
{fok[\([1]\)], \(-0.5\)}, {0, \(-1\)}, {1, 
                        0}], 
Text[
                      StyleForm[{N[\(-fok[\([1]\)]\)], 0}, 
                        FontSize -> 12, 
                        FontWeight -> "Bold"], 
{\(-fok[\([1]\)]\), \(-0.5\)}, {0, \(-1\)}, {1, 
                        0}], 
Text[
                      StyleForm[N[l1], FontSize -> 12, 
                        FontWeight -> "Bold"], 
\((pt + fok)\)/2, {0, \(-1\)}, {1, 
                        0}], 
Text[
                      StyleForm[N[l2], FontSize -> 12, 
                        FontWeight -> "Bold"], 
\((pt - fok)\)/2, {0, \(-1\)}, {1, 
                        0}]}]}, 
PlotRange -> All, 
              Axes -> True, 
              AspectRatio -> 
                ardzabal/
                  ardluze]]]; 
Print["Fokoetatik punturako distantzien batura = ", 
N[l1], " + ", 
          N[l2], " = ", N[l1 + l2]]]\)

Elipsea[4, 3, 1.5]

Adibidea:Hiperbola

\(Hiperbola[foko_, ard_, koordx_] := 
      Module[{prop, koordy, fok, l1, l2, pt, mald, x}, 
If[
          foko < ard, 
Print["Fokoa jatorritik ardatza baino urrutiago egon behar du."], 
If[
            Abs[koordx] < 
              Abs[ard], 
Print["Aukeratutako x-ren koordenatua jatorritik hurbilegi dago, ", 
ard, " baino hadiagoa izan behar du."], 
mald = 
              Sqrt[\((foko/ard)\)^2 - 1]; 
            koordy = 
              mald*Sqrt[koordx^2 - ard^2]; 
pt = {koordx, 
                koordy}; 
            fok = {foko, 0}; 
l1 = 
              Abs[\((pt + fok)\) . {1, I}]; 
            l2 = Abs[\((pt - fok)\) . {1, 
                    I}]; 
Show[{Plot[{mald*
                      Sqrt[x^2 - ard^2], \(-mald\)*Sqrt[x^2 - ard^2]}, {x, 
                    ard, 2*foko}, 
DisplayFunction -> 
                    Identity, 
                  PlotStyle -> {Thickness[
                        0.008]}], 
Plot[{mald*
                      Sqrt[x^2 - ard^2], \(-mald\)*
                      Sqrt[x^2 - ard^2], 
mald*
                      Sqrt[x^2 - ard^2], \(-mald\)*
                      Sqrt[x^2 - ard^2]}, {x, \(-2\)*
                      foko, \(-ard\)}, 
DisplayFunction -> Identity, 
                  PlotStyle -> {Thickness[
                        0.008]}], 
Graphics[{Disk[
                      pt, {0.2, 0.2}], Disk[fok, {0.2, 0.2}], 
                    Disk[\(-fok\), {0.2, 0.2}], 
{Thickness[
                        0.008], Line[{pt, fok}], 
                      Line[{pt, \(-fok\)}]}}], 
Graphics[{Text[
                      StyleForm[N[pt], FontSize -> 12, 
                        FontWeight -> "Bold"], 
pt + {0.4, 0}, {0, \(-1\)}, {1, 0}], 
Text[
                      StyleForm[{N[fok[\([1]\)]], 0}, FontSize -> 12, 
                        FontWeight -> "Bold"], 
{fok[\([1]\)], \(-0.5\)}, {0, \(-1\)}, {1, 
                        0}], 
Text[
                      StyleForm[{N[\(-fok[\([1]\)]\)], 0}, 
                        FontSize -> 12, 
                        FontWeight -> "Bold"], 
{\(-fok[\([1]\)]\), \(-0.5\)}, {0, \(-1\)}, {1, 
                        0}], 
Text[
                      StyleForm[N[l1], FontSize -> 12, 
                        
                        FontWeight -> "Bold"], 
\((pt - fok)\)/2, {0, \(-1\)}, {1, 
                        0}], 
Text[
                      StyleForm[N[l2], FontSize -> 12, 
                        FontWeight -> "Bold"], 
\((pt + fok)\)/2, {0, \(-1\)}, {1, 
                        0}]}]}, 
PlotRange -> All, 
              Axes -> True, AspectRatio -> 1, 
              DisplayFunction -> $DisplayFunction]]]; 
Print["Fokoetatik punturako distantzien kendura = ", 
N[l1], " - ", N[l2], " = ", 
          N[l1 - l2]]]\)

Hiperbola[4, 3, 5]