jakubi

1384 Reputation

12 Badges

20 years, 1 days

MaplePrimes Activity


These are replies submitted by jakubi

Begin with simpler circuits, of one or two loops. You have two basic standard methods for writing the system of equations: by branch current and by mesh current. Besides your textbooks, you may find by googling for these methods plenty of tutorials. Just as a sample I have found these ones:

http://www.allaboutcircuits.com/vol_1/chpt_10/2.html

http://www.allaboutcircuits.com/vol_1/chpt_10/3.html

If you do not know yet what Kirchhoff laws are, it seems prudent that you learn them reading your textbook of Electricity and Magnetism and then begin solving simpler circuits.

If you do not know yet what Kirchhoff laws are, it seems prudent that you learn them reading your textbook of Electricity and Magnetism and then begin solving simpler circuits.

Apparently there is nothing in Maple as a structured type like 'fraction(n::integer,5)' (I would like to be wrong). So I have hacked the following code which is quite primitive, and probably close to useless, just see how far something that resembles it is possible and to show what I would like to see available:

mypatmatch:=proc(ex,pt,n)
local tr1,tr2,l:
tr1:=e->evalindets(e,fraction,se->fr([op(se)]));
tr2:=p->evalindets(p,specfunc(anything,fraction),se->r::specfunc([op(se)],fr));
patmatch(tr1(ex),tr2(pt),'l');
if type(l,list(equation)) then
op([1,n],subs(l,r));
else print("no match");
end if:
end proc:

mypatmatch(exp(3/5*I*q),exp(fraction(integer,5)*c::name*I),1);

                                  3

mypatmatch(exp(u/5*I*q),exp(fraction(integer,5)*c::name*I),1);

                              "no match"

mypatmatch(exp(5/3*I*q),exp(fraction(integer,5)*c::name*I),1);

                              "no match"

mypatmatch(exp(5/7*I*q),exp(fraction(5,integer)*c::name*I),2);

                                  7

is a bit better (or a bit less bad):

J:=Int(1/(u^2+1/4)*exp(I*u*k),u=-infinity...infinity):
value(J) assuming k::real;

  Pi signum(k) (-exp(k) + exp(k) signum(k) + signum(k) + 1) exp(- k/2)

(simplify@convert)(%,piecewise);

                    {  2 Pi exp(k/2)         k < 0
                    {
                    {        0               k = 0
                    {
                    { 2 Pi exp(- k/2)        0 < k

I have tried with the latest version of Algolib, downloaded from their project page, and got the same result. There is some info specific to gfun, including an email address.

From the help page of this version of Algolib:

gfun. Generating functions package (version 3.21, April 2007). The gfun package is used for the manipulation and discovery of generating functions. [Maintained and extended by Bruno Salvy, contributions by Ludovic Meunier, Marni Mishna and Eithne Murray, original version by Bruno Salvy and Paul Zimmermann. Comments and bug reports to gfun@inria.fr.]

with:

trace(`evalf/Sum/LevinU_Symb`):
trace(`evalf/Sum/LevinU_Symb/1_inf`):
Sum(sin(1/10000.0*i^2), i = 0 .. 199):
evalf( % );

seems to show that the problem is here. The latter routine produces a lot of output. Not clear what it is doing. Not obvious that a closed form is obtained. Sounds to me too much computation for this simple sum.

q

Yes, I was reading that statement. Which are those so old packages?

seems indeed to be a workaround. Reexecuting in Maple 12, with some 'gc()' added, without a restart:

> gc():f:=t->sin(t):
> int(f,0..Pi);
> int(f(x),x=0..Pi);
                                  2


                                  2

> gc():f:=t->sin(3*t):
> int(f,0..Pi);
> int(f(x),x=0..Pi);

                                 2/3


                                 2/3

> gc():f:=t->sin(Pi*t):
> int(f,0..1);
> int(f(x),x=0..1);

                                  2
                                 ----
                                  Pi


                                  2
                                 ----
                                  Pi

> gc():f:=t->sin(3*Pi*t):
> int(f,0..1);
> int(f(x),x=0..1);

                                  2
                                 ----
                                 3 Pi


                                  2
                                 ----
                                 3 Pi


The integers of the sequence arise simply:

S:=3*(Sum(cot(m*Pi/(2*M+1))^2, m = 1 .. M));
l:=[seq(simplify(value(subs(M=i,S))),i=1..5)];
                       l := [1, 6, 15, 28, 45]

rec:=gfun:-listtorec(l,u(N));#N starts at 0

  rec := [{(N + 2) u(N + 2) + (-4 + 2 N) u(N + 1) + (-6 - 3 N) u(N),

        u(0) = 1, u(1) = 6}, ogf]

SN:=rsolve(op(1,rec),u(N));

                                            2
                         SN := 1 + 3 N + 2 N

SM:=collect(subs(N=M-1,SN),M);

                                     2
                            SM := 2 M  - M

The integers of the sequence arise simply:

S:=3*(Sum(cot(m*Pi/(2*M+1))^2, m = 1 .. M));
l:=[seq(simplify(value(subs(M=i,S))),i=1..5)];
                       l := [1, 6, 15, 28, 45]

rec:=gfun:-listtorec(l,u(N));#N starts at 0

  rec := [{(N + 2) u(N + 2) + (-4 + 2 N) u(N + 1) + (-6 - 3 N) u(N),

        u(0) = 1, u(1) = 6}, ogf]

SN:=rsolve(op(1,rec),u(N));

                                            2
                         SN := 1 + 3 N + 2 N

SM:=collect(subs(N=M-1,SN),M);

                                     2
                            SM := 2 M  - M

So, a workaround is possible: generate an object of type function whose 'op' 0 is `^`:

q := subs(p=`^`,p(x,1/2));
                            q := ^(x, 1/2)

This object is "metastable", so that it is necesary to prevent its full evaluation:

q;
                                  1/2
                                 x

eval(q,1);

                              ^(x, 1/2)

In this way:

subsop(0=H,eval(q,1));
                              H(x, 1/2)

I do not know whether it is a good reason, but I have just happen to compare these two paragraphs, the one in ?subsop, cited by Joe:

A speci of 0 is allowed only for function, indexed expression, and series exprs.

with this one in ?op:

For some data structures, op(0, e) is defined as a special case (for more information, see the particular data structure help page). For functions, op(0, e) is the name of the function. For subscripted names, op(0, e) is the name without the subscript. For series, op(0, e) is x-a where x is the variable and a is the expansion point of the series. If calculating op(0, series(exp(x), x=a)), x-a returns rather than a. For all other data structures, op(0, e) returns the type of e.

I.e., 'subsop' for 0 is allowed for those objects whose 'op' 0 is not the type.

Though it is not an explanation as why this is so, this relation makes me simpler to remember the rule.

a "numerically aided" filter may help:

map(x->[x,evalf(x)],[solve(p^3 - p + 1/10, p)]):
select(x->is(Re(op(2,x)),nonnegative),%):
map(simplify@evalc@(x->op(1,x)),%);
                            1/2    1/2
        1/2                3    373        Pi
  [2/3 3    sin(1/3 arctan(-----------) + ----),
                                9          6

                                  1/2    1/2
              1/2                3    373        Pi
        -1/3 3    sin(1/3 arctan(-----------) + ----)
                                      9          6

                            1/2    1/2
                           3    373        Pi
         + sin(-1/3 arctan(-----------) + ----)]
                                9          3

First 62 63 64 65 66 67 68 Last Page 64 of 123