MaplePrimes Questions

Hi, everyone!

I need help.

There are a system of 2 pde's: 

diff(Y(x, t), x$2) = exp(-2*x*b)*(A(x, t)-Y(x, t)), diff(A(x, t), t) = exp(-2*x*b)*(Y(x, t)-A(x, t)) 

and initial and boundary conditions: 

A(x, 0) = 0, Y(0, t) = 0.1, (D[1](Y))(0, t) = 0. 

Goal: 
For each b = 0, 0.05, 0.1. 
1)to plot 3-d  Y(x,t): 0<=x<=20,0<=t<=7. 
2)to plot  Y(x,4). 

Are there any methods with no finite-difference mesh?


I realized the  methods such as  pds1 := pdsolve(sys, ibc, numeric, time = t, range = 0 .. 7)  can't help me:

Error, (in pdsolve/numeric/match_PDEs_BCs) cannot handle systems with multiple PDE describing the time dependence of the same dependent variable, or having no time dependence 

I found something, that can solve my system analytically: 
pds := pdsolve(sys), where sys - my system without initial and boundary conditions. At the end of the output: huge monster, consisted of symbols and numbers :) And I couldn't affiliate init-bound conditions to it.

I use Maple 13. 

Dear Mapleprimes,

I have been struggling with a problem in the last couple of days. I wish to export a Maple plot to LaTeX while ensuring font consistency. While searching for solutions online, I found the psfrag package in LaTeX. So far, however, I have been unsuccesful in making this work. As as test, I attempted to export plot(x^2) to LaTeX. I used the following code to convert to .eps which worked fine:

plotsetup(ps, plotoutput = `plot1.eps`, plotoptions = `portrait, noborder,height=5in,width=5in`);plot(x^2);

Then in LaTeX, I have:

\documentclass{article}

\usepackage{graphicx}

\usepackage{psfrag}

\begin{document}

\begin{figure}[!h]
\centering
\psfrag{x}{$ \alpha $}
\includegraphics[scale=0.5]{plot1.eps}
\end{figure}
\end{document}

However, no replacements are made. After intense Google searching I found the following post http://www.mapleprimes.com/posts/43255-Trouble-Replacing-Maple-Axes-Labels which to sum up argues that this was only possible with earlier versions of Maple.

Does anyone know if the problem has been resolved?

Does anyone know any other ways to ensure font consistency for plots imported from Maple to LaTeX?

Thank you very much in advance!

C

Ok I dont think I provided enough data last I asked this and as a result I am still stuck so here goes;

I have data in 4 matrices describing a wave going from one medium to another, the incident wave transmission and reflection coefficients (F1), the exiting waves transmittance and reflection coefficients (F2) and the propagating waves in each medium (P1 and P2). All this boils down to 4 matrices with data.

The propagating wave and incident wave vectors are summed and square rooted and the Real parts defined as cos_phi[i] for increasing k which the 4 matrices before are defined by.

I plotted the results as cos_bloch_phase1 using pointplot and the sequence of values of k versus cos_phi.

Then displayed cos_bloch_phase1,plot... etc

What I am struggling to figure out is how to export the data that is plotted in cos_bloch_phase1. I have copied and pasted my code in its entirety of which a further plot is included but can be ignored as they are constructed similarly;


restart;
with(plots): with(linalg):

matrix elements for the first interface

incident parameters
theta0:=89*Pi/180; k_min:=0.0; k_max:=25;

number_of_points:=1000;
step:=(k_max-k_min)/number_of_points;
                              1000
                         0.02500000000

parameters of a binary crystal
n1:=1.46; n2:=4.6; d1:=0.1; d2:=0.1;
                              1.46
                              4.6
                              0.1
                              0.1


for i from 0 by 1 to number_of_points do
k[i]:=k_min+i*step;

theta1:=evalf(arcsin(n0*sin(theta0)/n1)); theta2:=evalf(arcsin(n0*sin(theta0)/n2));
q1:=k[i]*n1*cos(theta1); q2:=k[i]*n2*cos(theta2);


F1:=Matrix([[(q1+q2)/(2*q1),(q1-q2)/(2*q1)],[(q1-q2)/(2*q1),(q1+q2)/(2*q1)]]);
F2:=Matrix([[(q2+q1)/(2*q2),(q2-q1)/(2*q2)],[(q2-q1)/(2*q2),(q2+q1)/(2*q2)]]);
P1:=Matrix([[exp(-I*q1*d1),0],[0,exp(I*q1*d1)]]);
P2:=Matrix([[exp(-I*q2*d2),0],[0,exp(I*q2*d2)]]);
M_period:=multiply(P1, F1, P2, F2);

