MaplePrimes Questions

Hi,

I have a vector that I would like to display with added text annotations.  For example with the vector <1,2>, I would like output to the display:

first: 1

second: 2

Is there a simple way to do this?

Hi, Very new to Maple. This is a math assignment, and well I am not exactly sure what is happening. I have had a buddy to help me, but things are not necessarily working.

 

a := 0;
                             a := 0

b := 1;
                             b := 1

p := plot({Fresnelf(x), Fresnelg(x)}, x = a .. b);
plots[display](p);

 

A := [a, g(a)];
B := [a, f(a)];
                         A := [0, g(0)]

                         B := [0, f(0)]

C := [b, g(b)];
D_ := [b, f(b)];
                         C := [1, g(1)]

                        D_ := [1, f(1)]

left_line := plot([A, B]);
right_line := plot([D_, C]);
plots[display](p, left_line, right_line, view = [0 .. b + 0.5, 0 .. 0.2]);
Warning, data could not be converted to float Matrix
Warning, data could not be converted to float Matrix
 

What is the letter O doing inside this pde solution by Maple 2020.2 and what does it mean? There is no O in the PDE itself and it is not a name of a mathematical special function 

restart;
interface(version);
pde :=  diff(w(x,y),x)+ (a*x^2*y+b*y^3)*diff(w(x,y),y) = 0;
sol:=pdsolve(pde,w(x,y));

 

lprint(sol)

w(x,y) = _F1(1/9*(2*2^(2/3)*3^(5/6)*b*x*O*y^2-3*2^(2/3)*3^(1/3)*b*x*GAMMA(1/3,-\
2/3*x^3*a)*GAMMA(2/3)*y^2+9*O*GAMMA(2/3)*exp(2/3*x^3*a))/O/GAMMA(2/3)/y^2)

 

Hi,

I have aproc that takes a supplied electrical resistance and calculates the closest standard resistor value to it.

I would like the proc to work whether the supplies resistance has Units(ohm) or if it is free of units.  I am new to programming in Maple.  I have come up with the following but if there is a better way to do this, it would help me to get up to speed with Maple more quickly.

 























Thanks,

David

Hi Everyone,

First time asking a question on this website. I am a bit confused about an error I am getting in a pretty straightforward simulation I am trying to generate. It is part of an overall State Machine I am working on but I have isolated the issue to the Angle Sensor and have simplified the issue to ask my question. The issue is as follows:

When simulating the To_Box_5_error.msim file I get the following error

Preparing for integration......
Generating code (derivatives)
(in MapleSim:-CreateDataRecord) internal error occurred during simulation: check console on verbose for more details (5.508s)

This file consits of the angle sensor feeding back to the two <= blocks.

However when simulating the To_Box_5_works.msim file the simulation completes without issue. The difference in the second file is that I feed back the angle sensor value to only one <= block while the second I ijust feed in a constant.

Why would feeding back the same signal to both of these blocks not complete the simulation? The error does not occur for the position sensors that are also in the model.

Any suggestions would be greatly appreciated.

Mike

Hi,

Just to inform me about the possibility of easily way to build a probability tree with Maple? like this example ( for example)

Thanks

Please see this example. This Latex generated gives Latex compile error.

restart;
Latex:-Settings(UseImaginaryUnit=i,
      UseColor = false,
      powersoftrigonometricfunctions= mixed, ## computernotation,
      leavespaceafterfunctionname = true,
      cacheresults = false,
      spaceaftersqrt = true  
);

L:=3;
c:=4;
h:=1/10;
b:=Pi*c/L;
f:=piecewise(0<x and x<L/3,3*h/L*x,L/3<x and x<L,h);
pde := diff(u(x,t),t$2) + b*diff(u(x,t),t) = c^2*diff(u(x,t),x$2);
bc  := u(0,t)=0,D[1](u)(L,t)=0;
ic  := D[2](u)(x,0)=0,u(x,0)=f;
sol:=pdsolve([pde,bc,ic],u(x,t));

The Latex generated does not compile:

Latex(sol)


