Plotting arrays of values in Maple

In summary, to plot a nuclear decay curve in Maple, you can use a repetition statement to create two arrays for the x and y values. If you use an interval other than 1, you will need to create a separate array for the x-values that corresponds to the time intervals. Alternatively, you can use the plot function which only requires one array as its argument.
  • #1
Hullaballoo
1
0
I'm tring to plot a nuclear decay curve in Maple. I need to calculate the activity at regular time intervals which I'm doing by using a repetition statement to create an array something like:

> for time from 1 by interval to 600 do... etc.

It's working the arrays out fine, but when I try to use pointplot(array) for anything other than an interval of 1, it gives me the error: "Error, (in pointplot) incorrect first argument".

If anyone can explain what this means or suggest why a curve will plot for an interval of 1 but no other number, I'd be very grateful! Thanks in advance.
 
Physics news on Phys.org
  • #2


Hello there,

It seems like you are on the right track with your approach to plotting the nuclear decay curve in Maple. The error you are receiving is most likely due to the fact that the pointplot function in Maple requires two arrays as its arguments, one for the x-values and one for the y-values. So when you use an interval other than 1, the array you are passing as the x-values is not the same length as the y-values array, causing the error.

To fix this, you can create a separate array for the x-values that corresponds to the time intervals you are using. For example, if you are using an interval of 10, your x-values array would be [1, 10, 20, 30, ...]. Then you can use this array along with your y-values array in the pointplot function.

Another option would be to use the plot function instead, which only requires one array as its argument and will automatically generate the x-values for you.

I hope this helps and good luck with your nuclear decay curve plot! Let me know if you have any further questions.
 
  • #3


It seems like you are on the right track with using a repetition statement to create an array of values for your nuclear decay curve. The error you are getting when trying to use the pointplot function with an interval other than 1 is likely due to the fact that the pointplot function expects the first argument to be a list of coordinates in the form of [x1,y1], [x2,y2], etc.

In your case, since you are using an interval to create your array, the values in the array are not in the form that the pointplot function expects. To fix this, you can use the seq() function to create a list of coordinates using your array. For example, if your array is called "decay", you can use the following code to create a list of coordinates:

decay_coords := seq([time, decay[time]], time = 1 .. 600, interval);

Then, you can plot your curve using the pointplot function with the decay_coords list as the first argument. This should work for any interval value.

I hope this helps and good luck with your nuclear decay curve!
 

1. How do I plot a single array of values in Maple?

To plot a single array of values in Maple, you can use the plot command followed by the array name. For example, if your array is named x, you would type plot(x). This will generate a basic line plot of the values in your array.

2. How can I customize the appearance of my plot in Maple?

Maple offers many options for customizing the appearance of your plots. You can use commands such as title, labels, and color to add a title, labels, and change the color scheme of your plot. You can also adjust the axis scales and add legends using the axes command.

3. Can I plot multiple arrays on the same graph in Maple?

Yes, you can plot multiple arrays on the same graph in Maple by using the plot command with multiple array names separated by commas. For example, plot(x, y, z) will plot the arrays x, y, and z on the same graph. You can also add a legend to distinguish between the different arrays.

4. How do I change the type of plot in Maple?

To change the type of plot in Maple, you can use the style option in the plot command. This allows you to choose from various plot types such as scatter plots, bar graphs, and histograms. For example, plot(x, style=point) will create a scatter plot of the values in the array x.

5. Can I save my plot as an image file in Maple?

Yes, you can save your plot as an image file in Maple by using the exportplot command. This command allows you to save your plot as a JPEG, PNG, or other common image file formats. You can also specify the size and resolution of the image in the command. For example, exportplot(plot(x), "myplot.jpg", width=600, height=400) will save the plot of the array x as a JPEG file with a width of 600 pixels and a height of 400 pixels.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
Back
Top