pagan

5147 Reputation

23 Badges

17 years, 125 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

Yes, you are right. The inserted GUI Table is not available using programming commands.

The suggestion relating to whattype(%) is a false clue, I believe. Any new session (without use of a maple initialization file) does the same thing with or without a GUI Table's having been inserted. That is probably just because whattype(NULL) returns `expreseq` too. In the answer which mentioned this, the call to % doesn't connect to the inserted GUI Table which is a pure GUI thing and not a kernel/Library object.

I would say that you only have to look at the result of indAlt1IsFirst(x11, x12, x13, x21, x22, x23, x31, x32, x33).

The other multiplicands like fX12(x12)=piecewise(x12<0,0,x12<1,1,0) seem quite superfluous, since the domain of, say, x12 in your main integral is just (0,1). So there is no need to multiply by a piecewise that is 1 there and 0 elsewhere.

You may be able to do the stated example exactly. Consider,

> H:=piecewise((1/3)*x11+(1/3)*x12+(1/3)*x13-(1/3)*x21-(1/3)*x22-(1/3)*x23 >=0,1,0)
> *piecewise(0 <= (1/3)*x11+(1/3)*x12+(1/3)*x13-(1/3)*x31-(1/3)*x32-(1/3)*x33, 1, 0):

> convert(H,Heaviside);

1 - Heaviside(x31 - x11 - x12 - x13 + x32 + x33)

- Heaviside(x21 - x11 - x12 - x13 + x22 + x23) + Heaviside(x21

- x11 - x12 - x13 + x22 + x23) Heaviside(x31 - x11 - x12 - x13

+ x32 + x33)

But (even if `int` cannot handle this 9-variable version) consider the 6-variable and 3-variable forms:

> int(1-Heaviside(a-c)-Heaviside(e-c)+Heaviside(a-c)*Heaviside(e-c),
> [a=0..1,c=0..1,e=0..1]);
1
-
3

> int(1-Heaviside(a+b-c-d)-Heaviside(e+f-c-d)
> +Heaviside(a+b-c-d)*Heaviside(e+f-c-d),
> [a=0..1,b=0..1,c=0..1,d=0..1,e=0..1,f=0..1]); # takes a little while
1
-
3

That 1/3 answer is not related to the 1/3 factor appearing in the original integral's piecewises (since they are applied to all terms in the inequalities and can be removed). Is this one of those examples where, having seen the answer you can go back and see why it had to be so?

