beesel function i want to plot acoustic wave in terms of pressure vs x - acoustics

C1*Bessel J(0, (500/166203941)*sqrt(-Pi)*sqrt(-1828243351+332407882*x))+C2*Bessel Y(0, (500/166203941)*sqrt(-Pi)*sqrt(-1828243351+332407882*x))
upper one is my solution through maple
i want to plot it please help i hv to submit my assignment.

See this page for basics on plotting with Maple http://www.math.sunysb.edu/~scott/Book331/Plotting_with_Maple.html
First and second kind Bessel functions you need are available as built-ins in Maple: http://www.maplesoft.com/support/help/Maple/view.aspx?path=Bessel
You need to specify the plot range for x, by the way.

Related

R, how can I plot two functions in one 3d plot? (I show an example)

Do someone know how to plot two functions in one 3d plot using R as in the left-figure or right-figure shown below? (article reference at the end).
3d plot
For example, in 2d plot you have the argument "add" for the function curve(...)
For what I have searched, the functions I have found (like persp(...)) doesn't have an "add" option.
Thanks!
Reference:
Juan M. Astorga, Yuri A. Iriarte, Héctor W. Gómez & Heleno Bolfarine (2019):
Modified slashed generalized exponential distribution, Communications in Statistics - Theory and
Methods, DOI: 10.1080/03610926.2019.1604959
I already found a function which works perfect for what I need. If anyone are
interested, persp3D(...)
https://www.rdocumentation.org/packages/plot3D/versions/1.3/topics/3-D%20perspectives

julia vector differential equation: plot only the first n components of the vector

I am integrating a vector differential equation in Julia (the number of components is of the order of magnitude of 50). When I plot this solution, obviously this plot will be very crowded if I plot all the components, so I want to plot only let's say the first 10 components. I can't find how to do this. Also, instead of plotting the output for each component, I would like to plot not the output of the integration at each time step, but the hyperbolic tangent of this. I also don't find how to do this manipulation. I think the key problem is that I don't understand/find what kind of object the solution of a differential equation is in julia.
Here is a minimal working example that integrates the differential equation and plots the whole solution.
using DifferentialEquations
using Plots
using LinearAlgebra
N=50
J=0.18*randn(Float64,N,N)
g=1
function hDerivative(timederiv,h,p,t)
for i=1:length(h)
timederiv[i] = -h[i]
for j=1:length(h)
timederiv[i]=+timederiv[i]+J[i,j]*tanh(g*h[j])
end
end
end
function pltTimeVolution()
hinit=rand(Float64,N)
tspan=(0.0,50)
prob = ODEProblem(hDerivative,hinit,tspan)
sol=solve(prob)
plot(sol)
print(sol)
end
pltTimeVolution()
For help, take a look at the solution handling page: http://diffeq.sciml.ai/latest/basics/solution.html . The solution is both an abstract array and a continuous function. So you can for example get a continuous solution at 10000 evenly spaced time points like t=range(tspan[1],stop=tspan[2],length=10000), do A = sol(t) and that will give a 50x10000 timeseries of each solution at evenly spaced time points, and then sol[i,:] would be the timeseries of the ith variable at the time points t. You can use that to build the arrays you want an plot them. Full code like this:
t=range(tspan[1],stop=tspan[2],length=10000)
A = sol(t)
ts10 = sol[10,:]
Another way to do this is to solve with something like saveat=t, in which case the solution is an array which saves at those time points. This looks like:
t=range(tspan[1],stop=tspan[2],length=10000)
sol=solve(prob,saveat=t)
ts10 = sol[10,:]
Or you can make use of the plot recipe which does this kind of handling internally. Take a look at http://diffeq.sciml.ai/latest/basics/plot.html#Choosing-Variables-1 . You can do things like plot the first variable and then lay over the plot of the 10th variable like:
plot(sol,vars=(0,1))
plot!(sol,vars=(0,10))
The ! means its the mutating plot function, i.e. modify the previous plot by adding a new series. Then as noted in the documentation there are shortcuts, like
plot(sol,vars = [1, 3, 4])
will plot the 1st, 3rd, and 4th variables as functions of time. In this form, you can also specify what kind of transformation you want as a function. That's mentioned in the same place in the documentation. For example, the two-dimensional plot of time vs tanh would be the transformation function f=(t,y)->(t,tanh(y)), i.e. how you take in the 2D variable and spit out the 2D variable to plot is just pass through the first and tanh the second. Then using this, you'd use the plot command:
f=(t,y)->(t,tanh(y))
plot(sol,vars = (f,0,5))
to plot the tanh of the 5th variable against time.
These are a few different ways to manipulate the solution argument and generate the plots you need. Pick the one that works best for you.

