Preben Alsholm

13728 Reputation

22 Badges

20 years, 249 days

MaplePrimes Activity


These are answers submitted by Preben Alsholm

Try a smaller range, e.g.
plot(thetaw, PP =0 .. 1);

As has been pointed out, there are som syntax issues. Besides what has been mentioned already by Thomas Richard, notice that you define m as an equation ( ... = 0) and yet you write (fsolve(m=0,...).

Change m to be an expression.

Did you intend the range to be -10^(-4) .. 10^4 or -10^(-4) .. (1.10)^4 ?

Assuming the former (and wider interval), try

plots:-complexplot(m*10^(-24),x = -10^(-4) .. 10^4,thickness=4);

You will see that for all practical purposes m is constant and has an absolute value of the order of magnitude 10^26.

You could also try
plot(log10(abs(m)),x = -10^(-4) .. 10^4,view=0..30);

eq1:=f1 = u1*f1 + u2*f2;
eq2:=f2 = u3*f1 + u4*f2;

with(LinearAlgebra):
T:=GenerateMatrix([eq1,eq2],[u1,u2,u3,u4],augmented);
#When f1 <> 0 the following are the solutions for the u-vector:
S:=LinearSolve(T,free=t);
#The special case f1 = 0:
T1:=GenerateMatrix(eval([eq1,eq2],f1=0),[u1,u2,u3,u4],augmented);
S1:=LinearSolve(T1,free=t);

http://www.mapleprimes.com/questions/143095-Huge-Expression-One-Term-By-Line-Into-Archivetxt

In that link I gave the answer. I was using ImportMatrix. Just change that to ImportVector.

I wrote:
restart;
A:=ImportMatrix("G:/MapleDiverse/MaplePrimes/archive.txt");
add(A[i,1],i=1..numelems(A));

restart;
with(inttrans):
#r := sqrt(2*p)*exp(p*t)/(i-1)!*Diff((t^(i-1))*exp(-2*p*t),t$(i-1));
#Since i-1 might be 0 we shall use this version:
r := sqrt(2*p)*exp(p*t)/(i-1)!*Diff((t^(i-1))*exp(-2*p*t),[t$(i-1)]);
L := laplace(r,t,s) assuming i::posint;
Ld:=convert(L,diff);
Ld; #Gives a surprising error (but see below)
#So we do a little work by ourselves:
Diff((t^(i-1))*exp(-2*p*t),[t$(i-2-k)]); #Using k for _U1
value(%) assuming k::nonnegint,i::posint;
eval(%,t=0);
value(%);
#Since we have that the powers of t involved are greater than 0 this result is correct.
#So the laplace transform is
L1:=eval(L,sum=0);
#Doing a check for i = 1:
eval(r,i=1);
laplace(value(%),t,s);
eval(L1,i=1);
#OK

#Workaround for the problem mentioned above:
LS:=subs(sum=Sum,L);
Ld:=convert(LS,diff);
value(%);

A semicolon is missing after the assignment to network.

I'm using the Standard Worksheet, but in worksheet mode and using 1D input (Maple notation). I'm also using Windows 7.

I admit that I did insert
display(rplot);
just before the command
plotsetup(ps, plotoutput = `myplot.eps`, plotoptions = `portrait,noborder`):
in order to see what to expect in the exported file before exporting.
I tried again after deleting the file myplot.eps and using a new copy of your code again with the semicolon added, but with no insertion of the aforementioned display. Then it didn't work.
When using copy and paste all is in one execution group. That seems to be the problem.
I tried once more copy and paste, inserted a split (using F3) between the second plotsetup and the lines above and doing nothing else but hit enter (not even supplying the semicolon). It worked!


If your expression is called w (you cannot assign to Easr3Vc*s2) and it is a sum of terms, then to inspect these terms it seems easiest to do a loop like this:

for i to nops(w) do op(i,w) end do;

To write these lines to a file you could do

M:=Matrix();
for i to nops(w) do M(i,1):=op(i,w) end do:
M[3,1];
#or simpler:
M:=Matrix(nops(w),1,(i,j)->op(i,w));

ExportMatrix("G:/MapleDiverse/MaplePrimes/archive.txt",M);

To retrieve w (in Maple):

restart;
A:=ImportMatrix("G:/MapleDiverse/MaplePrimes/archive.txt");
add(A[i,1],i=1..numelems(A));

Certainly you can define infix operators as in your image:

If f and g are procedures:
`&dl`:=proc(f,g) D(f)*g end proc;
`&dr`:=proc(f,g) f*D(g) end proc;
f &dl g;
sin &dl cos;
f &dr g;
#If the variable is known to be x and f and g are expressions in x:
`&dl`:=proc(f,g) diff(f,x)*g end proc;
`&dr`:=proc(f,g) f*diff(f,x) end proc;
f(x) &dl g(x);
sin(x) &dl cos(x);
f(x) &dr g(x);

######
But I don't see how to use that for accomplishing the intention in your last statement:

f exp(left_derivative_x right_derivative_x) g

In fact I don't understand it.

How about

cdn:=ilcm(op(denom~(n)));
n:=cdn*n;

and to get integer coefficients in the equation you can replace 1/k by cdn/k.

In ?fsolve,details you find the statement

"If the fsolve command does not find any solutions, it returns the empty sequence (NULL) or returns unevaluated. This means that there are no solutions, or the fsolve command cannot find any solutions."

Thus it is not stated what the difference is between the two.
In this (trivial) case, where there clearly is no solution:

fsolve(exp(x)=0,x);

the returned value is NULL.

But in this case, where clearly no solution exist either

fsolve(sin(x)*exp(x),x=1..3);

fsolve returns unevaluated.

Ideally, NULL should be returned if certifiably there isn't any solution, and fsolve should return unevaluated if there is a solution, but fsolve could not find it.
But can this be accomplished, or can it be accomplished in a reasonable amount of time in general?

Your system (with the unusual name of t):
t := diff(X(x), x) = -(1-6*R(x)^(1/2))^(1/2)*x*X(x)/(X(x)*x+R(x))^(1/2),
     diff(R(x), x) = (1-6*R(x)^(1/2))^(1/2)*x^2*X(x)/(X(x)*x+R(x))^(1/2);
init:=R(0) = 0, X(0) = 100;
#The obvious problem at x = 0 can be handled by taking the limit for x->0. On both right hand sides we get 0.
#Another problem occurs when 1-6*sqrt(R(x)) = 0.
#So here is a revised system:
sys:=diff(X(x), x)=piecewise(x>0 and 6*sqrt(R(x))<1,rhs(t[1]),0),
     diff(R(x), x)=piecewise(x>0 and 6*sqrt(R(x))<1,rhs(t[2]),0);
res:=dsolve({sys,init},[X(x),R(x)],numeric);
plots:-odeplot(res,[x,R(x)],0..0.5);
plots:-odeplot(res,[x,X(x)],0..0.5);

It should be
init:= R(0) = 0, X(0) = 100;

When using PDEtools:-Solve you need to give the variables [R(x),X(x)] as a second argument.
However, I don't know if you will have any luck with this approach.

As the following works, I wonder what the actual input to plot was.

f:=HeunG(3,-9/2+3/4*I*k-3/4*k^2,-1+1/2*I*k,-1/2+1/2*I*k,1/2,1+I*k,1/2);
f1:=diff(f,k);
plots:-complexplot(f1,k=0..2);

If  we let F be the result you posted above then attempts to evaluate results in an error:

evalf(eval(F,k=1.2345));
Error, (in simpl/abs) abs is not differentiable at non-real arguments

So the problem seems to be the presence of abs in your input and as a result also abs(1,..) in F:

indets(F,specfunc(anything,abs));

restart;
P:=Array(1..6,1..6,1..5,(i,j,k)->i*j*10^k); #Example

P[1..6,1..6,1];
Array([seq(P[1..6,1..6,i],i=1..5)]);

#Your code just needs 'copy':
L:= Matrix(1..6,1..6):

V:=Array(1..5):

for l to 5 do
  for i to 6 do
    for j to 6 do
      L[i,j] := P[i,j,l]  
    od
  od;
  V[l]:=copy(L)
od:

V;

First 108 109 110 111 112 113 114 Last Page 110 of 160