nm

11353 Reputation

20 Badges

13 years, 13 days

MaplePrimes Activity


These are replies submitted by nm

@itsme 

May be in the future Maple can add a Latex only option setting call. 

But setting imaginary unit in interface is not causing me any problem at all now, since I do this only inside the worksheet which runs a long script that I run which generates the Latex. This is not for interactive use.

Once the script is finished, I close the worksheet or click the restart bottom and Maple is back to normal setting for interactive use, where UpperCase I is better.

 

@Joe Riel 

You said "Note that the cancellation option is normally false; it is used to actively cancel pole/zero pairs that are within a given distance, set by the relativeerror option.  So that won't help you."

But that is not what the help page gives the impression. It says 

https://fr.maplesoft.com/support/help/Maple/view.aspx?path=DynamicSystems/SystemOptions

"The default value for the option cancellation, which determines whether pole-zero cancellation is applied to the transfer function of a system during creation. The default is false."

When reading the above, it seems to mean there is no pole/zero cancelation in the transfer function. There is no mention of relativeerror or such. 

I took the above to mean, if I enter tf 

tf:=(s - 1)/(s^2 - 3*s + 2)

which does have one pole/zero cancelation in it, since denomator factors to (s-1)*(s-2), then Maple DynamicSystem will not do the cancelation since the option is set to false.  But now it does. 

So may be help should make things more clear.  I also think DynamicSystem should not do pole/zero cancelation in this case, but it does now. 

tf:=(s - 1)/(s^2 - 3*s + 2);
DynamicSystems:-PrintSystem(DynamicSystems:-TransferFunction(tf))

@Joe Riel 

thanks for the workaround. But it is much more convenient to use transfer function (since this is how the textbook shows it) than having to manually convert to zpk form each time.

 

@Carl Love 

I am sorry, I am not following you when you say  "you'll still need to expand the denominator."

restart;
alias(DS=DynamicSystems):
DS:-SystemOptions(cancellation=false,complexfreqvar=s):
tf:=DS:-TransferFunction(-(s - 1)/expand(((-2 + s)*(s - 1)))):
DS:-PrintSystem(tf)

This simplification cause big problems in control system, since it gives different state space model.

I basically want to type the transfer function (as it shows in textbook) without it being simplified., i.e. pole/zero cancelation done. If you know how to do that, may be you could show me what exactly I needed to type?

Thanks

@Carl Love 

Actually it was expanded originally, and it still did the cancelation. I wrote it above in this form later on to make it clear the reader there is pole/zero cancelation.

alias(DS=DynamicSystems):
DS:-SystemOptions(cancellation=false,complexfreqvar=s):
tf:=DS:-TransferFunction(-(s - 1)/(s^2 - 3*s + 2)):
DS:-PrintSystem(tf)

Compare to 

Clear["Global`*"];
sys = TransferFunctionModel[-(s - 1)/(s^2 - 3*s + 2), s]

@itsme 

May be Physics:-Latex  should have its own options setting, done once at global level.

Having to add  imaginaryunit="i" at each call to Physics:-Latex() is a little too much work, but setting it at global level, where it only affects Latex generation, leaving normal Maple code as is, is a good idea.

This is how DynamicSystem does it also. It has it own option setting call. 

 

   https://fr.maplesoft.com/support/help/Maple/view.aspx?path=DynamicSystems%2fSystemOptions

 

@ecterrab 

As a temporary solution, one can also modify this in their latex as follows. By changing the definition in the peramble

\renewcommand{\textit}{\mathit}

And now 

y \left(x \right) = \textit{\_C1} {\rm e}^{\arctan \left(x \right)}

Will give same output as  when using \mathit

I think this should work but I need to try it on my main large file as well.

 

@ecterrab 

thanks. I did not know about interface(imaginaryunit) command. This solves the issue. I will add this at start of my script now.

 

@ecterrab 

Hello,

There is still a problem in V 788. Latex still generates \textit{Physics}:-* in some places. Please see below. it seems to happen when expression in denominator.  If I find anything more, will update.
 

restart;

interface(version)

`Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 2020 Build ID 1482634`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 788 and is the same as the version installed in this computer, created 2020, September 1, 11:0 hours Pacific Time.`

Physics:-Latex(1/(a*y^2))

\frac{1}{\textit{Physics}:-*\left({a , y^{2}}\right)}

latex(1/(a*y^2))

{\frac {1}{a{y}^{2}}}

 


 

Download latex_issue_7.mw

@ecterrab 

Thank you!  

I will try 788 as soon my current script is finished. If there is any issue I will make new post. I will be able to test 788 later today.

my latex_issue_4.mw was posted in one of my replies to earlier post:

https://www.mapleprimes.com/questions/230429-New-Issue-Using-PhysicsLatex--Changes 

But it is OK now. I had to change my code as I show in the above, to workaround it, and now it works. 

thanks

@ecterrab 

Thanks. When I tried it, it generates `\textit{Physics}`. What are these?  Please see below


 

interface(version)

`Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 2020 Build ID 1482634`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 786 and is the same as the version installed in this computer, created 2020, September 1, 1:8 hours Pacific Time.`

restart;        
expr:=1/2*int(exp(-t)*f(t),t)*exp(t)-1/2*exp(-t)*int(exp(t)*f(t),t)
 

(1/2)*(int(exp(-t)*f(t), t))*exp(t)-(1/2)*exp(-t)*(int(exp(t)*f(t), t))

Physics:-Latex:-UseColor := false:        
Physics:-Latex(expr)
 

