5057 Reputation

23 Badges

14 years, 60 days



"A map that tried to pin down a sheep trail was just credible,

 but it was an optimistic map that tried to fix a the path made by the wind,

 or a path made across the grass by the shadow of flying birds."

                                                                 - _A Walk through H_, Peter Greenaway


MaplePrimes Activity

These are answers submitted by pagan

Try double-backslash, to denote a literal backslash. Otherwise a single backslash is interpreted as an Escape Character.


Did you forget

uses plots;

in those procedures?

Try changing the (lowercase) active sum to inert (capilatilized) Sum, so that evalf/Sum might work before `sum` tries to do anything symbolic with it.

For my Windows 7 (32bit) Maple 14, that allows the plot to be generated in a matter of seconds. But without the change it consumes much resources of time and memory, presumably because `sum` is trying its own method very hard for each and every 2-d point it wants to plot.

Even if `sum` would eventually fail and get to `evalf/Sum`, it makes more sense to try and get there directly and so save the time and memory spent wasted in `sum`.

p1 := 15+Sum((15.91549430/n+22.28169203*(-1.)^n/n)*
             n = 1 .. infinity):

p2 := 30+Sum((15.91549430/n+22.28169203*(-1.)^n/n)*
             n = 1 .. infinity):

p3 := 45+Sum((15.91549430/n+22.28169203*(-1.)^n/n)*
             n = 1 .. infinity):

plot([p1, p2, p3], t=0..200,u=0..50, legend=[x=5, x=10, x=15]);

It might mean that one of those calls to fsolve(), occuring inside some call to Y(), failed to compute a numeric root.

In such a case, the function call to fsolve() could return unevaluated. And then Y would return that unevaluated fsolve call, rather than a numeric value. And then dsolve/numeric's internal mechanisms could produce an error, since they might require from Y() an actual number instead.

The code as posted seems to run ok in Maple 14. What are the values of Omega0, H0, q0, j0, s0, and l0 at which it failed? Could you post the full error message?

How about using the `Spline` command instead.


m0:=ImportMatrix(cat(kernelopts(homedir),"/My Documents/mapleprimes/x0-y0.txt")):
m1:=ImportMatrix(cat(kernelopts(homedir),"/My Documents/mapleprimes/x1-y1.txt")):

Digits:=40: # For accurate computation of ThieleInterpolation for this data.

plot((c1-c0)/c0, v=0..1, view=[0..1,-15e-8..0],color=red);

Digits:=10: # `Spline` seems much better at default precision for this data

plot((b1-b0)/b0, v=0..1, view=[0..1,-15e-8..0],color=green);

This isn't going to help with any actual comparative jump discontinuity in the data. We don't know anything about your measurement process, of course.

For such problems it's good to avoid any kind of seemingly arbitrary substitution, unless perhaps its particulars can be justified by an insight. Otherwise it's not generally applicable to other similar problems. In this case, insight might be had by observing that the variables in the original Variance call could be replaced. So you either buy this, or you don't.

> with(Statistics):
> R := 'RandomVariable(Normal(0, sigma))':
> a := [`$`('R', 5)]:

> map(Student:-Precalculus:-CompleteSquare,
>     collect(Variance((LLL)*a[3]+(-LL-LLL)*a[4]+a[5]),sigma),LLL); 

              /              2            \       
              |  /      1   \    1   2    |      2
              |2 |LLL + - LL|  + - LL  + 1| sigma 
              \  \      2   /    2        /       

So next you could substitute or evaluate that using 1-lambda[0] and 1-lambda[1] for both LL and LLL.

> subs([LL=1-lambda[1],LLL=1-lambda[0]],%);

       /                               2                         \
     2 |  /3               1          \    1                2    |
sigma  |2 |- - lambda[0] - - lambda[1]|  + - (1 - lambda[1])  + 1|
       \  \2               2          /    2                     /

I'm not sure whether I've ever seen that question before. It sounds like a reasonable thing to ask.

Maybe, ideally, DEplot would accept a regular `plot` command option for the y-axis scaling. Like

DEplot(..., axis[2]=[mode=log] );

But that gets me an error in Maple 14. If you're lucky, you might get away with a change of variables along with forced ytickmarks. I do this in the second call to DEplot below. (What range to use for generating the ytickmarks is then the hard bit to automate. You might have to play with the ytick's seq's range, and the y-view range.)

