# Plotting Dirac Delta Function in Maple14: Troubleshooting

• misterpickle
In summary, the conversation is about attempting to plot a vector field using Maple14. The function being plotted is v=r^(-2)*r-hat, and the individual attempting the task has provided their code and the error they are receiving. However, the expert summarizes that the vector field being plotted is actually different from the function provided and suggests that the error may be due to a syntax error or the function being poorly behaved. Additionally, the expert mentions that it may be more beneficial to plot the vector field by hand using polar coordinates.
misterpickle

## Homework Statement

I want to plot the following function into Maple14. $$\vec{v}=frac{1}{\vec{r^{2}}} \hat{r}$$

**In case the latex is screwed this says v=r^(-2) *r-hat

## The Attempt at a Solution

My code for Maple is the following, but it doesn't seem to work.restart; with(LinearAlgebra); with(VectorCalculus); with(plots);

SetCoordinates('cartesian'[x, y, z]);

vec := Vectorfield(<1/x^2, 1/y^2, 1/z^2>)

fieldplot3d(vec, x = -1 .. 1, y = -1 .. 1, z = -1 .. 1, axes = normal)

For which I get the following error (Maple website has no information on this error);Error, (in plots/fieldplot3d) invalid 1st argument (the function) Vectorfield(Vector(2, {(1) = 1/x^2, (2) = 1/y^2}, attributes = [coords = cartesian[x, y]]))

Basically I need someone to explain why Maple will not plot this vectorfield.

The vector field you're trying to plot is

$$\frac{ \hat{r}}{|\vec{r}|^2}=\frac{\vec{r}}{|\vec{r}|^3} = \frac{1}{(x^2+y^2+z^2)^{3/2}} \langle x,y,z\rangle \neq \langle 1/x^2, 1/y^2, 1/z^2 \rangle .$$

That said, I'm not sure that is the source of your Maple error. It looks like a syntax error, but is also might be that the function you're plotting is very poorly behaved (blows up on all of the axes).

Also, you don't really need Maple for this, and it's probably a bit more instructive to do it by hand anyway. Just think in terms of polar coordinates.

## 1. How do I plot the Dirac delta function in Maple14?

To plot the Dirac delta function in Maple14, you can use the Dirac command. For example, to plot Dirac(x), you would use the command plot(Dirac(x), x=-5..5). This will create a graph with a vertical line at x=0.

## 2. Why am I not seeing a graph when I plot the Dirac delta function?

The Dirac delta function is a special function that is not defined for all values of x. Therefore, when plotting, you need to specify a range for x that includes x=0. For example, using plot(Dirac(x), x=-5..5) will create a graph, but using plot(Dirac(x), x=0) will not.

## 3. How can I change the appearance of the Dirac delta function graph?

You can change the appearance of the Dirac delta function graph by using the style option in the plot command. For example, to change the color of the graph to red, you would use plot(Dirac(x), x=-5..5, style=point, color=red).

## 4. Can I plot multiple Dirac delta functions on the same graph?

Yes, you can plot multiple Dirac delta functions on the same graph by using the plot command multiple times. For example, plot(Dirac(x), x=-5..5, color=red); plot(Dirac(x-2), x=-5..5, color=blue) will plot the functions Dirac(x) and Dirac(x-2) on the same graph, with different colors.

## 5. How do I troubleshoot if my graph is not displaying correctly?

If your graph is not displaying correctly, make sure that you have specified a range for x that includes x=0. Also, check the syntax of your plot command to make sure it is correct. If you are still having issues, try restarting Maple14 or updating to the latest version.

### Similar threads

• Advanced Physics Homework Help
Replies
4
Views
762
• Advanced Physics Homework Help
Replies
5
Views
3K
• Advanced Physics Homework Help
Replies
1
Views
847
• Advanced Physics Homework Help
Replies
5
Views
1K
• Advanced Physics Homework Help
Replies
3
Views
2K
• Advanced Physics Homework Help
Replies
0
Views
688
• Advanced Physics Homework Help
Replies
3
Views
1K
• Advanced Physics Homework Help
Replies
4
Views
804
• General Math
Replies
11
Views
262
• Advanced Physics Homework Help
Replies
3
Views
2K