tomleslie

6662 Reputation

17 Badges

10 years, 170 days

MaplePrimes Activity


These are answers submitted by tomleslie

See the attached, where I have plotted

  1. f(x,y), at x=xVal, where I set xVal=1
  2. diff( f(x,y),y), at x=xVal, where I set xVal=1
  3. diff( f(x,y),y, y), at x=xVal, where I set xVal=1

You can set xVal to anything sensible with the pde solution space

pdeProb.mw

 

In order to see where you are now, then you need to include representative array 'P'. Also a value for 'N', (unless 'N' is just the range of the first index in 'P').

It is fairly easy to kill the gridlines in the example 'checkerboard' by using the 'style'  option in the polygonplot() command, as in

p := seq
       ( seq
         ( plots[polygonplot]
           ( [[i,j], [i+1,j], [i+1,j+1], [i,j+1] ],
             color=ColorTools:-Color([rand()/10^12,
             rand()/10^12,
             rand()/10^12]),
             style=polygon
           ),
           i=1..10
         ),
         j=1..10
       ):
plots[display]([p]);

 

Having read this question and the previous one where Kitonum supplied the 'Prefix()' procedure, I am still confused about what you are trying to achieve.

Simple example: the Prefix() procedure returns a single expression. It therefore makes absolutely no sense to apply any kind of 'zip()' comannd directly to the output of Prefix(), since the 'zip()' command requires two lists of 'data', as well as the function combining them.

So making a wild guess about converting between 'active' and 'inert' forms of expressions, I can come up with three possibilities, which are illustrated in the three execution groups of the attached worksheet.. If the information containeded does not cover your requirement then you are going to have to explain very clearly, precisely what you do want

inert.mw

there are several ways, but probably the simplest is with the code

restart;
t1:=time():
fr:=rand(0..499999):
M:=seq(fr(), i=1..500000):
t2:=time()-t1;

Don't feel inclined to do the same thing with your other tests - too much typing. In future consider uploading code rather then pictures

 

I'm not exactly sure what your problem is. Uploading pictures rather than code is never a good idea, because it gives responders too much typing to do. Also not a great idea to post partial code.

The following seems to work, and I think it is what you are trying to achieve

  restart;
  with(Statistics):
#
# Generate 1000 samples of a Uniform distribution
# with range -Pi..Pi
#
  NN:=Sample(Distribution(Uniform(-Pi, Pi)),1000):
#
# Compute OP's function (is this an 'arcsine
# distribution'?)
#
  NE:=[seq(1/2-1/2*cos(Pi*NN[i]), i=1..1000)]:
#
# Plot the histogram of NE with 20 bins
#
  Histogram(NE, bincount=20);

 

The code

restart;
checkInSet := proc(L, x)
                                local i:
                                if   nops(L) = 0
                                then return 0;
                                else for i from 1 to nops(L) do
                                             if   x = L[i]
                                             then return i
                                             fi;
                                       end;
                                end;
                      end proc:
M := { (a-2*b-2*c)^2*(2*a-b+2*c)^2,
          (a-2*b-c)^2*(a-b+2*c)^2,
          (a-2*b+c)^2*(a+b-2*c)^2,
          (a-2*b+2*c)^2*(2*a+b-2*c)^2,
          (a-b-2*c)^2*(2*a-b+c)^2,
          (a-b-c)^2*(a-b+c)^2,
          (a-b+c)^2*(a+b-c)^2,
          (a-b+2*c)^2*(2*a+b-c)^2,
          (a+b-2*c)^2*(2*a-b-c)^2
       }:
checkInSet(M, (a-2*b-2*c)^2*(2*a-b+2*c)^2);

returns 1 - which is what I would expect. What did it return for you? And what did you expect.?

which seems to affect only those with Nvidia graphics cards, and who updated their graphics drivers "recently".

Ignore the title and read the thread at

http://www.mapleprimes.com/questions/221001-How-Do-I-Remove-All-Files-Associated#comment236117

Basically the latest official set of Nvidia drivers doesn't seem to work with Maple!!

So if you have an Nvidia graphics card, and you downloaded a new set of drivers in the past month or so (either because you have set the Nvidia driver update to work automatically, or you manually downloaded a new set), then Maple 2016/Maple2015 will no longer work