u \left(x , t\right) = 
\Mapleoverset{\infty}{\Mapleunderset{n =0}{\sum}}\left\{\begin{array}{44}\frac{4 \,{\mathrm e}^{-\frac{2 t \pi}{3}} \left(t \pi +\frac{3}{2}\right) \sin \left(\frac{\pi  x}{6}\right)}{5 \pi^{2}} & n =0 \\\frac{3 \sin \left(\frac{\left(1+2 n \right) \pi  x}{6}\right) \left(\sqrt{3}\, \sin \left(\frac{\pi  n}{3}\right)+\cos \left(\frac{\pi  n}{3}\right)\right) \left(\left(2 \sqrt{n}\, \sqrt{n +1}+i\right) {\mathrm e}^{\frac{2 i \pi  \left(-2 \sqrt{n}\, \sqrt{n +1}+i\right) t}{3}}-{\mathrm e}^{\frac{2 i \pi  \left(2 \sqrt{n}\, \sqrt{n +1}+i\right) t}{3}} \left(-2 \sqrt{n}\, \sqrt{n +1}+i\right)\right)}{10 \sqrt{n}\, \sqrt{n +1}\, \pi^{2} \left(1+2 n \right)^{2}} & \mathit{otherwise}  \end{array}\right.

Gives

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

\begin{document}
\[
u \left(x , t\right) = 
\Mapleoverset{\infty}{\Mapleunderset{n =0}{\sum}}\left\{\begin{array}{44}\frac{4 \,{\mathrm e}^{-\frac{2 t \pi}{3}} 
   \left(t \pi +\frac{3}{2}\right) \sin \left(\frac{\pi  x}{6}\right)}{5 \pi^{2}} 
    & n =0 \\\frac{3 \sin \left(\frac{\left(1+2 n \right) \pi  x}{6}\right) 
    \left(\sqrt{3}\, \sin \left(\frac{\pi  n}{3}\right)+\cos \left(\frac{\pi  n}{3}\right)\right) 
    \left(\left(2 \sqrt{n}\, \sqrt{n +1}+i\right) {\mathrm e}^{\frac{2 i \pi  \left(-2 \sqrt{n}\, 
    \sqrt{n +1}+i\right) t}{3}}-{\mathrm e}^{\frac{2 i \pi  \left(2 \sqrt{n}\, \sqrt{n +1}+i\right) t}{3}} 
    \left(-2 \sqrt{n}\, \sqrt{n +1}+i\right)\right)}{10 \sqrt{n}\, \sqrt{n +1}\, \pi^{2} \left(1+2 n \right)^{2}} 
    & \mathit{otherwise}  \end{array}\right.
\]

\end{document}

This, using latest TeXLive on Linux, gives  Illegal character in array arg.

lualatex foo5.tex
This is LuaHBTeX, Version 1.12.0 (TeX Live 2020)
 restricted system commands enabled.
(./foo5.tex
LaTeX2e <2020-10-01> patch level 2


 L3 programming layer <2020-12-07> xparse <2020-03-03> (/usr/local/texlive/2020/texmf-dist/tex/latex/base/article.cls
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/size11.clo)) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/mnt/g/public_html/styles/maplestd2e.sty
Package: maple2e 2005/03/17 v1.16
Defining Maple Utility Macros
(/mnt/g/public_html/styles/mapleenv.def)
Defining Maple Plot Environemnts
 ...Defaults to "dvips" Driver
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/epsfig.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphicx.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphics.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/trig.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-cfg/graphics.cfg) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-def/dvips.def))))
Defining Automatic Style Generation Macros
Defining Maple Spreadsheet Environments
Maple Spreadsheet and Table Support
) (/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-luatex.def) (./foo5.aux) (/usr/local/texlive/2020/texmf-dist/tex/latex/base/ts1cmr.fd)

! LaTeX Error: Illegal character in array arg.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...haracter\or Missing @-exp\or Missing p-arg\fi \space in array arg.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help\@err@