You should ask a new question as an entirely new topic (use the big orange button on Mapleprimes' front page, entitled "Ask a Question") instead of cluttering up some previous post as you've done by tacking your new question onto it.

Use Matrix with a capital M, not matrix. No, you don't have to do with(Matlab).

LinearAlgebra:-MatrixInverse(A)

or

A^(-1)

or

with(LinearAlgebra):
MatrixInverse(A);

> a:=[sqrt(8),sqrt(2),sqrt(39),-sqrt(5),sqrt(26)];

         [   (1/2)   (1/2)    (1/2)    (1/2)    (1/2)]
         [2 2     , 2     , 39     , -5     , 26     ]

> sort(a);

         [ (1/2)    (1/2)    (1/2)     (1/2)    (1/2)]
         [2     , 26     , 39     , 2 2     , -5     ]

> map(length,a); # explains the last result

                      [13, 9, 10, 13, 10]

> sort(a,`<`@evalf);

         [  (1/2)   (1/2)     (1/2)    (1/2)    (1/2)]
         [-5     , 2     , 2 2     , 26     , 39     ]

> sort(a,(s,t)->is(s<t));
         [  (1/2)   (1/2)     (1/2)    (1/2)    (1/2)]
         [-5     , 2     , 2 2     , 26     , 39     ]
> restart:

> expr:=2.062648062*10^(-8)*sqrt(8.607207774*10^11*x+
>       2.976566118*10^18-5.312602135*10^9*x*ln(x))
>       -0.1721820163e-1*sqrt(x)-30. = 0:

> rng:=10^5..10^10:

> Student:-Calculus1:-Roots(expr, x = rng);

                       [              9]
                       [2.407472420 10 ]

> logsol:=Student:-Calculus1:-Roots(subs(x=10^x,expr), x = map(log[10],rng));

                   [5.112750136, 9.381561321]

> sol:=map(t->10^t,logsol);

               [              5                9]
               [1.296433175 10 , 2.407472422 10 ]

> seq( eval(expr), x in sol);

                         0. = 0, 0. = 0
for i from 46 to 49 do
   fname := cat("namefile-",i,"Ep.irr");
   cat(fname[10..-7],".txt");
end do;
                      "namefile-46Ep.irr"
                            "46.txt"
                      "namefile-47Ep.irr"
                            "47.txt"
                      "namefile-48Ep.irr"
                            "48.txt"
                      "namefile-49Ep.irr"
                            "49.txt"

You could also use commands from the StringTools package to do it, either taking a specific character range like above or selecting digits.

> simplify(arctan(tan(eps))) assuming eps>-Pi/2, eps<Pi/2;
                              eps

> arctan(tan(Pi));
                               0

In actuality, Maple will get this too,

> simplify(arctan(tan(eps))) assuming eps>=-Pi/2, eps<=Pi/2;
                              eps

Are you sure that you haven't got it backwards, with it working for Vectors but not for lists?

Right. So, you can strip off the tilde if what has assumptions on it.

> restart;
> assume(a,real);
> assume(b,real):
> parameters:=[a,b,c]:
> i:=0:
> for what in parameters do
>   temp:=i;
>   assign(cat('crlb_', `if`(getassumptions(what)={},what,convert(what,string)[1..-2])), temp);
>   i:=i+1;
> end do:

> crlb_a, crlb_b, crlb_c;
                              0, 1, 2

The `t` on the left of the arrow in

t -> some_expression

is a formal parameter. If some_expression was created earlier on, using another `t` (like, eg, the global `t`) then the t's will not be the same. In other words, you cannot create procedures or operators like that.

See ?unapply

The simplest thing for you is probably to just create S as a piecewise expression, and not have it be an operator at all.

For example

> restart:
> n:=5:
> gen:=rand(1..100):
> x:=sort(Array(0..n-1,gen)):
> a:=Array(0..n-1,gen):
> b:=Array(0..n-1,gen):
> c:=Array(0..n-1,gen):
> d:=Array(0..n-1,gen):

> for j from n-1 by -1 to 0 do
>   s[j] := evalf(a[j]+b[j]*(t-x[j])+c[j]*(t-x[j])^2+d[j]*(t-x[j])^3);
> end do:

> S := piecewise(
>   x[0] <= t and t <= x[1], s[0],
>   x[1] <= t and t <= x[2], s[1],
>   x[2] <= t and t <= x[3], s[2]);

S := 

   /                              2               3                           
   |  -103. + 27. t + 18. (t - 6.)  + 25. (t - 6.)         6 <= t and t <= 45 
   |                                                                          
   |                               2                3                         
  <  -4276. + 96. t + 52. (t - 45.)  + 90. (t - 45.)       45 <= t and t <= 93
   |                                                                          
   |                               2                3                         
   | -1481. + 17. t + 56. (t - 93.)  + 93. (t - 93.)       93 <= t and t <= 96
   \                                                                          

> eval(S,t=10);
                                    2055.

At which point you can just do

> plot(S, t=0..100);

You could turn S into an operator (if you really want, but as shown above it's doesn't seem necessary for your work.

> Sfun:=unapply(S,t);
                        /                    
  Sfun := t -> piecewise\6 <= t and t <= 45, 

                                2               3                       
    -103. + 27. t + 18. (t - 6.)  + 25. (t - 6.) , 45 <= t and t <= 93, 

                                  2                3                       
    -4276. + 96. t + 52. (t - 45.)  + 90. (t - 45.) , 93 <= t and t <= 96, 

                                  2                3\
    -1481. + 17. t + 56. (t - 93.)  + 93. (t - 93.) /

> Sfun(10);
                                    2055.

which would be plotted accordingly

plot(Sfun, 0..100);

Remove the semicolon that you have at the end of this line

proc(f,g,n,h,tinit,xinit,yinit,t,s,y); 

The following gets M(z) quite a bit more compact, from length 6493 down to 1467.

simplify(expand(M(z)),size)

I was able to "factor" (ie. collect) by those common terms, but the result was not so much smaller than the original.

You can install it anywhere you want.

Presumably you know how on Linux to create a disk partition, format it, and then mount it. Let's suppose you mount it at /mybigpartition and that you create a directory /mybigpartition/maple under which you intend to install all your Maple versions. At this point, you can just run the Maple 13 Installer, and tell it /mybigpartition/maple/maple13 as the location when it asks you where to install the thing. Naturally, you likely do all that as user "root".

The trick is to make the various launch scripts under Linux Maple's "bin" subdirectory be easily available after you install.

One easy way to make the installed version available is to simply alias the launch scripts. For example, in your ~/.bashrc (or ~/.profile, equivalent) shell initialization file you could have,

   alias maple='/mybigpartition/maple/maple13/bin/maple'

provided that you had installed Maple under the /mybigpartition/maple/maple13 directory. In this way, the single command maple would be available to you in your new shell or xterm instances.

You could also make symbolic links, using a location that is expected to be in each Linux user's PATH. For example, as root you could issue,

  ln -s /mybigpartition/maple/maple13/bin/maple /usr/local/bin/maple

since /usr/local/bin is a "standard" place for add-on executables.

And of course you could use "maple13" instead of "maple" in the above examples, if you wanted to distinguish between your installed versions of Maple. (Maybe you'll also have older or newer versions at a later date, etc.) Pick whatever name it is you want to type in later on. Eg,

  alias m13='/mybigpartition/maple/maple13/bin/maple'

or

  ln -s /mybigpartition/maple/maple13/bin/maple /usr/local/bin/m13

One method for accomplishing these tasks involves saving the various pieces to a .mla Maple Library Archive. Then, in any new session which requires those pieces you would only have to append `libname` with the location of that archive. You wouldn't even need to `read` or `#include` anything, as the saved objects and expressions would just be there -- just as if you'd assigned them in each new session.

See ?libname and ?savelib and maybe ?LibraryTools

You could save your various pieces (to an archive, say) using a particular worksheet used just for that purpose. If you go this route then take care to always save to a valid .mla archive and not to individual .m files. (If no .mla is availables and writable then Maple will emit .m files when `savelib` is invoked.)

(You can ignore the first line summary of ?savelib, where it says "save a file to a Maple repository" since that's not what it does. That's a documentation bug. What it actually does is save expressions and Maple objects to a repository. The arrangement of the documentation for saving and using Library archives could be better.)

A quite different alternative is to use the `read` command or the $include directive. But that entails having your various pieces be laid out in plaintext source files (usually give filename extension .mpl but that's just a loose convention). See ?read and ?include for details.

Some people strongly prefer to always work with source in plaintext files, while some others take pains to avoid it. Which approach is best for you probably depends most on that, and on how you prefer to work with source.



Use the capitalized word Matrix, not matrix.

First 24 25 26 27 28 29 30 Last Page 26 of 48