If this does apply to you, then I recpmmend getting the 'patch' driver set referenced in the second from last entry in this thread. This cured the problem for me. Other solutions are posted in this thread (and they work), but I really can't recommend changing your Maple installation/configuration, just to fix a problem with graphics drivers

I revised some of your code for the "forced" system, just to make it a bit shorter/more efficient and easier for me to figure out exactly what was going on. The first plot in the attached is the same as in your post.

By "autonomous" system, I assume you mean the case where the forcing function is zero. The second half of the attached sheet also produces a plot for this case. I had to drastically shorten the timescale, because the system seems to spiral in to u(t)=1, v(t)=0, pretty quickly. I'm not sure if this is what you want because the Wikipedia article

https://en.wikipedia.or/wiki/Duffing_equation

suggests that the equibrium values can be stable or unstable and depend on the system parameters and initial conditions. So I'm guessing many other behaviours can be generated

duffing.mw

  1. Do you want to remove the first row - fairly simple, can be "hardcoded"
  2. Do you want to add a new first row - fairly simple, can be "hardcoded"
  3. Do you want to remove the last row - fairly simple, can be "hardcoded"
  4. Do you want to add a new last row - fairly simple, can be "hardcoded"
  5. Do you want to  remove an arbitrary row? - Well you will have to provide a facility to specify the row number
  6. Do you want to  add a row at an arbitrary point? - Well you will have to provide a facility to specify the row number

The code in the attached contains execution groups which will handle all of the above possibilities - you just have to figure out which you want (and maybe how to apply it)

addRemRow.mw

 

The following give all solutions for 2<=p<=500. Feel free to pick any maximum p-value you want

  restart;
  pMax:=500:
  seq
  ( `if`
     ( numelems(k)>1,
       k,
       NULL
     ),
     k in [ seq
              ( [ p=j,
                  msolve(x^2 = -1, j)
                ],
                j=2..pMax
              )
            ]
   );

Complete code - where I just guessed a value for C_A0 (so change it to anything you want) - would be

restart;
sol1:= dsolve
           (  [ diff(X(W), W) = (0.536000000000000e-3*(1-X(W)))*(1+X(W)),
                X(0) = 0
              ],
              numeric
           ):
C_A0:= 5.0:
C_A:= C_A0*(1-X(W))*(1+X(W)):
plots:-odeplot( sol1,
                         [  [W, X(W), color=red],
                            [W, C_A, color=blue]
                        ],
                        W=0..10000
                     );

 

The only stl file I have access to is the one in Maple's data/example directory. It is relatively simple to extract the polygons from this file, and then (collectively) animate them.

See the attached

animstl.mw

I'm pretty unfamiliar with the Physics package but I manage to get an output from your last execution group, after fixing (what seemed to me) a few syntax-type things. Try

Trace(-LeviCivita[mu, nu, rho, sigma]*Ucn(X).(((1/6)*e*A[nu](X)+M5*KroneckerDelta[nu, 0])*~Matrix(2, 2, [[1, 0], [0, 1]])).Ucn(X).d_[rho](Ucn(X)).Ucn(X).d_[sigma](Ucn(X)));

 

 

Make sure that the directory exists: in youor filename path, you have

"C:/Users/test/Desktop/txtop1.txt"

Is there really a User called 'test' on your system. Even if this directory exists, I'm not convinced about the syntax of youu print statement.

See the attached, where I have added an execution group to perform the function you require. This works on my machine, but you will have to change the path of fname1 to a directory which exists on your machine

pdePrint.mw

whihc produces the result file

txtop1.txt

odeplot() allows you to plot more or less any function of the quantities returned by the dsolve() command. In your case it is relatively simple to isolate an expression for diff(sigma(t),t) from the original ODE, given as 'nde'. Hence one can use odeplot() to plot this expression.

Data can be retrieved from plots using the plottools:-getdata() commands. The resulting matrices can then be exported (in a variety of formats) using the ExportMatrix() command

See the attached

odeProb.mw

First 102 103 104 105 106 107 108 Last Page 104 of 137