Preben Alsholm

13728 Reputation

22 Badges

20 years, 251 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

Carl, I admit to not knowing about `?()`. Could you give me a reference?
It seems to do the same as
map(apply,gg,2);

######################
In the programming guide (3.6) I see for `?[]` the description:
"The constructor for indexed expressions is the name ?[]."
with the example
`?[]`( S, [ a, b, c ] );

So I suppose that `?()` similarly is the constructor for function application?

Carl, I admit to not knowing about `?()`. Could you give me a reference?
It seems to do the same as
map(apply,gg,2);

######################
In the programming guide (3.6) I see for `?[]` the description:
"The constructor for indexed expressions is the name ?[]."
with the example
`?[]`( S, [ a, b, c ] );

So I suppose that `?()` similarly is the constructor for function application?

I submitted an SCR yesterday following the format used. But the essence is this:
restart;
assume(mu>0,k>0,nn>0); #nn used later
s:=sqrt((k*mu)^(1/4)/x);
a:=s*(k*mu-sqrt(k*mu));
b:=s*k;
c:=sqrt(k/mu)*s;
V:=(b-a/mu)/c;
simplify(V);
map(simplify,V); #OK
simplify(eval(V,{k=213})); #OK
for x in [1,2,213,0.12345,Pi,sqrt(2),gamma,nn] do [x,simplify(V)] end do;

restart;
s:=sqrt((k*mu)^(1/4)/x);
a:=s*(k*mu-sqrt(k*mu));
b:=s*k;
c:=sqrt(k/mu)*s;
V:=(b-a/mu)/c;
simplify(V) assuming positive;
simplify(simplify(V),assume=positive);
######################################
#Actually a safer test than the first seems to me to be:
restart;
assume(mu>0,k>0,nn>0);#nn used later
for x in [1,2,213,0.12345,Pi,sqrt(2),gamma,nn,mu,mu^2,k,k^2] do
   s:=sqrt((k*mu)^(1/4)/x);
   a:=s*(k*mu-sqrt(k*mu));
   b:=s*k;
   c:=sqrt(k/mu)*s;
   V:=(b-a/mu)/c;
   print([x,simplify(V),map(simplify,V)]);
end do:



I submitted an SCR yesterday following the format used. But the essence is this:
restart;
assume(mu>0,k>0,nn>0); #nn used later
s:=sqrt((k*mu)^(1/4)/x);
a:=s*(k*mu-sqrt(k*mu));
b:=s*k;
c:=sqrt(k/mu)*s;
V:=(b-a/mu)/c;
simplify(V);
map(simplify,V); #OK
simplify(eval(V,{k=213})); #OK
for x in [1,2,213,0.12345,Pi,sqrt(2),gamma,nn] do [x,simplify(V)] end do;

restart;
s:=sqrt((k*mu)^(1/4)/x);
a:=s*(k*mu-sqrt(k*mu));
b:=s*k;
c:=sqrt(k/mu)*s;
V:=(b-a/mu)/c;
simplify(V) assuming positive;
simplify(simplify(V),assume=positive);
######################################
#Actually a safer test than the first seems to me to be:
restart;
assume(mu>0,k>0,nn>0);#nn used later
for x in [1,2,213,0.12345,Pi,sqrt(2),gamma,nn,mu,mu^2,k,k^2] do
   s:=sqrt((k*mu)^(1/4)/x);
   a:=s*(k*mu-sqrt(k*mu));
   b:=s*k;
   c:=sqrt(k/mu)*s;
   V:=(b-a/mu)/c;
   print([x,simplify(V),map(simplify,V)]);
end do:



To get a slightly more general solution you could change A to:
f:=unapply(z,x,y);
A := textplot([seq([fsolve(f(x,-3+.5*k)=L[k],x), -3+.5*k, L[k], align = right], k = 1 .. 10)]):

To get a slightly more general solution you could change A to:
f:=unapply(z,x,y);
A := textplot([seq([fsolve(f(x,-3+.5*k)=L[k],x), -3+.5*k, L[k], align = right], k = 1 .. 10)]):

Indeed wrong considering the fact that the expression is an operand in a Sum, where k ought to be considered an integer.
However, the simplified expression is not all bad:

eval(p(1),r=1);
ex1:=op([2,2,1],%);
limit(ex1,k=0)+limit(ex1,k=1);
#with result 1/2.

Indeed wrong considering the fact that the expression is an operand in a Sum, where k ought to be considered an integer.
However, the simplified expression is not all bad:

eval(p(1),r=1);
ex1:=op([2,2,1],%);
limit(ex1,k=0)+limit(ex1,k=1);
#with result 1/2.

Use value instead of simplify (or sum as you comment yourself):

value(eval(p(1),r=1));

But I don't know why simplify returns 1.

In looking into this I stumbled upon what clearly seems to be a bug.
This is your system sys with the same initial and boundary conditions.
restart;
sys := {diff(T(x, t), t) = diff(T(x, t), x, x)+(diff(u(x, t), x))^2, diff(u(x, t), t) = diff(u(x, t), x, x)};
BCs := {u(0,t)=sin(t), u(10,t)=0,T(0,t)=1, T(10,t)=0,u(x,0)=0,T(x,0)=0};
pds := pdsolve(sys, BCs, numeric, spacestep=1/50);
pds:-plot(T(x,t), x=0, t= 0..2*Pi); #OK
pds:-plot(u(x,t), x=0, t= 0..2*Pi); #OK
val:=pds:-value(output=listprocedure);
#The following ought to be a safe way to extract procedures for T(x,t) and u(x,t):
TT,uu:=op(subs(val,[T(x,t),u(x,t)]));
#However, somehow u and T got switched:
plot(TT(0,t),t=0..2*Pi); #plots u(0,t) !
plot(uu(0,t),t=0..2*Pi); #plots T(0,t) !
#When giving the dependent specifications u and T are in order:
valTU:=pds:-value([T(x,t),u(x,t)],output=listprocedure);
TT,uu:=op(subs(valTU,[T(x,t),u(x,t)]));
plot(TT(0,t),t=0..2*Pi);
plot(uu(0,t),t=0..2*Pi);

As in your question
http://www.mapleprimes.com/questions/149888-Why-Cannot--Maple-Solve-This-System
there is only the trivial solution f(t) = 0.
To check the result you can (with either version of ode) do
dsolve(ode[2]);
odetest(%,ode[3]);
collect(%,t,factor);
This has to be zero on an interval, from which it follows  that _C1 = 0, so f(t) = 0 all t, and thus u is constant.
I don't understand your talk about a triangle. If t is one side, sqrt(1-t^2) is  another, what are f and u?

Actually I tried `$`, but wouldn't have thought of trying ` $`.
As a third illustration the following two attempts to define procedures result in the same kind of error message.
p:=proc(` $`,$) ` $` end proc;
Error, parameter `` $`` is declared more than once in procedure p
q:=proc(x,x) x end proc;
Error, parameter `x` is declared more than once in procedure q



Actually I tried `$`, but wouldn't have thought of trying ` $`.
As a third illustration the following two attempts to define procedures result in the same kind of error message.
p:=proc(` $`,$) ` $` end proc;
Error, parameter `` $`` is declared more than once in procedure p
q:=proc(x,x) x end proc;
Error, parameter `x` is declared more than once in procedure q



Although this is related to something discussed in another thread, I think you ought to formulate the question here and in doing so make it as specific as possible.

@Markiyan Hirnyk So you are back to your old self.

First 165 166 167 168 169 170 171 Last Page 167 of 230