I have the code to generate a sine wave in the javascript library- function-plot:
functionPlot({
target: '#domain',
yAxis: {domain: [-1, 1]},
xAxis: {domain: [8, 24]},
data: [{
fn: 'sin(x)'
}]
})
But it doesn't generate a graph when I plot sin(kx-wt) which is what needed for a moving wave.
I think the library only takes in strings as inputs.
Is there any way to bypass this and generate a plot of a function containing variables?
You can declare a string as
and input this function as:
Now, you can declare variables for k,w and t. In your case, you want to animate the t value. I am doing this by using setTimeout
implementation example: https://pbphysics.blogspot.com/2022/09/test-python.html