Robert Israel

6577 Reputation

21 Badges

18 years, 217 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are replies submitted by Robert Israel

Unfortunately the Maple type function is poorly named, it really should be something like "function_call", i.e. an expression of the form a(args) where a is a name and args is an expression sequence.  In your case I think you want y to be of type procedure.

The basic problem with what you're doing here is that the formal parameters x and z of E have no connection to the local variables x and z of the procedure elasticity.

I think you want something like this:

> elasticity:= proc(y:: procedure)
    (x,z) -> D(y)(x)*x/z;
  end proc;
  E := (x,z) -> elasticity(y)(x,z);

 

> Y:= f(infinity, x);

Y := 1+x*hypergeom([1, 1+I, 1-I],[2, 2],x)

> plot(Y, x = 0 .. 1);

Compare to:

> YN:= dsolve({deq, y(0)=1, D(y)(0)=1}, y(x), numeric);
  plots[odeplot](YN, 0..1);

> Y:= f(infinity, x);

Y := 1+x*hypergeom([1, 1+I, 1-I],[2, 2],x)

> plot(Y, x = 0 .. 1);

Compare to:

> YN:= dsolve({deq, y(0)=1, D(y)(0)=1}, y(x), numeric);
  plots[odeplot](YN, 0..1);

It should be noted that this won't work in general.  For example:

> select(is,[solve(p^3 - p + 1/10, p)],nonnegative);

[ ]

In fact there are two nonnegative roots, but the solution in radicals uses complex numbers, and "is" is not smart enough to realize that two of the three solutions are nonnegative.   One thing that works in this case is

> select(is,simplify(evalc([solve(p^3 - p + 1/10, p)])),nonnegative);
 

Another is

> select(is,[seq(RootOf(p^3 - p + 1/10 ,p,index=i),i=1..3)],nonnegative);

However,

> select(is,[seq(RootOf(p^3 - p ,p,index=i),i=1..3)],nonnegative);

misses the root with index 1, namely 0.

It should be noted that this won't work in general.  For example:

> select(is,[solve(p^3 - p + 1/10, p)],nonnegative);

[ ]

In fact there are two nonnegative roots, but the solution in radicals uses complex numbers, and "is" is not smart enough to realize that two of the three solutions are nonnegative.   One thing that works in this case is

> select(is,simplify(evalc([solve(p^3 - p + 1/10, p)])),nonnegative);
 

Another is

> select(is,[seq(RootOf(p^3 - p + 1/10 ,p,index=i),i=1..3)],nonnegative);

However,

> select(is,[seq(RootOf(p^3 - p ,p,index=i),i=1..3)],nonnegative);

misses the root with index 1, namely 0.

Yes, I saw that after I saw your posting...  My fault, I miscopied the search string.  In any case, I think my advice was sound: whether trying to do a problem oneself or asking somebody else for help, it's important to state the problem clearly.

 

 

 

Yes, I saw that after I saw your posting...  My fault, I miscopied the search string.  In any case, I think my advice was sound: whether trying to do a problem oneself or asking somebody else for help, it's important to state the problem clearly.

 

 

 

Yes, Maple is seeing sin(x, x=0..1).

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

became

plot(sin(x, x = 0 .. 1))

Now that I look at it again, it's not really that the semicolon was changed to a parenthesis, but rather that two separate things happened:
1) a semicolon at the end of 2D input in Classic is always dropped, and
2) the missing parenthesis was added.

What Maple's result means is this. The polynomial 3072-1536*_Z+576*_Z^2-160*_Z^3+35*_Z^4 has four complex roots: let's call them alpha_1 to alpha_4. The coefficient of x^k for k from 0 to infinity is sum_{j=1}^4 2/(alpha_j)^(k+1). The radius of convergence of the series is approximately 3.029725460, which is the distance from 0 to the closest root of the polynomial.
What Maple's result means is this. The polynomial 3072-1536*_Z+576*_Z^2-160*_Z^3+35*_Z^4 has four complex roots: let's call them alpha_1 to alpha_4. The coefficient of x^k for k from 0 to infinity is sum_{j=1}^4 2/(alpha_j)^(k+1). The radius of convergence of the series is approximately 3.029725460, which is the distance from 0 to the closest root of the polynomial.

Since the syntax rules for 1D and 2D are different, presumably the parsers are different, and therefore it's not surprising that the error messages may be different. There are also differences between 2D math in Standard and 2D math in Classic.  I tried your example with 2D math in Classic, and got a different error message:

Error, (in sin) expecting 1 argument, got 2

because in this case Maple changed the ";" to ")" without asking.

An interesting approach.  I guess what it's doing is formally summing 2/sqrt(n+2) and -2/sqrt(n+3) separately, obtaining 2*Zeta(1/2)-2-2^(1/2) and -2*Zeta(1/2)+2+2^(1/2)+2/3*3^(1/2) respectively, then adding.  I'd still like to see an indefinite summation here: sum(a, n) should produce -2/sqrt(n+2).

An interesting approach.  I guess what it's doing is formally summing 2/sqrt(n+2) and -2/sqrt(n+3) separately, obtaining 2*Zeta(1/2)-2-2^(1/2) and -2*Zeta(1/2)+2+2^(1/2)+2/3*3^(1/2) respectively, then adding.  I'd still like to see an indefinite summation here: sum(a, n) should produce -2/sqrt(n+2).

But it's much better, and less error-prone, if you use an indexed variable rather than 16 different names.  Let Maple do the work!

eqs:= {seq(add(a[i,j], j=1..4) = v, i=1..4), 
   seq(add(a[i,j], i=1..4) = v, j=1..4),
   add(a[i,i], i=1..4) = v,
   add(a[i,5-i], i=1..4) = v};

And then use solve.

But it's much better, and less error-prone, if you use an indexed variable rather than 16 different names.  Let Maple do the work!

eqs:= {seq(add(a[i,j], j=1..4) = v, i=1..4), 
   seq(add(a[i,j], i=1..4) = v, j=1..4),
   add(a[i,i], i=1..4) = v,
   add(a[i,5-i], i=1..4) = v};

And then use solve.

First 116 117 118 119 120 121 122 Last Page 118 of 187