Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

By using equation x^2+y^2=4 for cylinder and plane z=0 and the plane z=3-x, plot the solid.

I would like to split the expression 1 / (x²+i)² into partial fractions, but Maple (2020) doesn't seem to know:
convert(1/(z^2+I)^2, parfrac, z);

How do i fix this?

I wanna shade/fill different areas in a single graph and provide a legend for the graph. Areas are defined as follows where 0<=x<=1 and 0<=z<=1. 

(label = c1) \quad if 0<x<1/13*(5-2sqrt(3)),0<z<1/2(2x+x^2)+1/2sqrt(4x^3+x^4)

 

(label = c2) \quad if 0<x<1/13*(5-2sqrt(3)),1/2(2x+x^2)+1/2sqrt(4x^3+x^4)<z<2x

 

I am trying solve on the outout of odetest, in order to determine range of which x makes this output zero.

It works sometimes and  does not work another times. I mean, it gives correct domain something, and other times, it overlooks some domain. 

Here is an example

restart;
ode:=x*diff(y(x),x)*y(x) = (y(x)^2-9)^(1/2):
ic:=y(exp(4)) = 5:
sol:=dsolve([ode,ic],y(x)):
res:=odetest(sol,ode);
solve(simplify(res),x,allsolutions = true) assuming real;

It is true than when x=1, then is zero.  But so all values x>1 as well.

How to get solve to find those values as well and not just x=1?

I tried PDEtools:-Solve as well. It did not better

PDEtools:-Solve(simplify(res),x,allsolutions = true) assuming real;

Compare to Mathematica

Are there other commands in Maple which could obtain all the solutions like in the above?

Maple 2020.2 on windows 10

 

 

My problem is a hickup in the Maple 2020 version as compared to earlier versions :

In the Maple 2020 listtorec from package gfun asks for unknown value u(0) in recognition of series.

Example from the Maple help page:

with(gfun);
l := [1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786];
rec := listtorec(l, u(n));
Error, (in gfun:-listtorec) invalid unknown function, u(0)

This error also happens with the second example in the Maple help page:

rec2 := seriestorec(series(add(l[i]*x^(i - 1)*(i - 1)!, i = 1 .. nops(l)), x, 12), u(n), ['egf']);
Error, (in gfun:-seriestorec) invalid unknown function, u(0)

How to feed this unknown value in the  call?
 


 

I have the following piece of code:

beta := 16250.25391;

tlow := 11.92817468;

y0 := t -> 1/4*4^(7/8)/(beta*(tlow - t))^(1/8);

r0 := 1;

r2 := 1.194444444;

r3 := -2.071877530;

dyr := t -> M*(-2*r0*diff(y0(t), t)/y0(t)^3 + 2*r2*y0(t)*diff(y0(t), t) + 4*r3*y0(t)^3*diff(y0(t), t));

plot(dyr(t))

Everything seems to work out fine until this point and I obtain a good plot. The problem occurs when I try calling the value of dyr at a specific point t. Here is an example:

dyr(5)
Error, (in dyr) invalid input: diff received 5, which is not valid for its 2nd argument

I understand there is something wrong with the diff part. I tried writing the following simple code and I have the same problem.

y := t -> t^2

z := t -> diff(y(t), t)

z(1);
Error, (in z) invalid input: diff received 1, which is not valid for its 2nd argument

I start with a function that has only one argument and it seems like introducing the diff requires that I use two arguments. y0 is a function of t solely and I would like dyr to have the same argument, so that I can call dyr(t) at any point t I want. Please take a look at this. Thanks in advance.

I can't figure exactly why adding export on module wide variable when using option package makes the variable not writable from a function inside the module

restart;

dsolver :=module()
option package;
export X::boolean := true;

export foo:=proc()
   dsolver:-X :=false;
end proc;
end module;

dsolver:-foo();

Error, (in foo) attempting to assign to `X` which is protected.  Try declaring `local X`; see ?protect for details.

But this works

dsolver :=module()
export X::boolean := true;

export foo:=proc()
   dsolver:X :=false;
end proc;
end module;

dsolver:-foo();

    false;

I wanted to make the variable export, so it can be set from anywhere (by other modules for example, directly). if I make it local, then other modules can no longer access it?

I know I can change the export to local as the error says. But why is this needed? Only thing I found so far, is this

"Not all modules are packages. Package semantics differ from module semantics in two ways. First, (module-based) package exports are automatically protected. Second, packages can be used as the first argument to"

So the above says function inside module, can't change module wide variable, if this variable is exprted, when using option package? Why?

In general, I am still not sure when to use option package or not. 

Are there any general rules as to when one needs to add option package vs. Not using this option? i.e. just use module() without this option? or the question is: When must one use option package?