l.8 \Mapleoverset{\infty}{\Mapleunderset{n =0}{\sum}}\left\{\begin{array}{44}
                                                                           \frac{4 \,{\mathrm e}^{-\frac{2 t \pi}{3}}
?

fyi. No errors are generated from the old latex() command.

The following is another example, with the same Latex error. 

restart;
Latex:-Settings(UseImaginaryUnit=i,
      UseColor = false,
      powersoftrigonometricfunctions= mixed, ## computernotation,
      leavespaceafterfunctionname = true,
      cacheresults = false,
      spaceaftersqrt = true  
);

c:=3;
f:=piecewise(4<x and x<5,1,true,0);
pde := diff(u(x, t), t$2) = c^2*(diff(u(x, t), x$2));
bc  := eval( diff(u(x,t),x),x=0)=0;
ic  := u(x,0)=f(x),eval(diff(u(x,t),t),t=0)=0;
sol:=pdsolve([pde, bc,ic],u(x,t)) assuming x>0,t>0;

Latex(sol);  #gives Latex that do not compile

Maple 2020.2, with Physics 897

Hi, 

I have developed many transfer functions derived by several solve() functions for an electrical design.  I need to pass on to the software guys the actual transfer equations without all of the maple details.  For example, I have an equation that showstat displays as follows:

fadc_vmon := proc(vmon)
   1   1638.400000*vmon+200.
end proc

I would like to output this as follows for the programmers:

adc(vmon) = 1638.400000*vmon+200

In addition, I would like to be able to have control over the number of digits displayed by the various parameters.

Is this something can be done?

 

Thanks,

David

 

Key in below command, the Ag2O is not recogonised

h_Ag2O := Property("Hmolar", " Ag2O", "temperature" = T)

 

I have a function F(x,y), for example, F=x+y,and a relation between x and y,which we denote it by G(x,y)=0, and x can not be solved explicitly, For example, G(x,y)= x^5+x^4*y+x^3*y+2*x^2*y^2+x*y^5+y^5-1. and I want to plot F(x,y) with respect to y, where x satisfy G(x,y)=0, How can I do this?

 I want to split a arbirtray list of elements by position into two new lists containing all the even and odd elements.

Example: With a list like this:

ls:=["a", "b", "c", "d", "e"]

how can I get two lists like this:

["a", "c", "e"], ["b", "d"]

How to do it in Maple ? Thanks! 

Maybe selectremove is useful?

 

 

 

 

 

colect(expr,y)  and collect(expr,y,factor) do not work on these.  The expression can be anything. No necessarily a polynomial in y.

I have as input an expression, which has y  in it, and I want to find if I can write it  as   y*(....)  of y^2*(...) or y^3*(...), etc...

Basically, I want to see if can be taken out as common term. Just like we do by hand. 

So, given expression as  y^2+y^3*sin(x)+3*x*y^5 then I want to see if it can be written as y^2*(1+y*sin(x)+3*x*y^3)

In the above y^2 was extracted as common term. I found that simplify sometimes work, but I can't depend on simplify, since it is not guranteed to work all the time. Here is an example where it worked

expr:=y^2+y^3*sin(x);
simplify(expr)

but if expression is this, then it did not extract out y^2

expr:=y^2+y^3*sin(x)+3*x*y^5;
simplify(expr)

I am doing this  all in code, without looking at the expression and decide what to do. 

I just know  is the name of the variable, and the expression will be a function of  and I just want to know if I can extract a common y^n  term out, so the result is y^n*g(y)

For example, for expr:=y^2+y^3*sin(x)+3*x; it will fail, since  I can't extract from all terms. In this case the result will be  y^2*(1+y*sin(x))+3*x  and this is not type(`*`). So it is ok for the method to fail, if it can not do it. I can always check the result to see if it failed or not.

Does Maple have build in method to do this? Or one has to program this? I wanted to ask first before if there is some hidden Maple function that can do this I did not see.

Sometimes math is easier to do by hand than using the computer :)

Maple 2020.2

Thanks.

edit: I also tried factor, but it does not work on everything. An example where it did not work

expr:=y^2+y^3*sin(x)+3*x*y^(7/2);
factor(expr);

It did not factor out y^2 because of y^(7/2) is not "integer, rational. numeric, or algebraic coefficients"? according to help.

Edit:

Thanks to all the answers. I used a combination of all of them to check if it can be factored or not, and now it is working for every example I tried it on. So if one method failed, I try the next method shown in the answers. 

 


 

Dear maple users.

Greetings for the day.

I hope you are all fine and safe.

In the below mention code, I need to plot "ax" at 0..1 when N=1 and N=2.

But the code only working for the N=0 case.

How to tackle this situation and plot the function for various values of "ax" at ax=0..1.

waiting for your reply.

JBV.mw

Code:

restart;
PDEtools[declare](f(x), t(x), g(x), prime = (x));

N := 2; m := .2; pa := 3.14*(1/3); ax := ax; h2 := 1+.2*ax+.3*sin((2*3.14)*(ax-.2)); h1 := -1-.2*ax-.1*sin((2*3.14)*(ax-.2)+pa); a2 := 1.4+.1*sin((2*3.14)*(ax-.2))+.3*sin((2*3.14)*(ax-.2)+pa);

f(x):=sum(p^j*f[j](x),j=0..N);  t(x):=sum(p^j*t[j](x),j=0..N);

g(x):=sum(p^j*g[j](x),j=0..N);

Eq1 := (1-p)*(diff(f(x), `$`(x, 4)))+p*((1+.2)*(diff(f(x), `$`(x, 4)))-(.2*(1/3))*(diff((diff(f(x), `$`(x, 2)))^3, `$`(x, 2)))-2*(diff(f(x), `$`(x, 2)))+diff(t(x), `$`(x, 1))+diff(g(x), `$`(x, 1)));

Eq2 := (1-p)*(1+1.2)*(diff(t(x), `$`(x, 2)))+p*((1+1.2)*(diff(t(x), `$`(x, 2)))+.1*(diff(t(x), `$`(x, 1)))*(diff(g(x), `$`(x, 1)))+.2*(diff(t(x), `$`(x, 1)))^2+.5*(diff(f(x), `$`(x, 1)))^2);

Eq3 := (1-p)*(diff(g(x), `$`(x, 2)))+p*(diff(g(x), `$`(x, 2))+diff(t(x), `$`(x, 2)));

for j from 0 to N do
equ1[j] := coeff(Eq1, p, j) = 0; 
equ2[j] := coeff(Eq2, p, j) = 0;
equ3[j] := coeff(Eq3, p, j) = 0;
end do;

con[1][0] := f[0](h2) = (1/2)*a2, (D(f[0]))(h2) = 0, f[0](h1) = -(1/2)*a2, (D(f[0]))(h1) = 0; con[2][0] := t[0](h2) = 1, t[0](h1) = 0; con[3][0] := g[0](h2) = 1, g[0](h1) = 0;

for i to N do

con[1][i] := f[i](h2) = 0, (D(f[i]))(h2) = 0, f[i](h1) = 0, (D(f[i]))(h1) = 0; con[2][i] := t[i](h2) = 0, t[i](h1) = 0; con[3][i] := g[i](h2) = 0, g[i](h1) = 0 end do;

for i from 0 to N do
P:=dsolve({equ1[i],equ2[i],equ3[i],con[1][i],con[2][i],con[3][i]},{f[i](x),t[i](x),g[i](x)}):
f[i](x):=rhs(P[1]);
t[i](x):=rhs(P[2]);
g[i](x):=rhs(P[3]);
end do:

f(x):=evalf(simplify(sum(f[n](x),n=0..N)));
Am := (1+.2)*(diff(f(x), `$`(x, 3)));
with(plots);

display(plot(eval(Am, x = .6), ax = 0 .. 1, numpoints = 200, color = blue));
 


Digits := 6:
f := (t,x,y) -> diff(x(t),t$2) = -x(t)/(x(t)^2+y(t)^2)^(3/2):
g := (t,x,y) -> diff(y(t),t$2) = -y(t)/(x(t)^2+y(t)^2)^(3/2):

t0 := 0:
x0:=1: y0:=0: tf := 3: n := 12:                 # number of subintervals
m := 2:                  # to print every mth step
h := evalf((tf - t0)/n): # step size

t:=t0: x:=x0: y:=y0:

fmt := `%10.0f %10.4f %10.4f \n`:

for i from 1 to n do
   k1 := f(t,x,y):
   l1 := g(t,x,y):                    # left-hand slopes
   k2 := f(t+h/2,x+h*k1/2,y+h*l1/2):
   l2 := g(t+h/2,x+h*k1/2,y+h*l1/2):  # 1st midpt slopes
   k3 := f(t+h/2,x+h*k2/2,y+h*l2/2):
   l3 := g(t+h/2,x+h*k2/2,y+h*l2/2):  # 2nd midpt slopes
   k4 := f(t+h,x+h*k3,y+h*l3):
   l4 := g(t+h,x+h*k3,y+h*l3):
   k := (k1+2*k2+2*k3+k4)/6:
   l := (l1+2*l2+2*l3+l4)/6:
   x := x + h*k:
   y := y + h*l:
   t := t + h:
   if trunc(i/m) =i/m then  printf(fmt,180*t,x,y) fi; od:
Error, (in f) invalid input: diff received 0, which is not valid for its 2nd argument
 

What do you suggest for graphics that are very close to each other in one figure? 

I am asking for graphics in articles to be sent to a scientific journal.

 

a simple example

restart:
with(plots):
f1:=x->0.95*x;
f2:=x->0.99*x;
f3:=x->0.991*x;
p1:=plot(f1(x),x=0..2,color=red);
p2:=plot(f2(x),x=0..2,color=blue);
p3:=plot(f3(x),x=0..2,color=green);
display(p1,p2,p3);

 

 

First 341 342 343 344 345 346 347 Last Page 343 of 2308