How do I integrate vanilla Javascript to a wordpress website?

I am new to WordPress but I have been learning to code since February. I am helping a friend add a responsive slider to her WordPress website. I created this slider using HTML, CSS and JS and it works perfectly. However, I am having problems integrating them into WordPress.

The JS code is

const prev = document.querySelector('.prev'); const next = document.querySelector('.next'); const track = document.querySelector('.track'); const carouselWidth = document.querySelector('.carousel-container').offsetWidth; let index = 0; let initialPosition = null; let moving = false; let transform = 0; next.addEventListener('click', ()=>{   index++;   prev.classList.add('show');   track.style.transform = `translateX(-$  {index * carouselWidth}px)`;   if (track.offsetWidth - (index * carouselWidth) < carouselWidth) {     next.classList.add('hide');   } });  prev.addEventListener('click', ()=>{   index--;   next.classList.remove('hide');   if (index === 0) {     prev.classList.remove('show');   }   track.style.transform = `translateX(-$  {0}px)` })    const gestureStart = (e) => {   initialPosition = e.pageX;   moving = true;   const transformMatrix = window.getComputedStyle(track).getPropertyValue('transform');   if (transformMatrix !== 'none') {     transform = parseInt(transformMatrix.split(',')[4].trim());   } }  const gestureMove = (e) => {   if (moving) {     const currentPosition = e.pageX;     const diff = currentPosition - initialPosition;     track.style.transform = `translateX($  {transform + diff}px)`;     } };  const gestureEnd = (e) => {   moving = false; }  if (window.PointerEvent) {   window.addEventListener('pointerdown', gestureStart);    window.addEventListener('pointermove', gestureMove);    window.addEventListener('pointerup', gestureEnd);   } else {   window.addEventListener('touchdown', gestureStart);    window.addEventListener('touchmove', gestureMove);    window.addEventListener('touchup', gestureEnd);        window.addEventListener('mousedown', gestureStart);    window.addEventListener('mousemove', gestureMove);    window.addEventListener('mouseup', gestureEnd);   }  

This is the code I added to the functions.php file. It adds all the CSS styles correctly.

function responsive_header(){         wp_enqueue_style( 'responsive_header_css', get_template_directory_uri() .'/css/responsiveslider.css' , array() );         wp_enqueue_script('responsive_header', get_stylesheet_directory_uri() . '/js/responsiveslider.js', array(), '',  false);          }     add_action('wp_enqueue_scripts', 'responsive_header'); 

What is weird is that if I add a hello world alert to my script it works but nothing else works. Am i doing this wrong or must I use jquery. I dont know jquery but I can learn it to implement this.

How to derive and integrate this interpolation function?

I have a problem with this function that I interpolated with a discrete data, I need to derive and then integrate to have a numerical values.

perfil = Import[data,"Table"]     Extrados = Table[perfil[[x]], {x, 1, 26}]; Intrados = Table[perfil[[x]], {x, 26, 51}]; \[Eta]u = Interpolation[Extrados]; \[Eta]i = Interpolation[Intrados]; \[Eta]c = 1/2 (\[Eta]u[x] + \[Eta]i[x]); d\[Eta]c = D[\[Eta]c, x] 

But I have the following output: https://imgur.com/g8URnVF So I can’t have a numerical values. I need to derive it and then integrate it

Subscript[B, 0] = 2/\[Pi] \!\( \*SubsuperscriptBox[\(\[Integral]\), \(0\), \(\[Pi]\)]\(d\[Eta]c \ \[DifferentialD]\[Theta]\)\) 

But the solution it’s the same. Someone know another solution about this? Why mathematica doesn’t gave me a symbolic function?

it says, N Integrate has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,20}