I put everything (all modules) eventually in an .mla file and both cases work the same in this respect, so not sure when to use this option now. 

Maple 2020.2 on windows 10

Hello everyone;

There is itterative scheme and i have written a code. I want to know time and bytes used in each itteration. I have used the command "Usage" and code is showning results which are not right i thin becasue momery used should increase with itterations i.e., computaion is increasing so. CPU time is alos a issue here in my code.

Note: Code is also uploaded.

Thanks in advance. 

The code 

S:=sum(1/x__i,i=1..5)

will give us the following ouput

Why not 

S:=add(1/x__i,i=1..5)

 also give same result. why?How to do?

I also note that:

S:=add(1/x||i,i=1..5)

S:=sum(1/x||i,i=1..5)

 

In two recent questions

dnaviaux  raised concerns about saving informations he could include in a typeset report.

In the first question these informations were mainly printf terminal outputs, while the second question was oriented to informations of type Table (in the sense of DocumentTools:-Layout:-Table).

Acer has given a direct answer to this last question.
On my side I proposed a less direct one based on a LaTeXapproach.


Since several years I use to generate a LaTeX source code for typeset reports directly from Maple (this is not very difficult once you know LaTeX).
These reports often contain data tables Mbut latex(M)is not the good way to code these data tables into LaTeX.
That is why I turned towards the LaTeX/tabularstructure

\begin{tabular}{...}
...
\end{tabular]


