zenterix

310 Reputation

4 Badges

3 years, 97 days

MaplePrimes Activity


These are questions asked by zenterix

I think my question can be answered without necessrily providing any code. 

I have a procedure that takes in many arguments and performs heavy calculations (solves multiple sets of differential equations in parallel using Grid:-Map and then does matrix manipulations with results, etc).

It runs fine in a Maple worksheet. 

Until about half an hour ago, I hadn't used the Maple CLI. I would like to run my procedure from the CLI. I did exactly the steps as I do them in a worksheet.

with(MyPackage):

myProcedure(argsList);

But Maple just echoes the second command back to me. myProcedure is in myPackage. There is a much simpler procedure in that package called myProcedure2 and I can call that just fine from the CLI.

What could be happening?

I would like to write some code to test certain functions in a codebase that has gotten relatively large but has no tests. I recently found a bug caused by copying a line and pasting it five times (was supposed to change a parameter on each line but forgot to). Didn't notice the bug until I refactored that procedure to make the code parallelizable for use with the Grid package.

Hence, I am worried about such unknown calculation mistakes in algorithms that involve a sequence of intermediate steps/calculations.

I found there is an assert command

I would write procedures that would call the procedures to be tested with certain arguments and assert the output.

Are there any other tools available or best practices perhaps from experience?

If we use, for example, pointplot3d with an mx3 matrix we get a 3d plot. I can click on the plot and choose the lighting. But how do we do that with code?

I just tried to solve a very simple system of equations using solve but depending on how I write the system the command does out give any output. 

restart

solve({I__cm = m*r^2, r*T = I__cm*a/r, g*m-T = m*a}, {T, a})

solve({r*T = m*r^2*a*(1/r), g*m-T = m*a}, {T, a})

{T = (1/2)*m*g, a = (1/2)*g}

(1)

NULL

Solution with pencil and paper

T := (1/2)*m*g = (1/2)*m*gNULL

a := (1/2)*g = (1/2)*gNULL

Check this solution

evalb(g*m-T = m*a)

true

(2)

evalb(r*T = m*r^2*a*(1/r))

true

(3)

NULL


Notice that if I define I__cm then there is no solution being shown. I can rename I__cm to something else like y, still no output. Then in the second system I simply sub I__cm into the equation that has this variable, and it works.

So what's going on here? Why doesn't the first use of solve work?

Download solveSys.mw

When taking notes I sometimes use the palette to insert a matrix into a worksheet. When I do this, the main aspect that is useful to me is being able to visualize matrix expressions as I would write them.

I would like to do the same but for determinants of matrices. Is there a way to get almost the same thing as with the matrix palette, but with vertical bars denoting a determinant rather than the brackets used for matrices?

2 3 4 5 6 7 8 Last Page 4 of 15