Preben Alsholm

13613 Reputation

22 Badges

19 years, 229 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

Using allvalues as Axel Vogt suggested, but also add, which is suited for adding finite sums:

restart;
ode:=diff(y(x),x) = (x*y(x)+x^3+x*y(x)^2+y(x)^3)/x^2;

rts:=[allvalues(RootOf(27*_Z^3-9*_Z+29))];
sol:=exp(3*add(1/(9*j^2-1)*ln((-j*x+y(x)-1/3*x)/x),j = rts))-c__1*exp(x) = 0;

indets(sol,function(name));
#odetest(sol,ode); # Does it ever finish?

ode2:=diff(u(x),x)-1/2*(2*a*u(x)^3+u(x)+2*b)/x = 0;

rts2:=[allvalues(RootOf(2*_Z^3*a+_Z+2*b))];
sol2:=2*add(1/(6*j^2*a+1)*ln(u(x)-j),j =rts )-1/2*ln(x)-_C1 = 0;

indets(sol2,function(name));
#odetest(sol2,ode2); # Does it ever finish?

No complaint when actually trying odetest. 
Your original version run in Maple 2024 Beta has the same error when using odetest:

Error, (in simplify/RootOf) too many levels of recursion
One might prefer that error message to a process that runs forever.

@sand15 It doesn't work in Maple 2023.2, but works in Maple 2024.0 Beta.

That said, I think it is better to use add than sum in cases where the limits are numeric values.
In the present case I'm assuming that S(N,x) will only be applied if N is of type numeric.

You are first making assumptions on a sequence of names (about them being real).
Then in the next line you are again making assumptions about those names, this time involving inequalities.
The first assumptions are wiped out totally by the second, but in your case your second assumptions, being inequalities, imply that the names are assumed real.
Try about(gamma); after the second assume.
Then try commenting out the first assume, and then run the lines from restart to 'about'.
The about(gamma) message is in both cases:

Originally gamma, renamed gamma~:
  is assumed to be: RealRange(0,infinity)

See ?assume, where you will find the following lines:

When the assume function is used to make an assumption about an expression x, all previous assumptions on x are removed. For example, if you enter assume(x>0) then assume(x<0), there is no contradiction.  Similarly, assume(0<x) followed by assume(x<1) is not equivalent to assume(0<x, x<1).

 

@mmcdara Thanks for your explanation. I think I understand your situation.

I will here give some rather arbitrary examples of algebraic expressions where the same integral appears several times, but with different names for the integration variable.

restart;
J1:=Int(f(x),x=0..1)/Int(f(y),y=0..1);
simplify(J1);
J2:=sin(Int(f(x1),x1=0..1))/Int(f(y1),y1=0..1);
simplify(J2);
J3:=G(Int(f(x2),x2=0..1))/H(Int(f(y2),y2=0..1));
simplify(J3);
J1*J2*sqrt(J3);
simplify(%); 
inds:=indets(J1*J2*sqrt(J3),specfunc(Int));
simplify(inds); # No change. inds is a set, so not of type algebraic 

My guess is that in code handling algebraic expressions involving several integrals that are actually equal except for appearance, it could save time because only one integral need be computed.

PS. I'm glad that a name like you mention _t123 is not introduced.

@Carl Love It is good to have other options. I prefer 'thistype' though.

@dharr I guess that kencom1 uses inf as a substitute for infinity.
For inf:=3
odeplot(S1,[y,u[1](y)],0..inf); 
gives us:

and for inf:=10 we get:

Thus kencom1 has more work to do.

@Carl Love That is very nice!

@C_R acer simply defined N as op. Try this:
 

restart;
`print/op`:=()->Typesetting:-Typeset(args):


mass := %op(1) * Unit(m);
value(mass);


mass2 := %op(1) * Unit(cm);
mass + mass2;
simplify(value(%));

Any procedure p becomes inert if preceded by %:
Simple example:
 

p:=proc(x) x*sin(x) end proc;
p(t);
%p(t);
value(%);

See the help page ?%inert, where it says:

You can also make any Maple function inert by prefixing it with the % symbol.

By 'function' is meant a procedure like sin, whereas sin(x) is not. sin(x) is, however, of type function in Maple. Confusing, yes, but it has been the lingo in Maple forever.

@C_R In 1D (aka Maple notation), but NOT in 2D, you can use:
 

f:= k -> local i; add({seq(ifelse(floor(k/i)=k/i,i,0),i=1..k-1)});
f(945);

This works in recent releases, e.g. also in Maple 2021.
In Maple 12 I just tried ? `if`. Up came the help page The Selection (Conditional) Statement and Operator.
About the if operator it says:

if operator
     `if`(conditional expression, true expression, false expression)

@C_R You could do like this to make your version perfectly clear:
 

restart;
g:= k -> {seq(ifelse(floor(k/i)=k/i,i,NULL),i=1..k-1)};

g(945);
add(g(945));

 ifelse doesn't exist in Maple 13, but `if` certainly does.
Here is a version that works in Maple 12 and therefore surely in Maple 13:

restart;
g:= k ->seq(`if`(floor(k/i)=k/i,i,NULL),i=1..k-1);

g(945);
`+`(g(945));  #not using add


 

@dharr Thanks to you for pointing to the right place.
Now I'm logged in.

@sursumCorda My guess is the opposite: With _EnvLinalg95:=true some use may be made of the old linalg package in computing output from some LinearAlgebra commands.

How did you come to know about the existence of _EnvLinalg95?
I never heard of it before.

Could _EnvLinalg95 have something to do with the old linalg package? The number 95 could refer to the year 1995.
So setting _EnvLinalg95:=true could mean that you now work in an environment where use is made of that old and deprecated package.
If you try with(linalg);  you get the contents. There doesn't seem to be any command like EigenConditionNumbers, thus the LinearAlgebra version is used.

@ I tried method=Parts on both examples in Maple 2023.2 as mentioned by Igor Proskurin.
Specifically:
 

res:=int(integrand,t,method=Parts):
res2:=int(integrand2,t,method=Parts):
simplify(integrand-diff(res,t)); # 0
simplify(integrand2-diff(res2,t)); # 0

 

@Preben Alsholm The seven points remained as I feared.
Any reference to the question seems to be gone, which is a good.
 

First 6 7 8 9 10 11 12 Last Page 8 of 229