nm

8552 Reputation

19 Badges

13 years, 32 days

MaplePrimes Activity


These are questions asked by nm

Maple 2018.2 generates wrong latex in this example. In Latex a space in command name is important. So "\tau L" is not the same as "\tauL".  Since in the later case, Latex will complain that there is no command "\tauL"

Maple generates "\tauL" in the latex, when it should be "\tau L" in the following example, so the latex fails to compile because there is no command called "\tauL" in Latex.

Here is screen shot showing the problem and the Maple command to reproduce it

 

 

restart;
interface(showassumed=0);
pde :=  diff(u(x,t),t)=k*diff(u(x,t),x$2)+(exp(-c*t)*sin(2*Pi*x/L));
ic  :=  u(x,0)=f(x);
bc  :=  D[1](u)(0,t)=0, D[1](u)(L,t)=0;
sol:=pdsolve({pde,ic,bc},u(x,t)) assuming L>0,t>0,k>0;

latex(sol)

Any chance Maplesoft could fix this?

Possible workaround for now is to use something like "\newcommand{\tauL}{\tau L}" in preamble for this specific case.

 

This code used to work OK in an earlier version of Maple 2018. I do not know what changed and if it some change in Physics package that caused it.

restart;
pde:=diff(u(r,theta),r$2)+1/r*diff(u(r,theta),r)+1/r^2*diff(u(r,theta),theta$2)=0;
bc:=u(r,0)=0,u(r,Pi)=0,u(0,theta)=0,u(1,theta)=f(theta);
sol:=pdsolve([pde,bc],u(r,theta),HINT = boundedseries(r = 0));

Now it gives the error 

Error, (in assuming) when calling 'assume'. Received: 'invalid arguments'

Workaround is to remove the HINT above. So the following now works

restart;
pde:=diff(u(r,theta),r$2)+1/r*diff(u(r,theta),r)+1/r^2*diff(u(r,theta),theta$2)=0;
bc:=u(r,0)=0,u(r,Pi)=0,u(0,theta)=0,u(1,theta)=f(theta);
sol:=pdsolve([pde,bc],u(r,theta));

Should this error message show up when using the HINT option?

Maple 2018.2 with Physics package cloud version 205.

Here is screen shot showing it was working in Physics 170

 

 

When dsolve throws an error, is it always due to invalid user input, such as parsing error of some sort related to the input given to it, or could it throw an error not related to the parsing part? And if so, how would one know, in code, the difference between an error thrown due to parsing error, vs. something else?

For example, this will throw an error due to parsing

 

ode:=diff(y(x),x)+y;
try
   dsolve(ode,y(x));
catch:    
    print(StringTools:-FormatMessage( lastexception[2..-1] )); 
end try;

   "y(x) and y cannot both appear in the given ODE."

I want to check programmatically, if and when an error thrown by dsolve, if it is due to input itself being invalid, such as parsing error, or invalid initial conditions, and such bad input from the user, vs. other possible error that could be generated internally for other reasons when the input is valid.

I looked at help and there is no mention of what type of exceptions dsolve can throw, or how would would determine the type of exception, as Maple exceptions seem to be just strings and there is no actual identifier or type associated with them to use to check on.

I also looked at https://www.maplesoft.com/support/help/Maple/view.aspx?path=ErrorMessageGuideOverview  and seen nothing there that helps. It just says
 

There are three circumstances that would generate an error in Maple:

1. 	User Errors - the user has supplied incorrect input
2. 	No Solution - in some cases, a Maple routine will issue an error, indicating that the given problem has no solution
3. 	Maple Errors - Maple generates an error during internal computation in response to a problem with its own code

Great., But it does not say how a would a user know which is which when an error is thrown? (using code, not by looking at the screen and then using google).

In Mathematica for example, error messages have actual names, and one could check for the actual message tag itself in the code, to find what the error actually is, instead of using just a plain string of the error message. 

Does Maple have such a thing to use to help find what class of error was thrown out the above three classes shown in the above web page?

 

How could one tell Maple to simplify  log(x)+log(y) to log(x*y)?

As Maple own apps says  https://www.maplesoft.com/support/help/maple/view.aspx?path=MathApps%2FProductRuleForLogarithms

And known identity  https://en.wikipedia.org/wiki/List_of_logarithmic_identities

 

This is what I tried

restart;
simplify( ln(x) + ln(y), symbolic);
simplify( ln(x) + ln(y), ln);
simplify( ln(x) + ln(y), size);

Maple knows this identity, becuase

simplify( ln(x*y)- (ln(x)+ln(y)) , symbolic)
       0

Note, this identity has no assumptions on it. It is defined as is.

Maple help page says

ln(x y) ==> ln(x) + ln(y) provided     0 < x  and   signum(y) is unknown

so, is Wikipedia and all the other references I saw wrong for not showing this assumption on x>0 whey they state the product rule for logs?

I want to go the other way

 ln(x) + ln(y) ==> ln(x y) 

So this releation should really be written as

ln(x) + ln(y) <==> ln(x y) 

 

is there a way to change the color of just the labels on the axis ticks only? 

I wanted to do this for DEplot, but I started with normal plot since it is easier. I could change the colors of the axis, but this changes not only the tick labels but the whole axis itself:

restart;
plot(sin(x),x=-Pi..Pi,axis=[tickmarks=[color=red]], color=blue);

So the axis itself changed color as well. It is OK for the ticks as well as the ticks labels (the numbers of the ticks). But prefer the axis itself not to be red.

Once there is a way to do the above, I wanted to apply to DEtools:-DEplot. Why? Becuase it is hard to read the Axis tick labels on DEplot. I thought that changing the color of the tick labels will it easy. But DEtools:-DEplot does not even accept axis command:

ode:= diff(y(x),x)=2*x:
DEtools:-DEplot(ode,y(x),x = -2 .. 2,y = -2 .. 2, [[0.1,0]],
               labels=["",""],
               linecolour = red,
               color = blue,
               'arrows' = 'medium',
               axesfont=['Times', 'bold', 12]
               );

 

You can see it is hard to read the axis tick labels above, as arrows go over some of them,. If I make them say RED, I think it will make it more clear.

Now when adding the axis options, it gives error

DEtools:-DEplot(ode,y(x),x = -2 .. 2,y = -2 .. 2, [[0.1,0]],
               linecolour = red,
               color = blue,
               arrows = MEDIUM,
               axesfont=['Times', 'bold', 10],
               axis=[tickmarks=[color=red]]
               );

Error is generated, axis is not supported command.

Any idea how to make tick labels red for DEtools:-DEplot? It will be OK if I can get both the axis and the ticks RED, at least it will be better than it is now.

One workaround way I currently use is this:

ode:= diff(y(x),x)=2*x:
p1:=DEtools:-DEplot(ode,y(x),x = -2 .. 2,y = -2 .. 2, [[0.1,0]],
               labels=["",""],
               linecolour = red,
               color = blue,
               'arrows' = 'medium'                    
               );
p2:=plot(0,x=-2..2,y=-2..2,axis=[tickmarks=[color=red]]);
plots:-display([p2,p1]);

 

But this seems like a hack to me. There should be a way to directly set tickmarks color in DEplot?

First 114 115 116 117 118 119 120 Last Page 116 of 164