Preben Alsholm

13471 Reputation

22 Badges

20 years, 249 days

MaplePrimes Activity


These are answers submitted by Preben Alsholm

A minor problem is that you use P in parameters, but p in Eq[2].

More serious is it that you expect Maple to find the solution to the 5th order equation which diff(r(rho),rho) satisfies according to Eq[1].

That Maple reports


Error, (in DEtools/convertsys) unable to convert to an explicit first-order system

doesn't surprise me one bit.

tf1 is a module which among other things exports 'tf'

type(tf1,`module`);
                              true
exports(tf1);
tf, inputcount, outputcount, statecount, sampletime, discrete, systemname, inputvariable, outputvariable, statevariable, systemtype, ModulePrint

So try,

tf1:-tf[1,1];

or

tf1:-tf;

To get an expression on a particular form can be very difficult and next to impossible for several reasons.

Even writing down the answer you want as input:

(1-(omega/omega[n])^2)^2+ (2*epsilon*omega/omega[n])^2;

will result in a slightly different form and can only be avoided by somewhat artificial means.

The following ad hoc method accomplishes some of what you want:

S,R:=selectremove(has,den, epsilon);
factor(R)+S;

But since you know what you want, I suggest subtracting the two versions from each other to confirm that they are equal.

The primary purpose of Maple after all, is not word processing.

If you use solve instead of fsolve you will find 24 imaginary solutions.

If you try fsolve({ee}, complex) you will get one of them,

{x12 = -.3436403369+.2379982525*I, x21 = -.4643201521+.1014536939*I, x22 = -1.370173079+1.136597450*I, y11 = -.1348660900-.5550624325*I, y12 = -.4429607321-0.1563727711e-1*I, y21 = -1.262993665-1.633138471*I, y22 = -1.004590271+.4561076626*I}

The other imaginary solutions could also be found by providing start values for the unknowns.

The result of

with(RootFinding):
HasRealRoots(convert~({ee},rational));

is false.

So if you were expecting real solutions, the conclusion is that there aren't any.

As Robert Israel pointed out there are apparently no solutions.

The solutions Maple finds are the same ones that it finds when solving

(x*h11-2*y*h1+z*h)^3*eqs

thus it ignores that the denominator (x*h11-2*y*h1+z*h)^3 in the normalized equations in fact is zero for the solutions found.

You may try the following lines:

restart;
k := 1/(x*h11-2*y*h1+z*h);
eqs := normal([2*k^2*P1*(y^2-x*z)*(H1*k*z*P1+h11*H11) = 0, 2*k^2*P1*(y^2-x*z)*(x*k*H1*P1+h*H11) = 0, -4*h1*H11-4*H11*k^2*P1*(y^2-x*z)*(h1-y*k*P1) = 0]);
sol:=solve(eqs, [x, y, z],explicit);
simplify(eval(eqs,sol[1]));
indets(eval(eqs,sol[1]),algebraic^(-3));
expand(%);
eqs2:=simplify(map2(`*`,(x*h11-2*y*h1+z*h)^3,eqs));
sol2:=solve(eqs2, [x, y, z],explicit);
simplify(eval(eqs2,sol[2]));
simplify(eval(eqs2,sol[1]));

 

Or the following, where random integer values in the range 1 .. 10 are chosen for the parameters.

Here Maple finds no solution.

restart;
r:=rand(1..10);
k := 1/(x*h11-2*y*h1+z*h);
eqs := normal([2*k^2*P1*(y^2-x*z)*(H1*k*z*P1+h11*H11) = 0, 2*k^2*P1*(y^2-x*z)*(x*k*H1*P1+h*H11) = 0, -4*h1*H11-4*H11*k^2*P1*(y^2-x*z)*(h1-y*k*P1) = 0]):
param:=convert(indets(eqs,name) minus {x,y,z},list);
param2:=zip(`=`,param,['r()'$6]);
eqskonk:=eval(eqs,param2);
sol:=solve(%, [x, y, z],explicit);

Try removing the following line, which contains the first occurrence of 'Section*:

<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60">

Then remove one of the tags </Section> at the very end of the worksheet.

Now you will have something. Maple still complains, but there is still a lot there.

You could try

with(plots):
conformal(z,z=-2*I..2+2*I,scaling=constrained):

plots:-conformal(z,z=-2*I..2+2*I,scaling=constrained)
conformal(z^2,z=-2*I..2+2*I,scaling=constrained):

plots:-conformal(z^2,z=-2*I..2+2*I,scaling=constrained)
display(Array([%%,%]));

Since it is indeed an automatic simplification, which is revealed by doing

'(a*b/c)^2*d';

(notice the unevaluation quotes) this can only be prevented by artificial means, like e.g.

``(a*b/c)^2*d;

expand(%); will give you back a^2*b^2*c^(-2)*d.

I suppose that a procedure could be written that somehow rewrote terms like a^2*b^2*c^(-2)*d as

``(a*b/c)^2*d;

###INSERTED later:

Since suggesting that a procedure could be written, I tried for a while and came up with the following, which most likely could be done in a more elegant way.

p2:=proc(u::algebraic) local u0,u1,u2,u3,u4;
    if type(u,`+`) then
       map(procname,u)
    elif type(u,`*`) and member(true,map(type,{op(u)},{name^2,name^(-2)})) then
       u0:=evalindets(u,function,freeze);
       u1:=evalindets(u0,{algebraic^2,algebraic^(-2)},x->``(sqrt(x,symbolic)));
       u2,u3:=selectremove(type,u1,specfunc(algebraic,``));
       u4:=thaw(``(eval(u2,``=(()->args)))^2*u3);
       evalindets(u4,specfunc(name,``),expand);
    else
       u
    end if
