pagan

5147 Reputation

23 Badges

17 years, 122 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 replies submitted by pagan

I (sort of) understood it like this:

> restart:

> P:=(n,delta)->Statistics:-PDF(Statistics:-RandomVariable(
>       NonCentralFRatio(3,3*n,delta)),
>       Statistics:-Quantile(Statistics:-RandomVariable(
>       FRatio(3,3*n)),0.95,numeric),numeric):

> Optimization:-Maximize('P'(10,delt),delt=0..20);
             [0.198323174319974010, [delt = 6.70546102796105359]]
 
> #plot('P'(10,delt),delt=0..20);

> Optimization:-Maximize('P'(100000,delt),delt=0..20);
             [0.230643075153861010, [delt = 5.63740270097796525]]
 
> #plot('P'(10000,delt),delt=0..20);

You claimed that you wanted to find the value of n such that CDF(X,100)=0.9

Using my code above, that fsolve call computes it (quickly).

> n := fsolve(F,0..1);
                               n := 0.3031007062
 
> CDF(X,100,numeric);
                                 0.9000000000
 
> n:='n':

Of course, you don't have to assign to n in order to compute the solution using fsolve (...it just made it easier for me to illustrate that it satisfied the problem at hand, immediately above).

I understand that you have now decided to re-pose it all as another question. Best of luck.

You claimed that you wanted to find the value of n such that CDF(X,100)=0.9

Using my code above, that fsolve call computes it (quickly).

> n := fsolve(F,0..1);
                               n := 0.3031007062
 
> CDF(X,100,numeric);
                                 0.9000000000
 
> n:='n':

Of course, you don't have to assign to n in order to compute the solution using fsolve (...it just made it easier for me to illustrate that it satisfied the problem at hand, immediately above).

I understand that you have now decided to re-pose it all as another question. Best of luck.

RootFinding:-NextZero(unapply(rhs(X1)-1,t), 0.0);
RootFinding:-NextZero(unapply(rhs(X1)-1,t), 0.0);

