## 20138 Reputation

14 years, 360 days

## recommended?...

Who recommends using textplot and the SYMBOL font, when using Maple's Standard GUI?

Can you not simply use the techniques described on the ?plot,typesetting help-page?

See ?plot,device and ?plot,setup if you are not familiar with how to programatically export plots to gif, jpeg, etc.

acer

## syntax...

Could someone please explain the syntax used in stating this problem? Thanks.

[updated] Please ignore the above. I've got it now.

acer

## usage...

Did you mean something like this, in particular for that limit?

```> restart:

> limit(sum(1/exp(1/n),n=1..N),N=infinity);
infinity

> sum(n/(n+1),n=1..infinity);
infinity
```

acer

```> M:= Matrix([[1,2,3],[4,7,9],[5,7,11]]);
[1    2     3]
[            ]
M := [4    7     9]
[            ]
[5    7    11]

[ 6]
[  ]
[20]
[  ]
[23]
```

acer

## procedure...

Could you not put all the code inside one or more procedures, and have the Components simply contain only the appropriate procedure calls?

You might even put the code which defines those procedures inside the "hidden" StartUp Code region of the worksheet. (See top-menubar's Edit -> StartUp Code choice.)

Then you can call and re-use the same procedures in several different Components, and yet editing could be done in one single location -- wherever you define the procedures.

acer

## MeijerG...

```> eq2 := Int(x^(2*k)/(1+x^(2*k))^2, x = 0 .. 1):
> with(IntegrationTools):
> eq3 := Change(eq2, u = x^(2*k), u) assuming k::posint:

> value(eq3) assuming k::posint;

2 k + 1    4 k + 1
hypergeom([2, -------], [-------], -1)
2 k        2 k
--------------------------------------
2 k + 1

> limit(convert(%,MeijerG), k = infinity) assuming k::posint;
0

> limit(convert(%%,MeijerG), k = infinity);
0
```

acer

## code...

Using a translation of the Mma code here to get Carmichael numbers,

```> seq(`if`(modp(n,numtheory[lambda](n))=1 and
>          not isprime(n), n, NULL), n=1..10000);
561, 1105, 1729, 2465, 2821, 6601, 8911
```

See the Comment section at that link.

acer

## Diff, diff...

```eqn := Diff(a(x)*b(x),x) = diff(a(x)*b(x),x);

neweqn := isolate(eqn, diff(b(x),x)*a(x));

```

Now, supose you have an expression, and you wish to use the above identity to substitute,

```expr := sin(x)*exp(diff(b(x),x)*a(x));

eval(expr, neweqn);
```

acer

## ArcLength...

```with(Student:-VectorCalculus):

C := <2*exp(t),exp(2*t)*cos(t),exp(2*t)*sin(t)>;

ArcLength(C, t=0..ln(3));
```

acer

## with side effects...

If you really, really want to,

```> F:=proc(L::evaln)
>   L:=subsop(1=NULL,eval(L));
> end proc:

> L:=[x,y,z,d];
L := [x, y, z, d]

> F(L);
[y, z, d]

> F(L);
[z, d]

> F(L);
[d]

> F(L);
[]
```

Alternatively,

```> restart:

> F:=proc(L)
>   L:=subsop(1=NULL,eval(L));
> end proc:

> L:=[x,y,z,d];
L := [x, y, z, d]

> F('L');
[y, z, d]

> F('L');
[z, d]

> F('L');
[d]

> F('L');
[]
```

Some people think that this sort of thing is evil.

acer

## ExcelTools:-Import...

Do the values in Matrix M appear correct, if you run this code below?

```A := ExcelTools:-Import("Density.xls");

interface(rtablesize=50):
M:=Matrix(A);
```

There are several plotting choices available. This is just one such (presuming that I've interpreted the data structure ok),

```plots:-pointplot3d([seq(seq([M[i,1],M[3,j],M[i,j]],j=2..6),i=4..11)],
axes=boxed,symbol=solidcircle,
labels=[Temperature,Pressure,Density]);
```

acer

## another way to look at it...

Suppose we make the two assignments,

```> x := Vector[row]([1,2]);
x := [1, 2]

> y := Vector[row]([1,2]);
y := [1, 2]

```

And now we assign to an entry of x,

```> x[1]:=17:

> x;
[17, 2]
```

Most people will usually want that the corresponding entry of y to not get assigned by the above assignment to x. So, Maple has two separate and distinct Vectors [1,2] when x and y are created.

The comparison,

```  if foo = bar then
```

will do a comparison for identity, ie. are they the same object in memory. But as just seen, they are not. They are distinct, so that their respective elements may be changed independently.

So, what's been noticed is that mutable objects (objects whose elements may be changed or altered) are generally distinct in Maple.

The routine is() can do some mathematical inference that evalb(..=..) does not do. Originally, is() was a mechanism for query properties, but perhaps it's been becoming mathematically smarter.  It's not an unreasonable expectation for is() to be able to handle this query. But, as it happens, it hasn't (yet) been taught to do that.

One might ask, why does if foo=bar then.. make the "object identity" query evalb(foo=bar) rather that the LinearAlgebra:-Equal(foo,bar) query? Well, it's consistent with how most all other objects are treated in that operation. And if the implementation were reversed then someone would complain about that, and an alterntive syntax would have to be used in order to force the specific identity query on Matrices/Vectors, etc.

The Maple help system doesn't really make it easy to figure out what the `=` means in if foo=bar then..

acer

## nonlinear...

The equations are not all linear in those variables.

```> eqnlist := Equate(
>   <(1/5)*sqrt(6)*c[3,1]+(1/7)*sqrt(6)*c[3, 3], 0,
>     (2/7)*c[3, 3]*c[3, 1]+(2/9)*c[3, 3]^2>,
>   <0,0,1>
>                   ):

> fsolve({eqnlist[1],eqnlist[3]},{c[3, 1],c[3, 3]});
{c[3, 1] = 5.303300866, c[3, 3] = -7.424621212}

> _EnvExplicit:=true:

> solve(eqnlist,[c[3, 1],c[3, 3]],AllSolutions);
1/2                1/2
15 2               21 2
[[c[3, 1] = - -------, c[3, 3] = -------],
4                  4

1/2                  1/2
15 2                 21 2
[c[3, 1] = -------, c[3, 3] = - -------]]
4                    4

> evalf(%);
[[c[3, 1] = -5.303300858, c[3, 3] = 7.424621200],

[c[3, 1] = 5.303300858, c[3, 3] = -7.424621200]]
acer```

## indexing notation...

First case: a is a Matrix/Vector/Array (ie. and rtable underneath). In that case, square brackets are the "usual" indexing way, and round brackets allows some new indexing facility introduced in Maple 12. See the first item in the ?updates,Maple12,programming help-page. I personally would prefer to use the square brackets, unless I were using the new functionality to extend the size of the rtable dynamically or to get some (no-copy) efficiency with it on the rhs of an assignment. People familiar with Maple would recognize the square bracket code as "indexing". Which you prefer might depend on how much you wish to kowtow to Matlab syntax.

While I understand that using round brackets for rtable indexing (new in Maple 12) has appeal, I'm not sure yet whether I like the choice of syntax. Efficiency is good, and so is the new ability to extend sizes dynamically. But those could be gotten with other syntax choices too. The choice of round brackets is "Matlab compatible", but it also precludes the possibility of extending round-bracket syntax to allow application by, say, a Matrix of operators.

Second case: a is not an rtable. In that case using the square brackets will treat a as a table, even if you have not used the table() command explicitly. For example,

```> restart:
> a[5]:=17:
> a[5];
17
> eval(a);
table([5 = 17])
```

If you instead use the round brackets, then you are using function application syntax. And when you use it in an assignment like that, you are assigning to the remember table of "function" a. Now, while that does also use a table underneath as the mechanism, it is less apparent what's going on. People may not recognize immediately what your code is doing and how it relies on this, even if the overall effect is the same. I would prefer square brackets, in this case.

```> restart:
> a(5):=17:
> a(5);
17
> eval(a);
proc() option remember; 'procname(args)' end proc

> op(4,eval(a));
table([5 = 17])
```

acer

## eval...

```> seq([eval(c^6*d,x),x], x in solve({6*c+d=24,6*c^2+d^2=96},[c,d]));
3072000000
[----------, [c = 20/7, d = 48/7]], [0, [c = 4, d = 0]]
823543

> map2(op,1,[%]);
3072000000
[----------, 0]
823543

> max(%);
3072000000
----------
823543
```

Or, simply,

```> max(seq(eval(c^6*d,x), x in solve({6*c+d=24,6*c^2+d^2=96},[c,d])));
3072000000
----------
823543
```

acer

 First 197 198 199 200 201 202 203 Last Page 199 of 227
﻿