zenterix

310 Reputation

4 Badges

3 years, 97 days

MaplePrimes Activity


These are questions asked by zenterix

Consider the following system of differential equations

sys := diff(y(x), x) = z(x)*f1(i), diff(z(x), x) = y(x)*f2(i)

where f1 and f2 are functions that depend on the current iteration. Ultimately, I'd like to index into an array that has the length of the number of iterations, to obtain a value that will be part of the differential equations. It's an array of random numbers, but I'd rather not have to generate them on the fly while dsolve is working.

I've been investigating the use of Events for this, but the documentation is quite atrocious and outdated (and I only know this because, for example, when I try to use certain arguments to dsolve some error messages show that the arguments have changed name)

I've read the documentation on events, and as far as I can tell after an hour or two, I am doing exactly what is in the documentation but not getting the expected result.

Here is a worksheet illustrating the issue: dsolve_events.mw

Basically there is a very simply system of two differential equations and I would simply like to see an event triggered when the dependent variable is above 2. 

This event has no useful interpretation, it was just my attempt at trying to get something to trigger (I have tried multiple things). As far as I can tell from the docs I am using an event specification of form 

[0, c(t,y(x)) < 0]: discrete event with a conditional trigger

ie, [0,2-x<0]

and when that is triggered I set i(x) to something like i(x)+1 (but even something as simple as assigning it to some constant like 7, given that the initial value i(0)=0, would allow me to check when the event is being triggered), where i(x) is defined as a discrete variable (my ultimate goal is to trigger the event on every iteration and have i be the iteration counter. I want to use this iteration counter in the equations)

I run the dsolve command, assign the result to a variable and then call, for example p(3). I would expect to see the event triggered and i(3) not equal to the initial value i(0). But the value of i(x) doesn't change.

Here is a worksheet with a system of differential equations

Maple_DE_Example.mw

The system is

y'(x)=z(x)*g(x)

z'(x)=y(x)*g(x)

where g(x) is a random number generator seeded by x. That is, for the same x, g gives the same result. 

Using the classical method as an option to dsolve, a solution is plotted. Using rkf45, however, there is pretty much always an error that says

Warning, cannot evaluate the solution further right of ...

Why does it work with classical but not rkf45?

Consider the function f:=x->sin(x)/x.

If we plot it we obtain

If we try to solve the equation f(x)=0 we get no result back from Maple.

Now consider the function g(x):=x->|sin(x)/x|

If we plot g we obtain

The weird thing here is that the graph isn't touching the x-axis. Why not?

There is a document on the Maple website entitled "Writing Packages". It contains the following snippet when talking about libname

Note: Maple automatically adds lib subdirectories of directories in HOMEDIR/maple/toolbox as well as your current directory to the predefined variable libname. Therefore, modifying the .mapleinit or maple.ini file is only necessary if you want to designate a directory as the default location in which the savelib command will save your library files.

Is this snippet accurate?

If we create a directory called test and create a directory inside called lib and in it a repository called myRepo.mla, and in Maple the current working directory is test, will test/lib/myRepo.mla be found by libname?

It doesn't seem to be the case.

First 11 12 13 14 15 Page 13 of 15