The alternative you showed can be measurably more expensive. I thought that there were some posts illustrating it with performance data, but right now I can only find this and its parent. (Mapleprimes search is still broken, depending on the posts' ages.)

I suppose that the `parameters` stuff is also supposed to tie in nicely with the `events` facilities of dsolve/numeric.

You can use g:=unapply(f,x) to get an operator g, to which you could then supply an argument such as g(3.7)

Or you could substitute values using two-argument `eval`, such as eval(f,x=3.7)

You can use g:=unapply(f,x) to get an operator g, to which you could then supply an argument such as g(3.7)

Or you could substitute values using two-argument `eval`, such as eval(f,x=3.7)

Maybe the Online Help links to the What's New pages could be updated to M14.

First things first: you've still got the command call wrong. It should be like

plot(sin,0..10);

or

plot(sin(x),x=0..10);

and not like

plot(sin(x),0..10);

In a properly working Maple 13, that last one, the incorrect one, gives an error about being unable to evaluate to numeric values. But the two earlier, correct forms do usually work, on Linux.

I was able to get the exact same error message if I launched Maple in the following way from my shell.

$ maple13.01 -s -b /usr/local/maple13/lib/maple.mla
    |\^/|     Maple 13 (X86 64 LINUX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2009
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> plot(sin(x), 0 .. 10);
Error, (in plot) type `has_unit` does not exist
> plot(sin,0..10);
Error, (in plot) type `has_unit` does not exist

Perhaps your installation is incomplete or partially corrupt. But maybe the problem is instead due to `libname` being wrong. (It could be launched with bad options, or you might have something in your ~/.mapleinit file, etc.)

What gets returned when you issue the Maple command

libname;
Is there a file units.mla in the lib subdirectory of your Maple installation?

First things first: you've still got the command call wrong. It should be like

plot(sin,0..10);

or

plot(sin(x),x=0..10);

and not like

plot(sin(x),0..10);

In a properly working Maple 13, that last one, the incorrect one, gives an error about being unable to evaluate to numeric values. But the two earlier, correct forms do usually work, on Linux.

I was able to get the exact same error message if I launched Maple in the following way from my shell.

$ maple13.01 -s -b /usr/local/maple13/lib/maple.mla
    |\^/|     Maple 13 (X86 64 LINUX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2009
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> plot(sin(x), 0 .. 10);
Error, (in plot) type `has_unit` does not exist
> plot(sin,0..10);
Error, (in plot) type `has_unit` does not exist

Perhaps your installation is incomplete or partially corrupt. But maybe the problem is instead due to `libname` being wrong. (It could be launched with bad options, or you might have something in your ~/.mapleinit file, etc.)

What gets returned when you issue the Maple command

libname;
Is there a file units.mla in the lib subdirectory of your Maple installation?

Success with this approach (and some others using subs, say) seems to depend upon the particular variable names. (Is it due to ordering on names in indets results, I wonder, as in the "new" set ordering?)

> p := 1+(x+y)+(x+y)*x;
                          p := 1 + x + y + (x + y) x
 
> eval(collect(simplify(p,[x+y=z]),z),z=x+y);
                              1 + (1 + x) (x + y)
 
> p := 1+(x+y)+(x+y)*y;
                          p := 1 + x + y + (x + y) y
 
> eval(collect(simplify(p,[x+y=z]),z),z=x+y);
                                   2
                        1 + (x + y)  + (1 - x) (x + y)
 
> (p1,p2) := selectremove(has, p, {x,y});
                        p1, p2 := x + y + (x + y) y, 1
 
> factor(p1)+p2;
                              (1 + y) (x + y) + 1
 
> p := 1+(z+y)+(z+y)*y;
                          p := 1 + z + y + (z + y) y
 
> eval(collect(simplify(p,[z+y=Z]),Z),Z=z+y);
                              1 + (1 + y) (z + y)
 
> p := 1+(z+y)+(z+y)*z;
                          p := 1 + z + y + (z + y) z
 
> eval(collect(simplify(p,[z+y=Z]),Z),Z=z+y);
                                   2
                        1 + (z + y)  + (1 - y) (z + y)

And now...

$ maple13.01 -s --setsort=1
    |\^/|     Maple 13 (X86 64 LINUX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2009
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> p := 1+(z+y)+(z+y)*z:
> eval(collect(simplify(p,[z+y=Z]),Z),Z=z+y);
                                   2
                        1 + (z + y)  + (1 - y) (z + y)
 
> quit

while...

$ maple13.01 -s --setsort=2
    |\^/|     Maple 13 (X86 64 LINUX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2009
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> p := 1+(z+y)+(z+y)*z:
> eval(collect(simplify(p,[z+y=Z]),Z),Z=z+y);
                              1 + (1 + z) (z + y)

Success with this approach (and some others using subs, say) seems to depend upon the particular variable names. (Is it due to ordering on names in indets results, I wonder, as in the "new" set ordering?)

> p := 1+(x+y)+(x+y)*x;
                          p := 1 + x + y + (x + y) x
 
> eval(collect(simplify(p,[x+y=z]),z),z=x+y);
                              1 + (1 + x) (x + y)
 
> p := 1+(x+y)+(x+y)*y;
                          p := 1 + x + y + (x + y) y
 
> eval(collect(simplify(p,[x+y=z]),z),z=x+y);
                                   2
                        1 + (x + y)  + (1 - x) (x + y)
 
> (p1,p2) := selectremove(has, p, {x,y});
                        p1, p2 := x + y + (x + y) y, 1
 
> factor(p1)+p2;
                              (1 + y) (x + y) + 1
 
> p := 1+(z+y)+(z+y)*y;
                          p := 1 + z + y + (z + y) y
 
> eval(collect(simplify(p,[z+y=Z]),Z),Z=z+y);
                              1 + (1 + y) (z + y)
 
> p := 1+(z+y)+(z+y)*z;
                          p := 1 + z + y + (z + y) z
 
> eval(collect(simplify(p,[z+y=Z]),Z),Z=z+y);
                                   2
                        1 + (z + y)  + (1 - y) (z + y)

And now...

$ maple13.01 -s --setsort=1
    |\^/|     Maple 13 (X86 64 LINUX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2009
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> p := 1+(z+y)+(z+y)*z:
> eval(collect(simplify(p,[z+y=Z]),Z),Z=z+y);
                                   2
                        1 + (z + y)  + (1 - y) (z + y)
 
> quit

while...

$ maple13.01 -s --setsort=2
    |\^/|     Maple 13 (X86 64 LINUX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2009
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> p := 1+(z+y)+(z+y)*z:
> eval(collect(simplify(p,[z+y=Z]),Z),Z=z+y);
                              1 + (1 + z) (z + y)

In 13.01

> restart:
> solve(x^2=a,x,UseAssumptions) assuming x>0, a>0;
                                      1/2
                                     a
 
> restart:
> assume(0<x,0<a):
> solve(x^2=a,x,UseAssumptions);
                                       1/2
                                     a~

In 12.01, when UseAssumptions was not yet a valid optional parameter of the solve command, there are some other techniques. For example.

> restart:
> simplify(solve({x^2=a,x>0},x)) assuming a>0;
                                        1/2
                                  {x = a   }
 
> restart:
> assume(0<a):
> simplify(solve({x^2=a,x>0},x));
                                         1/2
                                  {x = a~   }

In 13.01

> restart:
> solve(x^2=a,x,UseAssumptions) assuming x>0, a>0;
                                      1/2
                                     a
 
> restart:
> assume(0<x,0<a):
> solve(x^2=a,x,UseAssumptions);
                                       1/2
                                     a~

In 12.01, when UseAssumptions was not yet a valid optional parameter of the solve command, there are some other techniques. For example.

> restart:
> simplify(solve({x^2=a,x>0},x)) assuming a>0;
                                        1/2
                                  {x = a   }
 
> restart:
> assume(0<a):
> simplify(solve({x^2=a,x>0},x));
                                         1/2
                                  {x = a~   }
First 47 48 49 50 51 52 53 Last Page 49 of 81