Data tables are very simple structures and converting them programmatically from Maple Matrix into  LaTeX tabular is rather simple: the most important thing you must remember is that some characters have a special role in LaTeX  (for instance "\" , "_" and "$") while having a special meaning in Maple too: so beware of conflicts.

The procedure Tabular in the attached file takes as argument a Matrix and returns the LaTeX code of its tabular counterpart.
Note that it could be easily extendend to accept a DataFrameas input.
This is a very simple simple version and fonts (\rm, \bf, \it... or others), styles (\scriptsize, \large, ...) and much more customization features could be accounted for without any difficulty.

For this particular example inspired by dnaviaux first question, it would be probably better to replace the LaTeX code by one of thes two:

\begin{tabular}{|c @{ $\pm$  } c|}
....
Asdfsdg & +5.190e+01 & 2.5950e+00 \\ 

or :

\begin{tabular}{|c|c|}
....
Asdfsdg & \multicolumn{2}{c|}{$+8.680e-01 \pm 0.9190$} \\ 





dnaviaux second question concerned a DocumentTools:-Layout:-Table object.
For what I understood this table has a simple structure (no rowspan neither columnspan used).

But, knowing that tabular can manage merged columns (\multicolumn) and merged rows (\multirow, provided the ad hoc pasckage is used), I wondered if it would be possible to generate the LaTeX/tabular code corresponding to a Table using rowspan and columnspan?

This is done by the procedure Tabular_Table in the attached file.
Here again this is a very simple procedure which doesn't exploit all the informations a Table structure contains (backgroundstylefillcoloralignalignmentseparator [Tabular_Table separates all columns and rows] ...).

The "raw" rendering is not bad but could be improved:

  • adjust the way \multirowcenters the content of a cell (Xis badly placed in example 3)
  • adjust the spaces between line/clineand the text
    • by using the package cellspace 
    • or my modufying \arraystretch with \renewcommand.
  • one could also add a legend with \caption
  • parameterize Tabular_Table to accept other column separators
  • manage the colors (for instance a blue for a math expression and a black for a text)
  • ...

Finally Tabularand Tabular_Tablecould have an optional argument file:

{file::{symbol, string}:= terminal} 

set by default to terminalor wich could be the name of a  .texfile 


This work is still under developpement and I would be happy to exchange with you on this topic.
Happy New Year to all of you

 

Tabular_from_Maple.mw

Here is the content of the .tex file (I used Welcome-to-CoCalc.texto create/compile it)

\documentclass{article}

% set font encoding for PDFLaTeX, XeLaTeX, or LuaTeX
\usepackage{ifxetex,ifluatex}
\if\ifxetex T\else\ifluatex T\else F\fi\fi T%
  \usepackage{fontspec}
\else
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{lmodern}
\fi

\usepackage{hyperref}

% DO NOT FORGET THIS PACKAGE !!!
\usepackage{multirow}

\title{Tabulars from Maple}
\author{mmcdara}


\begin{document}
\maketitle

\begin{itemize}
\item[\bf{Example 1}]

\begin{tabular}{|c|c|c|}
\hline 
\hline 
Quantity & Nominal value & Uncertainty \\ 
\hline 
Asdfsdg & +9.060e+01 & 4.5298e+00 \\ 
\hline 
Bdfg & +1.437e+01 & 7.1870e-01 \\ 
\hline 
C123 & +8.025e+01 & 4.0125e+00 \\ 
\hline 
Ddf sdfg dsfg  & +9.614e+00 & 4.8072e-01 \\ 
\hline 
\hline 
\end{tabular}

\item[]\vspace*{10mm}

\item[\bf{Example 3}]

\begin{tabular}{| c | c | c | c | c |}
\hline 
\multicolumn{1}{|c|}{\multirow{4}{*}{X}} & \multicolumn{2}{c|}{\multirow{1}{*}{A1}} & \multicolumn{1}{c|}{\multirow{2}{*}{A2}} & \multicolumn{1}{c|}{\multirow{1}{*}{A3}} \\ 
\cline{2-2} 
\cline{3-3} 
\cline{5-5} 
 & \multicolumn{1}{c|}{\multirow{2}{*}{B1}} &\multicolumn{1}{c|}{\multirow{1}{*}{B2}} & & \multicolumn{1}{c|}{\multirow{3}{*}{B3}} \\ 
\cline{3-3} 
\cline{4-4} 
 &  & \multicolumn{2}{c|}{${\cos \left( \omega\,t+\phi \right) }^{\mathstrut}_{\atop{}{\mathstrut}}$} &  \\ 
\cline{2-2} 
\cline{3-3} 
\cline{4-4} 
 & \multicolumn{3}{c|}{${{\frac {1}{\Gamma  \left( x \right) }\sqrt {{{\rm e}^{-{\frac {{t}^{2}}{\pi }}}}}}}^{\mathstrut}_{\atop{}{\mathstrut}}$} &  \\ 
\hline 
\end{tabular} 

\end{itemize}

\end{document}


Image of the resulting PDF:

 

For comparison here is the Tableof Example 3 that Mapledisplays in the worksheet

Hey everyone,

f_1 and f_2  are satisfying the set of non-linear integral equations I have attached to this message.
I know that I need to solve them numerically by iterations. Probably, the first guest of the function f_1 and f_2  is the driving term. a is just a parameter which can be fixed (I guess smaller than \pi/4). * is the convolution product and k is the momentum space parameter. I learnt that in order to solve them I should solve them in the Fourier space. I know also that I need to discretize these function in the “real ” space between {-L,+L} before applying the FFT or one of its relatives. Thank you for any suggestions or leads.

Hi to all community. I am trying to integrate a lengthy-expression but could not get the result after waiting of 1 and 2 hours even. is there any way to control such integration


 

Integration_Help.mw

 

 


 

 

Hi, 

This is the context                                                                                             
A mathematical expression f has been coded by a two stage process of the form 

(u and s are character strings)
I do not know what f is, but I know what P1, P2 are and I know s too. 
I would like to recover f.

Here is the particular couple of coding processes that I consider

f := sqrt(x);    # assumed to be unknown

u  := sprintf("%Zm", f);                     # "process" P1
s  := StringTools:-Encode(u,':-base64');     # "process" P2

# The "inverse" of P2 is
v := StringTools:-Decode( s, 'encoding' = ':-base64' );

# Does it exist an operation to recover f from v?


Thanks in advance

 

Hey there, I´m new to maple and running into some syntax issues when calculating the Euler-Lagrange equation.

The Euler Lagrange equation in general looks like this:

I´ve got  the Lagrangian for my task figured out:

Here´s the code for this line, be aware that the function definition part of this is not working.

L:=((x),(varphi),t)->(J)/(2)*(((x))/(R))^(2)+(`m__R`)/(2)(*(x))^(2)+(`m__p`)/(2)(((x)+l*(varphi)*cos(varphi))^(2)+(l*(varphi)*sin(varphi))^(2))+`m__p`*g*l*cos(varphi)

phi is obviously a function of t, I´m not sure if I should have written phi(t)

 

In the first step to solve the Euler-Lagrange, I have to partially differentiate L w.r.t xdot. preferably with a command something like the following:

How do I do that, how do I set L up to be able to do that? The way I defined the function above is not correct because xdot and phidot cant be used an argument apparently.

If all is working perfectly I´d be able to partially differentiate L w.r.t xdot, phidot, x, phi and subsequently be able to differentiate the first two w.r.t t again.

I´ll spare you the detail but I´ve tried for hours now with redefining xdot as xdot:= diff(x(t),t) and all sorts of other ways but nothing seems to really work.

 

Thanks for your help.

Hi,

I have three equations in terms of the following variables:

X,Y,X1, X2

How do I get an equation in terms of (X1,X2)  with Maple from Equations 1-3?

E.mw

First 332 333 334 335 336 337 338 Last Page 334 of 2097