Skip to content

Commit

Permalink
doc.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
jtlap committed Dec 13, 2024
1 parent a4a8a6e commit 480430e
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 149 deletions.
25 changes: 25 additions & 0 deletions test/doc/bessel_h.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>

int main()
{
std::cout.precision(16);
using w_t = eve::wide<double, eve::fixed<2>>;
auto z = kyosu::complex(w_t(20.0, 1.5), w_t(0.0, 1.5));
auto v = -(2+1/3.0);
int nb = int(eve::abs(v)+1);
std::cout << "z " << z << std::endl;
std::vector<decltype(z)> js(nb);
kyosu::cyl_bessel_h(v, z, std::span(js));
auto inc = eve::sign(v);
auto v0 = eve::frac(v);
for(int n=0; n < nb; ++n)
{
std::cout << "js[" << n << "] = " << js[n] << std::endl;
std::cout << "j(" << v0 << ", z) = " << kyosu::cyl_bessel_h(v0, z) << std::endl;
std::cout << "bessel_h[cylindrical](v0, z) = " << kyosu::bessel_h(v0, z) << std::endl;
v0 += inc;
}
return 0;
}
25 changes: 25 additions & 0 deletions test/doc/bessel_i.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>

int main()
{
std::cout.precision(16);
using w_t = eve::wide<double, eve::fixed<2>>;
auto z = kyosu::complex(w_t(20.0, 1.5), w_t(0.0, 1.5));
auto v = -(2+1/3.0);
int nb = int(eve::abs(v)+1);
std::cout << "z " << z << std::endl;
std::vector<decltype(z)> js(nb);
kyosu::cyl_bessel_y(v, z, std::span(js));
auto inc = eve::sign(v);
auto v0 = eve::frac(v);
for(int n=0; n < nb; ++n)
{
std::cout << "js[" << n << "] = " << js[n] << std::endl;
std::cout << "j(" << v0 << ", z) = " << kyosu::cyl_bessel_y(v0, z) << std::endl;
std::cout << "bessel_y[cylindrical](v0, z) = " << kyosu::bessel_y(v0, z) << std::endl;
v0 += inc;
}
return 0;
}
25 changes: 25 additions & 0 deletions test/doc/bessel_k.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>

int main()
{
std::cout.precision(16);
using w_t = eve::wide<double, eve::fixed<2>>;
auto z = kyosu::complex(w_t(20.0, 1.5), w_t(0.0, 1.5));
auto v = -(2+1/3.0);
int nb = int(eve::abs(v)+1);
std::cout << "z " << z << std::endl;
std::vector<decltype(z)> js(nb);
kyosu::cyl_bessel_k(v, z, std::span(js));
auto inc = eve::sign(v);
auto v0 = eve::frac(v);
for(int n=0; n < nb; ++n)
{
std::cout << "js[" << n << "] = " << js[n] << std::endl;
std::cout << "j(" << v0 << ", z) = " << kyosu::cyl_bessel_k(v0, z) << std::endl;
std::cout << "bessel_k[cylindrical](v0, z) = " << kyosu::bessel_k(v0, z) << std::endl;
v0 += inc;
}
return 0;
}
25 changes: 25 additions & 0 deletions test/doc/bessel_y.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>

int main()
{
std::cout.precision(16);
using w_t = eve::wide<double, eve::fixed<2>>;
auto z = kyosu::complex(w_t(20.0, 1.5), w_t(0.0, 1.5));
auto v = -(2+1/3.0);
int nb = int(eve::abs(v)+1);
std::cout << "z " << z << std::endl;
std::vector<decltype(z)> js(nb);
kyosu::cyl_bessel_y(v, z, std::span(js));
auto inc = eve::sign(v);
auto v0 = eve::frac(v);
for(int n=0; n < nb; ++n)
{
std::cout << "js[" << n << "] = " << js[n] << std::endl;
std::cout << "j(" << v0 << ", z) = " << kyosu::cyl_bessel_y(v0, z) << std::endl;
std::cout << "bessel_y[cylindrical](v0, z) = " << kyosu::bessel_y(v0, z) << std::endl;
v0 += inc;
}
return 0;
}
Loading

0 comments on commit 480430e

Please sign in to comment.