cos_phi[i]:=Re(1/2*(M_period[1,1]+M_period[2,2]));
end:


cos_bloch_phase1:=pointplot([seq([k[i],cos_phi[i]],i=0..number_of_points)],connect=true):

display(cos_bloch_phase1,plot([1,-1],x=0..k_max,color=[red,red]));



for i from 0 by 1 to number_of_points do
k[i]:=k_min+i*step;

theta1:=evalf(arcsin(n0*sin(theta0)/n1)); theta2:=evalf(arcsin(n0*sin(theta0)/n2));
q1:=k[i]*n1*cos(theta1); q2:=k[i]*n2*cos(theta2);

F1p:=Matrix([[(q1/n1^2+q2/n2^2)/(2*q1/n1^2),(q1/n1^2-q2/n2^2)/(2*q1/n1^2)],[(q1/n1^2-q2/n2^2)/(2*q1/n1^2),(q1/n1^2+q2/n2^2)/(2*q1/n1^2)]]);
F2p:=Matrix([[(q2/n2^2+q1/n1^2)/(2*q2/n2^2),(q2/n2^2-q1/n1^2)/(2*q2/n2^2)],[(q2/n2^2-q1/n1^2)/(2*q2/n2^2),(q2/n2^2+q1/n1^2)/(2*q2/n2^2)]]);
P1p:=Matrix([[exp(-I*q1*d1),0],[0,exp(I*q1*d1)]]);
P2p:=Matrix([[exp(-I*q2*d2),0],[0,exp(I*q2*d2)]]);
Mp_period:=multiply(P1p, F1p, P2p, F2p);


cos_phi2[i]:=Re(1/2*(Mp_period[1,1]+Mp_period[2,2]));
end:



cos_bloch_phase2:=pointplot([seq([k[i],cos_phi2[i]],i=0..number_of_points)],connect=true):

display(cos_bloch_phase2,plot([1,-1],x=0..k_max,color=[red,red]));


display(cos_bloch_phase2,cos_bloch_phase1,plot([1,-1],x=0..k_max+5,color=[red,red]));


Is it possible to solve (numerically or symbolically) the system of PDEs
sys:={diff(Y(x, t), x$2) = exp(-2*x*b)*(A(x, t)-Y(x, t)), diff(A(x, t), t) = exp(-2*x*b)*(Y(x, t)-A(x, t)) }
under the conditions
ibc:={A(x, 0) = 0, Y(0, t) = 0.1, D[1](Y)(0, t) = 0},
 where the parameter b takes the values 0,0.05,0.1, in Maple? The ranges are t=0..7, x=0..20.

my codes list below.note the last line of the codes.evalf is not effective? the output is a long expression. how to force the maple to evaluate the long expression into a numeric value?

--------------------codes---------------------

restart:
 with(Tolerances):
 ALL := [`$`(1 .. 3)]:
 solution_k := simplify(solve(map(proc (i) options operator, arrow:
 1/k[i] = (cos(Phi)*(x[i]-Tx)+sin(Phi)*(y[i]-Ty))/(-sin(Phi)*(x[i]-Tx)+cos(Phi)*(y[i]-Ty)) end proc, ALL), [Tx, Ty, Phi]), size):
 assign(solution_k):
 k := map(proc (i) options operator, arrow:
 tan(phi[i]) end proc, ALL):
 deg2rad := Tolerances:-`*`(Pi, Tolerances:-`^`(180, Tolerances:-`-`(1))):
 phi0[1] := Tolerances:-`*`(Pi, Tolerances:-`^`(3, Tolerances:-`-`(1))):
 phi0[2] := Pi:
 phi0[3] := Tolerances:-`-`(Tolerances:-`*`(Pi, Tolerances:-`^`(3, Tolerances:-`-`(1)))):
 alpha := Tolerances:-`*`(Pi, Tolerances:-`^`(10, Tolerances:-`-`(1))):
 L := 1:
 phi := phi0:
 x := map(proc (i) options operator, arrow:
 cos(phi0[i]+alpha)*L end proc, ALL):
 y := map(proc (i) options operator, arrow:
 sin(phi0[i]+alpha)*L end proc, ALL):
 angleError := Tolerances:-`&+-`(0, Tolerances:-`^`(10, -4)):
 locError := Tolerances:-`&+-`(0, Tolerances:-`^`(10, -4)):
 phi := map(proc (i) options operator, arrow:
 phi[i]+angleError end proc, ALL):
 x := map(proc (i) options operator, arrow:
 x[i]+locError end proc, ALL):
 y := map(proc (i) options operator, arrow:
 y[i]+locError end proc, ALL):
 evalf(Phi)

