Alec Mihailovs

Dr. Aleksandrs Mihailovs

4495 Reputation

21 Badges

20 years, 340 days
Mihailovs, Inc.
Owner, President, and CEO
Tyngsboro, Massachusetts, United States

Social Networks and Content at Maplesoft.com

Maple Application Center

I received my Ph.D. from the University of Pennsylvania in 1998 and I have been teaching since then at SUNY Oneonta for 1 year, at Shepherd University for 5 years, at Tennessee Tech for 2 years, at Lane College for 1 year, and this year I taught at the University of Massachusetts Lowell. My research interests include Representation Theory and Combinatorics.

MaplePrimes Activity


These are replies submitted by Alec Mihailovs

Great! That is, certainly, better. I didn't read the typematch help page and didn't realize that the variables get assigned. In this case especialy, indeed, I would use typematch instead of ops if possible.

Alec

OK, here is the code using typematch,

`convert/ET`:=expr->subsindets(expr,
    'specfunc(anything,hypergeom)', 
    proc(f) local a,b,c,z,s:
        if typematch(f,hypergeom(
            [a::algebraic, b::algebraic],
            [c::algebraic], z::algebraic),s) 
        then assign(s); 
            (1-z)^(-a)*hypergeom([a,c-b],[c],z/(z-1))     
        else f 
        fi 
    end);

Or eval (...,s) can be used instead of assign and the following expression - I'm not sure what is better.

It certainly looks more clear.

Alec

OK, here is the code using typematch,

`convert/ET`:=expr->subsindets(expr,
    'specfunc(anything,hypergeom)', 
    proc(f) local a,b,c,z,s:
        if typematch(f,hypergeom(
            [a::algebraic, b::algebraic],
            [c::algebraic], z::algebraic),s) 
        then assign(s); 
            (1-z)^(-a)*hypergeom([a,c-b],[c],z/(z-1))     
        else f 
        fi 
    end);

Or eval (...,s) can be used instead of assign and the following expression - I'm not sure what is better.

It certainly looks more clear.

Alec

Thank you.

It would be even more cleaner if I could just write hypergeom instead of H, and don't use eval. Unfortunately, that produces an infinite loop.

Alec

Thank you.

It would be even more cleaner if I could just write hypergeom instead of H, and don't use eval. Unfortunately, that produces an infinite loop.

Alec

In general that may be true. In this particular example, using, say, patmatch would make the code more understandable, perhaps, but much slower and using more memory.

Personally, I prefer something like applyrule, especially if that could be done directly, without working around the infinite loop bug.

Alec

In general that may be true. In this particular example, using, say, patmatch would make the code more understandable, perhaps, but much slower and using more memory.

Personally, I prefer something like applyrule, especially if that could be done directly, without working around the infinite loop bug.

Alec

For every x3, the intervals for x1 and x2 are different, and given in the initial answer of solve.

If you specify some specific interval for x3, say 1≤x3≤2, then

f(1);

  [{-0.5170000000 <= x1, -0.5012500000 <= x2, x1 <= -0.4870000000,

        x2 <= -0.5006500000}]

f(2);

  [{-0.6780000000 <= x1, -0.6675000000 <= x2, x1 <= -0.6580000000,

        x2 <= -0.6671000000}]

so there are no values of x1 and x2 suitable for the entire interval from 1 to 2 for x3. And it looks as if that is the typical situation.

For some small intervals that may work though. For example, for 1≤x3≤1.0005,

solve(f(1)[] union f(1.0005)[]);

  {-0.5170000000 <= x1, -0.5012500000 <= x2, x1 <= -0.4871282180,

        x2 <= -0.5007748063}

Alec

For every x3, the intervals for x1 and x2 are different, and given in the initial answer of solve.

If you specify some specific interval for x3, say 1≤x3≤2, then

f(1);

  [{-0.5170000000 <= x1, -0.5012500000 <= x2, x1 <= -0.4870000000,

        x2 <= -0.5006500000}]

f(2);

  [{-0.6780000000 <= x1, -0.6675000000 <= x2, x1 <= -0.6580000000,

        x2 <= -0.6671000000}]

so there are no values of x1 and x2 suitable for the entire interval from 1 to 2 for x3. And it looks as if that is the typical situation.

For some small intervals that may work though. For example, for 1≤x3≤1.0005,

solve(f(1)[] union f(1.0005)[]);

  {-0.5170000000 <= x1, -0.5012500000 <= x2, x1 <= -0.4871282180,

        x2 <= -0.5007748063}

Alec

e is used in E1. When you come to it, it gives an error. The same would happen using other variables from the definition of E1 for the index.

Alec

e is used in E1. When you come to it, it gives an error. The same would happen using other variables from the definition of E1 for the index.

Alec

Why not? You can use one piecewise to define B and another one - to define C.

Alec

Why not? You can use one piecewise to define B and another one - to define C.

Alec

Substitute any value of x3, and you get explicit results for x1 and x2. For example,

sol:=solve({(1+x1)*(1+x3)>=0.966,(1+x1)*(1+x3)<=1.026,
(1+x2)*(1+x3)>=0.9975,(1+x2)*(1+x3)<=0.9987},{x1,x2}):

f:=unapply(sol,x3):

f(2);

  [{-0.6780000000 <= x1, -0.6675000000 <= x2, x1 <= -0.6580000000,

        x2 <= -0.6671000000}]

f(-2);

  [{-2.026000000 <= x1, -1.998700000 <= x2, x1 <= -1.966000000,

        x2 <= -1.997500000}]

Alec

Substitute any value of x3, and you get explicit results for x1 and x2. For example,

sol:=solve({(1+x1)*(1+x3)>=0.966,(1+x1)*(1+x3)<=1.026,
(1+x2)*(1+x3)>=0.9975,(1+x2)*(1+x3)<=0.9987},{x1,x2}):

f:=unapply(sol,x3):

f(2);

  [{-0.6780000000 <= x1, -0.6675000000 <= x2, x1 <= -0.6580000000,

        x2 <= -0.6671000000}]

f(-2);

  [{-2.026000000 <= x1, -1.998700000 <= x2, x1 <= -1.966000000,

        x2 <= -1.997500000}]

Alec

First 64 65 66 67 68 69 70 Last Page 66 of 180