nmacsai

260 Reputation

9 Badges

4 years, 64 days

MaplePrimes Activity


These are questions asked by nmacsai

Can I export a Table as an image like .png, where Table is defined (with DocumentTools)? See Maple worksheet for example.

Why would anyone want to do this? It all started because I wanted to include a color bar(with a specific color range) in my 3dplot. There is no native way to do this with plot3d so I searched Maple Primes for alternative strategies. One strategy is to generate the 3d plot and the color bar(with plot3d) seperately, then combine the plots in a table so they sit side by side, using with(DocumentTools). I have been almost successful with this strategy. There remain two outstanding problems. 1. I can't re-size the table cells since there are no such options with(DocumentTools). The color bar should have a smaller cell because the figure itself is tall and thin. 2. I need to export this combined object as an image(.png) but its a table with plot objects inside, and not itself a plot object and therefore one can't simply export it as a .png like one would a typical plot object. Is there a way to export this table as a png? I am beginning to think that my idea of combining  plots with document tools and attempting the export the resulting table is not feasible. How does a normal person add a custom-color-range color bar to their plot? I'm not trying to move the earth here but it certainly feels like it.

with_document_tools_how_to_i_resize_the_cells_and_export_the_table_as_png.mw

How do I programmatically control the zoom of a 3d plot ?
SEE THE ATTACHED MAPLESHEET. In the attached code, the 'zoom out' on the blue cylinder is not conserved when I saved the maplesheet but it doesn't change the essential question which is how does one control the zoom programmatically. If you yourself adjust the zoom of the blue cylinder and the run tabulate(), you will see how it resets the plots settings to some default set of values.
How_do_I_programmatically_control_the_zoom_in_a_3d_plot.mw

restart

with(plots)

with(plottools)

with(DocumentTools)

``

Plot two cylinders with plottools and plot3d. Zoom out on the blue cylinder a little.

c1 := display(cylinder([1, 1, 1], 1, 3), orientation = [45, 70], scaling = constrained, color = red, size = [300, 300])

 

c2 := display(cylinder([1, 1, 1], 1, 3), orientation = [45, 70], scaling = constrained, color = blue, size = [300, 300])

 

Use tablate to embed the 3d plots in a visual array, for reasons not discussed here.

NULL

DocumentTools:-Tabulate([c1, c2], exterior = none, interior = none)

"Tabulate4"

(1)

Notice how the use of tabulate( ), changes the zoom of the individual plots to some default. There are two questions: 1. How do I programmatically control the zoom of a 3d plot with display( )? I don't want to have to click buttons with the mouse to arrive at my ideal zoom level. 2. How do I programmatically control the zoom of a 3d plot when using Tabulate( ) which envokes the default plot settings?  

Below is a screenshot of the zoom buttons I want to control programmatically.
NULL

NULL


Download How_do_I_programmatically_control_the_zoom_in_a_3d_plot.mw
1. Plot two cylinders with plottools and plot3d. Zoom out on the blue cylinder a little.
2. Use tablate to embed the 3d plots in a visual array, for reasons not discussed here.

3. Notice how the use of tabulate( ), changes the zoom of the individual plots to some default. There are two questions: 1. How do I programmatically control the zoom of a 3d plot with display( )? I don't want to have to click buttons with the mouse to arrive at my ideal zoom level. 2. How do I programmatically control the zoom of a 3d plot when using Tabulate( ) which envokes the default plot settings

Below is a screenshot of the zoom buttons I want to control programmatically.

Using with(plots) and with(plottools), how do you change the color of the line enclosing a disk? I can change the line style of the line, but I can't figure out how to change the color of the line. I didn't find anything in plot options that would fit my purpose.

how_do_i_change_the_color_of_the_line_around_a_disk_while_using_plottools.mw

Can one evaluate dirac spinor products using the Standard Model package? How far can I take the evaluation in the package? See maplesheet with commentary.

Evaluating_spinor_products_with_the_standard_model_package.mw

out_parameter_for_Sample(_)_and_rtables.mw
When I generate sample data using a random variable, a normal distribution and the Sample command, I want to see the sample and the values used to randomly evaluate the distribution which generates said sample. The Maple help sheets say you can so this with the out parameter in the Sample command. I try several different calls and hoped the rtable is filled on execution. As seen below, the execution fails. Am a specifying the rtable incorrectly? See attached Maple sheet.

restart

NULL

NULL

with(Statistics)

with(LinearAlgebra)

NULL

When I generate sample data using a random variable, a normal distribution and the Sample commands, I want to see the sample and the values used to randomly evaluate the distribution. The Maple help sheets say you can so this with the out parameter in the Sample command.

NULL

NULL

NULL

From the help, we are required to specify a float rtable, that will be filled when the Sample command is succesfully executed.

NULL

Define a random variable.

X := RandomVariable(Normal(0, 1))

_R

(1)

Sample that random variable. We sample it 10 times and look at the output.

A := Sample(X, 10)

Vector[row](%id = 36893491057099280004)

(2)

The float rtable is defined with the sample number of elements as will be sampled.

tab1 := rtable(1 .. 10, datatype = float)

Array(%id = 36893491057099270012)

(3)

NULL

tab2 := convert(rtable(1 .. 10, datatype = float), list)

[HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0)]

(4)

Now I try several different calls and hope the rtable is filled on execution.

A := Sample(X, 10, out)

Error, invalid input: no implementation of Statistics:-Sample:-ModuleApply matches the arguments in call, 'Statistics:-Sample:-ModuleApply(X,10,out)'

 

A := Sample(X, 10, out = tab1)

Error, invalid input: no implementation of Statistics:-Sample:-ModuleApply matches the arguments in call, 'Statistics:-Sample:-ModuleApply(X,10,out = tab1)'

 

A := Sample(X, 10, out = tab2)

Error, invalid input: no implementation of Statistics:-Sample:-ModuleApply matches the arguments in call, 'Statistics:-Sample:-ModuleApply(X,10,out = tab2)'

 

A := Sample(X, 10, out = true)

Error, invalid input: no implementation of Statistics:-Sample:-ModuleApply matches the arguments in call, 'Statistics:-Sample:-ModuleApply(X,10,out = true)'

 

NULL

As seen above, the execution fails. Am a specifying the rtable incorrectly?

NULL

NULL

NULL


 

Download out_parameter_for_Sample(_)_and_rtables.mw

 

2 3 4 5 6 7 8 Page 4 of 8