\frac{\textit{Physics}:-*\left({\int \textit{Physics}:-*\left({{\rm e}^{-t}, f \left(t \right)}\right)d t , {\rm e}^{t}}\right)}{2}-\frac{\textit{Physics}:-*\left({{\rm e}^{-t}, \int \textit{Physics}:-*\left({{\rm e}^{t}, f \left(t \right)}\right)d t}\right)}{2}

 


Here is the result of compiling it

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{maplestd2e}

\begin{document}

\[
\frac{\textit{Physics}:-*\left({\int \textit{Physics}:-*\left({{\rm e}^{-t}, f \left(t \right)}\right)d t , {\rm e}^{t}}\right)}{2}-\frac{\textit{Physics}:-*\left({{\rm e}^{-t}, \int \textit{Physics}:-*\left({{\rm e}^{t}, f \left(t \right)}\right)d t}\right)}{2}
\]

\end{document}

I noticed this happens where is a multiplication in the expression

Physics:-Latex(exp(x)*f(x))

                    \textit{Physics}:-*\left({{\rm e}^{x}, f \left(x \right)}\right)

And

Physics:-Latex(a*b)

            \textit{Physics}:-*\left({a , b}\right)

This was not there in the earlier version of Physics. 

Download latex_issue_6.mw

@nguyenhuyenag 

I also tried “open with” but not work.

You need to right-click the mws file, then say open-with->Select another application->Select Maple 2020->Check the box that says always use this app to open mws

This should work. This is all standard windows operation and not related to Maple. Did you try the above?

You did not say what is the OS.

" installed Maple 2016, 2020 and set Maple 2016 as default opening files .mw, .mws."

Well, if you allready knew how to set the default to Maple 2016, why not use the same method to change it to Maple 2020? 

But on windows, one can also right-click the file, select open with-> and select the "always open using this application" option from the window that comes up.

But this is on windows. I do not know about other OS's.

@nm 

I found if I change the code from 

               sol:= solve(eq,MM) assuming TT>0;

to

              sol:= solve(eq,MM);
              sol:=simplify(sol) assuming TT>0; 

Then it works now even if calling Physics:-Latex beforehand. This is all using Physics 781.

So I changed my code to do the above. If I find new issues, will make separate question.
 

interface(version);

`Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 2020 Build ID 1482634`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 781 and is the same as the version installed in this computer, created 2020, August 30, 14:31 hours Pacific Time.`

restart;

foo:=proc(y,x)
local eq,MM,TT,sol;

eq:=TT^(MM - 1)*y*(2*y^4 + x^3)/(2*x*(y^4 + x^3)) = y*(2*TT^(5*MM - 1)*y^4 + TT^(MM + 2)*x^3)/(2*x*(TT^(4*MM)*y^4 + x^3*TT^3));
sol :=timelimit(20,[solve(eq,MM)]);
return simplify(sol) assuming TT>0;
end proc:

Physics:-Latex(y=u*x,output=string);
foo(y,x);
 

"y = u x"

[3/4]

restart;
foo:=proc(y,x)
local eq,MM,TT,sol;

eq:=TT^(MM - 1)*y*(2*y^4 + x^3)/(2*x*(y^4 + x^3)) = y*(2*TT^(5*MM - 1)*y^4 + TT^(MM + 2)*x^3)/(2*x*(TT^(4*MM)*y^4 + x^3*TT^3));
sol := [solve(eq,MM) assuming TT>0];
return sol;
end proc:

Physics:-Latex(y=u*x,output=string);
foo(y,x);

"y = u x"

[]

 


 

Download fixed.mw

 

 

@ecterrab 

Thanks for the update.

As I mentioned in original post, I thought the problem was due to latex setting changing automatically, that my program was now failing when using Physics:-Latex.

But I just installed 781 and solve still failed.

I can change my code from assuming TT>0 to use Physics if that is all is needed, but not sure now how since I did not use Physics:-Assume before. Will need to look into it. i.e how should I change the call to solve in the code below to make it return the same 3/4 solution, but still use Physics:-Latex?

Please see attached showing the test still fail in Physics 781

Thanks again for the help.


 

interface(version);

`Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 2020 Build ID 1482634`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 781 and is the same as the version installed in this computer, created 2020, August 30, 14:31 hours Pacific Time.`

restart;

foo:=proc(y,x)
local eq,MM,TT,sol;

eq:=TT^(MM - 1)*y*(2*y^4 + x^3)/(2*x*(y^4 + x^3)) = y*(2*TT^(5*MM - 1)*y^4 + TT^(MM + 2)*x^3)/(2*x*(TT^(4*MM)*y^4 + x^3*TT^3));
sol :=timelimit(20,[solve(eq,MM) assuming TT>0]);
return sol;
end proc:

Physics:-Latex(y=u*x,output=string);
foo(y,x);
 

"y = u x"

[]

restart;

foo:=proc(y,x)
local eq,MM,TT,sol;

eq:=TT^(MM - 1)*y*(2*y^4 + x^3)/(2*x*(y^4 + x^3)) = y*(2*TT^(5*MM - 1)*y^4 + TT^(MM + 2)*x^3)/(2*x*(TT^(4*MM)*y^4 + x^3*TT^3));
sol :=timelimit(20,[solve(eq,MM) assuming TT>0]);
return sol;
end proc:

#Physics:-Latex(y=u*x,output=string);
foo(y,x);

[3/4]

 


 

Download latex_issue_4.mw

First 50 51 52 53 54 55 56 Last Page 52 of 91