end proc;

u:=a^2*b^2/c^2*d+A^4*y^2*a/B^2*sin(x)+sin(y^2*a)+ln(x)*k^2/c^2+56*v^2+(x+y)^2/c^2;

p2(u);

which results in

(a*b/c)^2*d+(y/B)^2*A^4*a*sin(x)+sin(y^2*a)+(k/c)^2*ln(x)+56*v^2+((x+y)/c)^2

Taking hirnyk's infinite summation example

res1:=int(sum(x^(2*k+1), k = 1 .. infinity)*sqrt(1-x), x = 0 .. 1);

#Numerical check of the result
res1num:=evalf(Int(sum(x^(2*k+1), k = 1 .. infinity)*sqrt(1-x), x = 0 .. 1));
evalf(res1);

#This is not really an infinite summation example since Maple first computes the sum:

sum(x^(2*k+1), k = 1 .. infinity);
# and gets the expected x^3/(1-x^2).
#After that it integrates x^3/(1-x^2)*sqrt(1-x) from 0 to 1.

#Now using an inert summation:

res2:=int(Sum(x^(2*k+1), k = 1 .. infinity)*sqrt(1-x), x = 0 .. 1);
#We first see that Maple integrates term by term.
#Then we ask for the value of the inert sum (i.e. replacing Sum by sum):
res3:=value(res2);
#Checking:
evalf(res2);
#And the following which takes a while
evalf(res3);
#Result 40.93509538-3.479299454*I

#We see (Maple 14) that res3 or its numerical evaluation is wrong!

#Step by step:
igr:=combine(Sum(x^(2*k+1), k = 1 .. infinity)*sqrt(1-x));
IntegrationTools:-Expand(Int(igr,x=0..1));
applyop(Int,1,igr,x=0..1);
applyop(value,1,%);


You did say you wanted a table, but if you meant it to look like one you might try:

a:=plot(x^2,x=-2..2):
#Two variants of the definition of the list of lists of points [x,y]:
#M:=op(indets(a,listlist)):
M:=op([1,1],a):
interface(rtablesize=infinity);
Matrix(M);

This will work:

 

plotoversurface:=proc(p1,s1)
  local a,b,to3d,c,f:
  a:=plot3d([s1],x=-10..10,y=0..100,style=patchnogrid):
  b:=plot(p1,x=-10..10):
  f:=unapply([x,y,s1],x,y);
  to3d:=plottools:-transform(f):
  c:=to3d(b):
  plots:-display({a,c})
end proc:

Change the last line of the procedure 'discont' which reads like this

remove(type,disc,nonreal)

to

remove(hastype,disc,nonreal)

This can be done like this:

Discont:=subs(type=hastype,eval(discont));

The problem is that type nonreal does not include expressions like (1/2*I)/(Pi*_Z1).

I am not necessarily saying that it would be a good idea in general, though.

Converting your expression to 1D-input (I never, ever, use anything else) you get the result you presumably want.

T := RL/(j*omega*Cp*(RL-I/(omega*Cp))*(R/(j*omega*C[s]*(R-I/(omega*C[s])))+RL/(j*omega*Cp*(RL-I/(omega*Cp)))));
simplify(T);

#If your variable RL is actually R*L then:
T := R*L/(j*omega*Cp*(R*L-I/(omega*Cp))*(R/(j*omega*C[s]*(R-I/(omega*C[s])))+R*L/(j*omega*Cp*(R*L-I/(omega*Cp)))));
simplify(T);

What happens in 2D I don't care to speculate about.

To answer your last question, you could do like this:

works := proc(p) local res;
     if(p<0) then
         res:=convert(rtable(1..3, {1=2*p, 2=2.7, 3=p^2}), Vector);
     else
         res:=Vector([-1,2,p*p]);
     end if;
 CodeGeneration[C](res);
 end proc:
works(5);
cg0[0] = -1;
cg0[1] = 2;
cg0[2] = 25;

But then the converting is superfluous, because the translation is not on a procedure, but on the rtable, where (as you noticed) there is no problem:

works2 := proc(p) local res;
     if(p<0) then
         res:=rtable(1..3, {1=2*p, 2=2.7, 3=p^2});
     else
         res:=Vector([-1,2,p*p])
     end if;
 CodeGeneration[C](res)
 end proc:
works2(-5);
cg2[0] = -10;
cg2[1] = 0.27e1;
cg2[2] = 25;

From the help page 'Notes on Code Translation Using the CodeGeneration Package':

"The CodeGeneration functions can analyze some rtable type declarations and constructors within procedures.  Data types, dimensions and ranges are recognized, but most options are ignored.  The only initializer accepted is a list. "

Not even this works:

xpr_3 := proc (p)
     rtable(1 .. 2, {1 = 1, 2 = 1})
 end proc:
CodeGeneration[C](xpr_3);

But this does:

xpr_3 := proc (p)
     Vector([1e-3+4*p^2,-3*p,6,8*p^2,2*p,1666.666667])
 end proc;
CodeGeneration[C](xpr_3);

First 147 148 149 150 151 152 153 Last Page 149 of 158