As an (admittedly, overly easy) example,

NLC := diff(y(t),t) = 10*y(t):
ivs := [y(0)=1,y(0)=3,y(0)=5]:

DEtools['DEplot']( NLC, y(t), t=0..1, ivs );

DEtools['DEplot']( eval(NLC,subs(y(t)=exp(u(t)))),
        u(t), t=0..1,
        labels=[t,y(t)] );

Alternatively, you could generate the usual non-log plot and then act on its internal data. Dirty work.

You can also try using the right mouse-click context menu, on the plot from the first of the two DEplot examples above. I mean, the choise Axes->Properties->Vertical then check the `Log mode` box and the `Use data extents` box, then the `Apply` and `OK` buttons. This produces something I find very ugly, with all the arrows resized and scaled.

You can use the `eval` command for this, without having to assign to x1 and x2.

> sol:=fsolve({x1+x2=11,x2-x1=1},{x1,x2});
{x1 = 5., x2 = 6.}

> printf("%.10f",eval(x1,sol));


> eval(sin(x1*x2),sol);

> eval(y=sin(x1*x2),sol); # a new equation
y = -0.9880316241

> y:=eval(sin(x1*x2),sol); # an assignment
> x1,x2;
x1, x2

If you really would prefer to assign to x1 and x2, you can use the `assign` command.

> assign(sol);

> x1,x2;
5., 6.

This is the multiplicative version of a `sum` vs `add` FAQ.

`product` doesn't have special evaluation rules, and so it tries to evaluate all of its arguments before binding to the formal parameters. So it tries to access Matrix entries m[s,1] and m[s,2] for s an unassigned symbol (ie. before index variable s takes a numeric value).

> m:=LinearAlgebra:-RandomMatrix(3,2):

> product((z-(m[s,1]+I*m[s,2])),s = 1..3);
Error, bad index into Matrix

> m[s,1];
Error, bad index into Matrix

> mul((z-(m[s,1]+I*m[s,2])),s = 1..3);
    (z + (-99 - 92 I)) (z + (-29 + 31 I)) (z + (-44 - 67 I))

> # Alternatively, we could explicitly delay the evaluation of
> # references to the Matrix entries, by using uneval-quotes.

> product((z-('m[s,1]'+I*'m[s,2]')),s = 1..3);
    (z + (-99 - 92 I)) (z + (-29 + 31 I)) (z + (-44 - 67 I))
> term1:=cos(Pi*(3*a-2*n)):
> term2:=cos(3*Pi*a+2*Pi*n):
> term3:=cos(3*Pi*a-2*Pi*n):

> combine(expand(term1)) assuming n::integer;
                          cos(3 Pi a)

> combine(expand(term2)) assuming n::integer;
                          cos(3 Pi a)

> combine(expand(term3)) assuming n::integer;
                          cos(3 Pi a)

> combine(expand(term1+term3)) assuming n::posint;
                         2 cos(3 Pi a)

Here's a rough idea of the sort of thing you could do. Execute the worksheet, then move the slider.

Right-click on the Slider component, choose "Component Properties", and examine the various entries. in particular, open "Action When Value Changes" which contains code.

If you want, you can put all that remaining top-level code inside that slider as well (before what's there already). Except the restart. And I guess you've realized already that you can obtain the vector-valued stuff from another source component.

You can make it much prettier, of course. It's just the idea.

Omega := H0^2*Omega0*(1+z)^3/H^2:
#eq := z-> H^2=(-1/(12*f1))*(T*Omega+f):
eq := unapply(H^2=(-1/(12*f1))*(T*Omega+f),z):

Take the first point, and flatten the cube (as if it were a cardboard box). Make the face containing the first point be the center of a cross, where the 4 cross arms are the adjacent 4 faces.

If the second point is on an adjacent face, draw a straight line between them.

If the second point is on the back (6th) face then add 4 instances of that face at the end of each arm of the cross. Take the least of the 4 instances of the straight line distances.

Yes, it is the lower of two single-line entry boxes right inside the Cloud palette.

They are the "Search" entry box and the "Share your document" entry box. They both appear right under the drop-down menubox which shows which Cloud group is in view, "eg "public".

First 15 16 17 18 19 20 21 Last Page 17 of 48