when I run the code it says,NIntegrate has evaluated to non-numerical values for all sampling points in the
region with boundaries {{0,20}

\[Chi][b_] := (Z/k1)*NIntegrate[Subscript[f, pp1][q]*Subscript[F, pp1][q]*BesselJ[0, q*b]*q, {q, 0, b}] +  (Nn/K1)*NIntegrate[Subscript[f, pn1][q]*Subscript[F, pn1][q]*BesselJ[0, q*b]*q, {q, 0, b}]   data = Table[{b, \[Chi][b]}, {b, 0, 5.1, 0.1}]   

Integrate autocorrect grammar APIs into SER

Hello @sven,

I am wondering if you could add autocorrection API’s (for articles/text) into SER.

With Google increasing their ability to find spun text, it would this would be of great importance and benefit to all SER users. Especially those using spun text. In my own experience, I’ve manually taken some spun articles, used Grammarly on them, and seen some pretty convincing rank improvements. However, this method is manual, when I’m pretty sure the same thing can be accomplished automatically (but sadly, not by Grammarly, they don’t offer an API).

I found this one when searching around, there seems to be an autocorrection script already written, perhaps it could just be added to SER?

Company link:
https://www.grammarbot.io/tutorial-automated-correction

Github link:
https://gist.github.com/oasic/2c53ab7adf3d0d67b24d18a9a0e3bbf0

Then a section in options for “autocorrection APIs” similar to have captchas are done? Over time, with the system being in place, more API’s could be added (and you could also gain affiliate commissions from any sites that offer them – I bet many SEO’s who use SER would sign up with these sites).

There are also other API’s as such perfecttense.com, but I haven’t really been able to figure out how to get an API key from them. Grammarbot as mentioned above seem to have already given us code to use for autocorrection, and would likely be the easiest to integrate.

This would be a massive time saver for all of us, I can’t overstate the magnitude of it and would be happy to make a donation to make this happen.

Let me know what you think.
Thanks!

Question with Integrate and Region

Let’s say I’ve got a 2D region r=Region[Polygon[{{0,0},{1,0},{1,1}}]]. I can do integrals like Integrate[1,{x,y}\[Element]r], or Integrate[y,{x,y}\[Element]r], to calculate areas and area moments.

I’d like to do an integral like Integrate[c^2,{x}\[Element]r], where c is the height (ymax-ymin) of the region at a particular value of x.

Any ideas appreciated.

-David

Solve Improper Integrate using Residue theorem for this integral [migrated]

I am trying to solve this integral

$ \int_{-\infty}^\infty \frac{x\cdot sin(x)}{x^2+4} \cdot dx $

I have applied the residue theorem on a semicircle of radius $ R> 2$ , $ \gamma$ , so I have

$ \int_\gamma \frac{z\cdot sin(z)}{z^2+4} \cdot dz = \int_{-R}^R \frac{x\cdot sin(x)}{x^2+4} \cdot dx+ \int_{C_R} \frac{z\cdot sin(z)}{z^2+4} \cdot dz$

where $ C_R = \{ z : z=R e^{i \theta} , \theta \in (0,\pi)\}$ , but I cannot limit the second integral to eliminate this contribution when $ R \to \infty$ and I don’t know how I could do the integral in another way

[NOOB]How can I shorten the time to integrate this function?

I’m trying to define the function ‘Cumul1’ by integrating other relevant functions. The problem is that, since the relevant functions consist of special functions as well as a bunch of terms, the calculation requires literally eternity of time. This is not optimal for my goal, which is to maximize ‘Cumul1’ by varying the range of integration. I tried to find the solution and got some hint such as using NIntegrate, but most of them are not applicable to my case since my code of integration includes a variables in integral boundaries. So I want to ask… How can I shorten this integration?

fc = 40*10^3 fs = 80*10^3 t1 = 3.9*10^-3 t0 = 6.9*10^-3 nr = Round[0.00204361*fc] n1 = Round[t1*fc] n0 = Round[t0*fc] u0 = 0 u1 = 0.37*10^-9 an = 0.31*10^-12 s = Sqrt[an^(2)*fc*2] Prob0[x_] = 1/2 (1 + Erf[(x - u0)/s]) Prob1[x_] = 1/2 (1 + Erf[(x - u1)/s]) N1[x_] = E^((1 - x)/n1)/(n1 (1 - E^(2 - nr/n1))) N0[x_] = E^((1 - x)/n0)/n0 S[n_, x_] = (n/nr Prob1[x] + (nr - n)/nr Prob0[x])^nr Cumul1[x_] = Integrate[N1[t] (Integrate[N0 [n] S[n, x], {n, 1, nr - t}] + Integrate[N0[n] S[n, x], {n, nr - t, Infinity}]), {t, 1, nr - 1}]