zenterix

400 Reputation

5 Badges

3 years, 28 days

MaplePrimes Activity


These are questions asked by zenterix

Consider the worksheet below containing a function that I came across while studying Apostol's Calculus. 

At the origin, this function has a defined directional derivative in all directions. It is not, however, continuous at the origin. We can see this by consider all points on the parabola x=y^2 except for the origin. The function takes on the value 1/2 on all such points but has value 0 at the origin and is thus discontinuous there.

My question is about a 3d plot of this function.

The plot seems a bit inaccurate because the ridge at the top extends all the way to the origin. 

If I hadn't done the calculations to know this, this plot would not give me this information. 

Is there a way to avoid this problem? Ie, to get more accuracy at points such as the origin here?

f := (x,y) -> piecewise(x=0, 0, x <> 0, x*y^2/(x^2+y^4))

f := proc (x, y) options operator, arrow; piecewise(x = 0, 0, x <> 0, x*y^2/(x^2+y^4)) end proc

(1)

plot3d(f,-1..1,-1..1)

 

f(y^2,y)

piecewise(y^2 = 0, 0, y^2 <> 0, 1/2)

(2)

 

Download DiscontScalarField3d.mw

I have a workflow in which I edit files from a package I develop. These are usually mpl files, and I edit them in an editor (VS Code).

Then I have a worksheet called readFile.mw open in Maple that has two commands:

restart:

read("path/to/an/entry/file/that/includes/all/the/other/files")

and another worksheet actual.mw which is the actual worksheet I am working on, which starts with restart: with(MyPackage): and then contains calls to procedures from the package.

With this workflow, I make a change in the editor, execute readFile.mw and then go to my actual worksheet and restart and then use with(MyPackage), and the updates are available.

This works.

However, in actual.mw I may have a bunch of data that I don't want to wipe out with a restart. 

On the other hand, if I don't restart, a new call to with(MyPackage) does not update the import of the package (because it has already been imported. 

Is there an idiomatic or preferred way to accomplish reimporting the package without having to call restart?

PS I don't remember now the exact reason why I don't have the call to read the file in actual.mw but it had something to do with this issue of not getting the package updated correctly.

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?

First 6 7 8 9 10 11 12 Last Page 8 of 20