nmacsai

175 Reputation

7 Badges

2 years, 192 days

MaplePrimes Activity


These are questions asked by nmacsai

How do I make a new dataframe based on the criteria that a particular row is included when a particular element in that row is equal to a specific string, say, "Ontario"?

I downloaded the publicly availble covid dataset from the Gov. of Canada website.  I want to look at data pertaining to Ontario only. Each data entry corresponds to a row of data where the second column represents the province or territory.  My goal is to create a new dataframe of rows where the second column entry is equal to the string "Ontario".

I have attached my maplesheet.  I can't upload the data but it can be downloaded here: https://open.canada.ca/data/en/dataset/261c32ab-4cfd-4f81-9dea-7b64065690dc.

In the image below, see how the second column is a mix of different strings.  I want a new dataframe where the second column reads only "Ontario".  I have included my naive attempt to select data with 'prname'="Ontario".

sort_data_and_make_new_df_Covid_Analysis_Sheet_1.mw

restart;
with(Physics);
with(Physics[Vectors]);
with(geom3d);
with(LinearAlgebra);
with(ColorTools);
with(plots);

When I define a vector with Physics[Vectors] as:

a1 := a/2*(0*_i + _j + _k)

Maple returns:

a1:= a/2*(_j + _k)

Which is fine but if you try to take the cross product it won't work because the command expects a vector in R3 but interprets a1 as a vector in R2.

How do I ensure Physics[Vectors] understands a1 is a vector in R3

zero_component_problem.mw

Programatically assigning colors to points in geom3d not working.  I just want all the points drawn by the draw command, to be the same color.  The output does not respond to programatic specification of the object color.

Maple 2021 Help says: "

geom3d: draw command

calling sequence:
draw(obj,...)
draw([obj_1,...,obj_n],...)

A typical call to the draw function is draw([ obj_1(localopts_1),...,obj_n(localopts_n) ], globalopts) where obj_1, ..., obj_n are geometric objects, localopts_1, ..., localopts_n are local options for a particular object, and globalopts are  options which apply to all of the objects.

localopts_i is a sequence of type equation. The set of options allowed for localopts_i is color = red."

I tried: color = "Red", color = "red", color = Red, color=red.  The command goes through but the colors remain distinct per point.  You can use the context menu to change the color after the command goes through but it is inefficient for my purposes. 

Here is an image of it not working:


 

Setup:
I am working with a 'large' data set( ~70MB .csv file).  Using the import command I can import the data into a maple worksheet.  After import the dimension of the imported object 434000 rows by 30 columns.  The first 2 columns contain time stamp strings, the rest are numeric. 

Issue:
Importing this data set takes about 5 minutes everytime the command is called, which is everytime the worksheet is opened or re executed.  This is a lot of redundent processing.

Question:
Is there a way that I can import the data once and have it saved as a variable in the variable manager associated with the worksheet?  I want to avoid using the import command in a reduent manner.

1 2 3 4 Page 4 of 4