Preben Alsholm

13663 Reputation

22 Badges

19 years, 339 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@Axel Vogt Yes, indeed. That was a long time ago.
The procedure is here:
 

PolarForm:=proc(tal::{algebraic,list,set},e::name:='useexp')
description "Input a complex number or a list or set of complex numbers. Output the polar form r*'exp'(I*v)
or, if 'useExp' is given as a second argument, r*Exp(I*v)";
local EXP;
if type(tal,{list,set}) then return map(procname,tal,e) end if;
if type(tal,specfunc(anything,polar)) 
   then 
      if e='useExp' then op(1,tal)*Exp(I*op(2,tal)) else op(1,tal)*'exp'(I*op(2,tal)) end if
   else
procname(radnormal(polar(tal)),e)
end if
end proc;

`print/Exp` := proc(z) 'e'^z end proc;
## Examples:
PolarForm(1+I);
%;
PolarForm(1+I,useExp);
%;
eval(%,Exp=exp);
PolarForm([1+I,I,5,-3+1/2*I]);
%;
PolarForm([1+I,I,5,-3+1/2*I],useExp);

Actually, I also added this simple extension of value:
 

`value/Exp`:=proc() exp(args) end proc:
### Example
PolarForm(1+I,useExp);
%;
value(%);

 

In Maple 2024 solve treats this equation the same as in Maple 2018.

@nm I happen to be in the beta forum. I'll report this as a weakness and give a link to this page.

Note: SCR submitted.

@nm In my reply I incorrectly referred to the statement listed for definite integration. I have now corrected that.
About method = _RETURNVERBOSE the statements under definite and indefinite integration are identical.

method=_RETURNVERBOSE applies all of the known methods and reports the results for each.

It is puzzling why the "default" result isn't identical to the _DEFAULT result.
So, yes, I agree that that is strange.

But try this:
 

int(integrand,x,method=default);

Output: 2*arctan(tan(1/2*x)) + 2/(tan(1/2*x) + 1)

So method = default is different from method =_DEFAULT.

Correction: The following statement is about definite integration:
In the help page for Integration Methods we find this somewhat cryptic statement:
method=_DEFAULT forces use of the default integration method.  It runs all of the integrators in sequence and returns the first answer found.

 

Under Indefinite Integration it says

method=_DEFAULT is equivalent to not specifying a method, exactly like definite and numeric integration.

But try this:
 

restart;
integrand:=sin(x)/(sin(x) + 1);
maple_result_1 :=int(integrand,x);
int(integrand,x,method=_DEFAULT);

The results are exactly the same.

Actually no assumptions are needed:
 

#But this is a solution
SOL:=y(x)=2*arctan(1+x)+Pi/2;
odetest(SOL,[ode,ic]) ;

 

@Mathrookie94 I played a little with it. Notice that the exponential terms in sol like exp(17/2500 - 17/2500*x)
can be split since exp(x+y)=exp(x)*exp(y):
Thus we can do:

expand(sol);
evalf(%);

You will see that the constant part exp(17/2500) becomes just a float.
You get
f(x) = 426.8577244 + 300.733958*exp(-0.006800000000*x) - 48.5791876*exp(-0.01020000000*x) - 620.5737973*exp(-0.003400000000*x)

Please upload a worksheet instead of or in addition to a screenshot.

Go to the fat green uparrow in the editor you use to post questions, answers, or replies.

I have seen other cases where it pays to consider a more general version.
Anyway, here are two animations in b. The first shows that of the 2 solutions found only the second solves the equation on some interval.
 

restart;
sol:=int(1/sqrt(sin(y)),y);
solve(sol=x+b,y):
res:={%};
numelems(res); #2
res1b:=simplify(eval(sol-x-b,y=res[1]));
res2b:=simplify(eval(sol-x-b,y=res[2]));
plots:-animate(plot,[res1b,x=-10..10],b=-5..5,trace=24);
plots:-animate(plot,[res2b,x=-10..10],b=-5..5,trace=24);

Here is an image of the end of animation 2:

@charlie_fcl I only had to fight to get rid of the .txt in maple.ini.txt.

When I did your worksheets ran.

@charlie_fcl Yes, but there are significant changes made in Maple 2024.

Is rtable_alias documented anywhere?

@Mathrookie94 You only have to do this:

DEtools:-DEplot(ODE,y(t),t=0..350,[y(0)=449],y=0..2000);

where ODE is:

ODE := diff(y(t), t) = -0.000032229*y(t)^2 + 0.065843*y(t) - 15.103;

Obviously, if you have another ode you will want to change the numbers in the first line.
Thus t=0..350, [y(0)=449], and y=0..2000 may be different.
If the dependent variable isn't y(t), but say x(s), you will have to change t to s and y to x.
Here is an example:

restart;
ode:=diff(x(s),s) = -(1 - 2*x(s))*(1 - x(s))*x(s);
#There are 3 constant solutions: x(s) = 0, x(s)=1/2, and x(s) = 1.
#They make the right hand side of ode equal to zero.
#The 3 constant solution and 4 other solutions are plotted here:
DEtools:-DEplot(ode,x(s),s=0..8,
   [x(0)=0,x(0)=1/2,x(0)=1,x(0)=-1/2,x(0)=1/4,x(0)=3/4,x(0)=3/2],x=-1/2..3/2);

Since you are able to use pointplot right after restart, i.e. you don't need plots:-pointplot, you must have a maple.ini file or some start up code.

So what is in that?

@mmcdara I agree.  In fact why should Maple do anything to 1h and 5 min. I myself like that better than 65 min.

@nm Very nice. I would, however, add one requirement:
 

if not has(eq,diff) or not T::`+` or not has(eq,yx) then return eq end if;

Your test case number 2 isn't an ode in y(x) so ought not be handled as such in my view.

The same can be written:

if not ( has(eq,diff) and T::`+` and has(eq,yx) ) then return eq end if;
1 2 3 4 5 6 7 Last Page 2 of 229