Value for mixture distributions crossing using 'mixdist' in R

I have a plot (below) generated using the package "mixdist" and would like to know the exact value at which the two distributions cross one another rather than just estimating from the plot. I haven't come across this in any of the output information. Can this be obtained through mixdist?
Thanks for any help
use locator() function to click on the point in the graph, followed by 'esc' key to give the values

How to reproduce this graphical explanation (a scatter plot) of how covariance works?

I found this graphical intuitive explanation of covariance:
32 binormal points drawn from distributions with the given covariances, ordered from most negative (bluest) to most positive (reddest)
The whole material can be found at:
https://stats.stackexchange.com/questions/18058/how-would-you-explain-covariance-to-someone-who-understands-only-the-mean
I would like to recreate this sort of graphical illustration in R, but I'm not sufficiently familiar with R's plotting tools. I don't even know where to start in order to get those colored rectangles between each pair of data points, let alone make them semi-transparent.
I think this could make a very efficient teaching tool.
The cor.rect.plot function in the TeachingDemos package makes plots similar to what is shown. You can modify the code for the function to make the plot even more similar if you desire.

R: update plot [xy]lims with new points() or lines() additions?

Background:
I'm running a Monte Carlo simulation to show that a particular process (a cumulative mean) does not converge over time, and often diverges wildly in simulation (the expectation of the random variable = infinity). I want to plot about 10 of these simulations on a line chart, where the x axis has the iteration number, and the y axis has the cumulative mean up to that point.
Here's my problem:
I'll run the first simulation (each sim. having 10,000 iterations), and build the main plot based on its current range. But often one of the simulations will have a range a few orders of magnitude large than the first one, so the plot flies outside of the original range. So, is there any way to dynamically update the ylim or xlim of a plot upon adding a new set of points or lines?
I can think of two workarounds for this: 1. store each simulation, then pick the one with the largest range, and build the base graph off of that (not elegant, and I'd have to store a lot of data in memory, but would probably be laptop-friendly [[EDIT: as Marek points out, this is not a memory-intense example, but if you know of a nice solution that'd support far more iterations such that it becomes an issue (think high dimensional walks that require much, much larger MC samples for convergence) then jump right in]]) 2. find a seed that appears to build a nice looking version of it, and set the ylim manually, which would make the demonstration reproducible.
Naturally I'm holding out for something more elegant than my workarounds. Hoping this isn't too pedestrian a problem, since I imagine it's not uncommon with simulations in R. Any ideas?
I'm not sure if this is possible using base graphics, if someone has a solution I'd love to see it. However graphics systems based on grid (lattice and ggplot2) allow the graphics object to be saved and updated. It's insanely easy in ggplot2.
require(ggplot2)
make some data and get the range:
foo <- as.data.frame(cbind(data=rnorm(100), numb=seq_len(100)))
make an initial ggplot object and plot it:
p <- ggplot(as.data.frame(foo), aes(numb, data)) + layer(geom='line')
p
make some more data and add it to the plot
foo <- as.data.frame(cbind(data=rnorm(200), numb=seq_len(200)))
p <- p + geom_line(aes(numb, data, colour="red"), data=as.data.frame(foo))
plot the new object
p
I think (1) is the best option. I actually don't think this isn't elegant. I think it would be more computationally intensive to redraw every time you hit a point greater than xlim or ylim.
Also, I saw in Peter Hoff's book about Bayesian statistics a cool use of ts() instead of lines() for cumulative sums/means. It looks pretty spiffy:

Resources