-----------------------------outputs--------------------

 

  1. How can I represent the following in Maple?

 

(1) B(t+1) = B(t)+X (t,t+1)–D(t,t+1)

(2) T(t+1) =(m +1)/m(X(t,t+1)+X(t–1,t)+…+X (t–m+1,t–m+2))

restart:assume(M>0);

Eq1 := diff(psi(y), y, y, y, y)-M*(diff(psi(y), y, y))-Gr*b*y = 0;

bcs1:=psi(0)=0,(D@@2)(psi)(0)=0,psi(h)=-F/2,D(psi)(h)=A;

res1:=(dsolve(Eq1));

res2:=(dsolve({Eq1,bcs1},psi(y)));

match(rhs(res2)=rhs(res1),y,s);

s:

C3:=eval(_C3, s);

I am unable to find the constants. Anyway around this?

i am solving 4 ODE with boundary condition..

> restart;
> with*plots;

 

then i got this error..

Error, (in dsolve/numeric/bvp/convertsys) unable to convert to an explicit first-order system

 

i dont know where i need to change.. could you help me..

 

 

 

Hello, I'm new here, I hope there is someone willing to give me a hand with my problem. I've been trying to solve a problem with a for loop and I have errors in my code, could you please tell me what's wrong with the  bold part?

 

restart;

with(plots);

g := proc (F, A, B, X0, g::evaln) local f, a, b, E, x0, erreur, N, n, x1, ps, pp, pic; f := F; a := A; b := B; x0 := X0; E :=

evalf(abs(f(x0)));

erreur := 0.1e-3;

N := 100;

n := 0;

for i to N do x1 := evalf(x0-f(x0)/(D(f))(x0));

E := abs(f(x1));

n := n+1; ps[n] := plot([[x0, 0.], [x0, f(x0)], [x1, 0.]], color = green, thickness = 2);

x0 := x1 end do; g := evalf(x1); pp := plot(f(x), x = a .. b, color = red); pic := seq(ps[i], i = 1 .. n); display(pp, pic) end proc;
Warning, `i` is implicitly declared local to procedure `g`
f := proc (x) options operator, arrow; sin(x)-cos(2*x)+.2 end proc;
x -> sin(x) - cos(2 x) + 0.2
a := 0; b := 6;

 

 

 

Thank you very much!

What is the weak solution integral equation for 

du(x)/dx2 -(1+x2 ) u(x)-1=0

This is better explained with simple example. Suppose I have these 2 equations

a:='a';b:='b';x:='x';
eqs:=[3*a+4*b = 3*x, 5*a+7*b = 7*x];

What I want is to solve for (a/x) and (b/x) from the above, and not for "a" and "b".

Currently, I do this manually as follows. First divide both equations by 'x' to obtain the ratio. I had to do this manually as writing eqs/x gave expression which was hard to work with for what I want to do. I could not simplify it for what I wanted. So I typed this

eqs2:=[3*(a/x)+4*(b/x)=3,5*(a/x)+7*(b/x)=7];   %manually typed !

Now used algsubs to replace (a/x) by new variable z1, and replace (b/x) by new variable z2, then solve for z1,z2 (btw, I had to do algsubs one at a time. (need to look at this later, but not impotant)

algsubs(a/x=z1,eqs2);
algsubs(b/x=z2,%);
solve(%,{z1,z2});

       {z1=-7,z2=6}

Is there a way or function(s) to automate this. The hard part is telling Maple to use the ratio as new variable starting from set of equations.

Hy i need your help experts,

I have à small program for some variables calculations and im intrested to plot loop result,

Here is the program:

 



I just want to assign the results of my loop to a matrix to be easily ploted.

Thak you for help.

 

Dear all;

Please how can I plot the error between the two function.

 

Hi:

can I use Laplace Transform Method for solve Nonlinear ODE in maple?

This has been buggin me all day, but if i define a variable with an expresion say "a:=3 x+5" and i then want to assign this expression to a function like so "f:=x->a". if i then call f(7), maple return with "3 x+5" so just returning the value of a without substituting x with 7.

Is there any way in which i can define a function this way?

First 1439 1440 1441 1442 1443 1444 1445 Last Page 1441 of 2427