## How do I solve second order equations and obtain r...

I have been studying the solutions of the equation below using Maple and Mathematica.

$\large 4a_{02}^2+4ka_{02}a_{11}+k^2a_{11}^{2}+4b_{02}^{2}+4kb_{02}b_{11}+k^{2}b_{11}^{2}=0$

Here, I want to express the solutions for k. In Maple, the solution is imaginary. As one may see below.

On the other hand, if one solves that  exact equation with Mathematica, then one has real solutions. That is,

$\large k_{1,2}=\frac{1}{a_{11}^{2}+b_{11}^{2}}2\left(-a_{02}a_{11}-b_{02}b_{11}\pm\sqrt{-a_{11}^{2}b_{02}^{2}+2a_{02}a_{11}b_{02}b_{11}-a_{02}^2b_{11}^2}\right)$

Based on the above, I have a few questions:

1. What is the correct solution for the first equation above? That is, are the solutions real or complex?

2. How may I obtain the real solutions, k_{1,2}, above using Maple?

Attached below you may find my mwfile with my doubts.

Mydoubts.mw

## I need syntax help on procedures....

Hi! I'm having doubts about the "automatic spacing" in maple. I would like to know two things:

1-can incorrect spacing ruin my code? (Ex by typing "spacebar" too many times )

2- i know that to type spacebar is obligatory after: proc()" "...end proc;    Is there any other situation in wich to use spacebar isn't optional? Thanks for your answers

## Reverse a catenation...

I want to reverse a catenated expression (eg. xxtt ->x,x,t,t). I don't know the command to achieve this. Anyone with an idea please help

Thanks

## How do i add elements from subsets?...

Hi! I've got a set of subsets S with Abeing the i-subset. I need to sum up all the x's in all the Ai's. How can this be achieved?

(ex):

sum( { {a, b, c}, {a, b, d} } )= 2a+2b+c+d

## arrow procedure...

Hello,

I am writing an arrow procedure and will like to know if there is a way to implement the following

bj := (G, y) ->  (`@`(seq((t -> u -> v -> G(u, t) - v)(args[1 + nargs - i]), i = 1 .. nargs - 2)))(y)
bj(F, y, a, b, c, d);
v:=[p, q, r, s]
the output

My question is, how can I replace the v with each element of the list to get the following as output
F(F(F(F(y,a)-p),b)-q,c)-r,d)-s

Aany suggestion will be highly appreciated

## Vector spaces from sets...

Hi! I'm new to Maplesoft. I would like to use it for my research. However, in order to do so, i have to construct an n-dimensional vector space, with vectors of the form A_1*B, A_2*B, ..., A_k*B, where A_i is a set of  n components from a Field (or ring) and B is the basis for the vector space.

It would REALLY help if you could give some ideas for me to bring this up, or else i will be forced to typset every one of the vectors i'll use in a matrix-multiplication form and will make considerably harder my work.

## recursive differentiation...

I am trying to develop a recursive code to the above equations.  Note, U,X&Y are multivariate functions (in this case bivariate functions of (x,y)) i.e. U=U(x,y), X=X(x,y) etc.

## How can I generate the following list from L=[x,y,...

Given a list L=[x,y,z], what is the best way to generate the following sequential expression?
L1=[[x],[y],[z],[x,x],[x,y],[[x,z],[y,y],[y,z],[z,z],[x,x,x],[x,x,y],[x,x,z],[x,y,y],[x,y,z],[y,y,y],[y,y,z],[y,z,z],[z,z,z]].

With Lin mind (a list of list of at most three variables), how can one generate a list of lists of any number of variable from L.

I am currently out of options, a response will be highly appreciated.

Thanks

## "Dual" command in Logic package...

Dear all,

I do not understand the output of the "Dual" command in the Logic package.

According to the help:

"The Dual command returns the dual of the Boolean expression b, that is, the expression generated by replacing &and with &or, &or with &and, leaving &not fixed, and extending to the remaining Boolean operators by their formulas in terms of &and, &or, and &not."

Applying Dual to "a &implies b" gives:
`Logic:-&implies`(`&not`(a), `&not`(b))

But "a &implies b" is equivalent to "&not(a) &or b" and its Dual would be "&not(a) &and b", which is not equivalent to the result Maple returns.

Best regards,
Anthei

## Is our substitution is Ok...

restart;
u := (H(x, t, z)+sqrt(R))*exp(I*R*x);
/              (1/2)\
\H(x, t, z) + R     / exp(I R x)

I*(Diff(u, z))+Diff(u, `\$`(x, 2))+Diff(u, `\$`(t, 2))+(abs(u)*abs(u))*u-((abs(u)*abs(u))*abs(u)*abs(u))*u;
/ d  //              (1/2)\           \\
I |--- \\H(x, t, z) + R     / exp(I R x)/|
\ dz                                   /

/ 2                                   \
|d  //              (1/2)\           \|
+ |-- \\H(x, t, z) + R     / exp(I R x)/|
\                                     /

/ 2                                   \
|d  //              (1/2)\           \|                  2
+ |-- \\H(x, t, z) + R     / exp(I R x)/| + (exp(-Im(R x)))
\                                     /

2
|              (1/2)|  /              (1/2)\
|H(x, t, z) + R     |  \H(x, t, z) + R     / exp(I R x) -

4
4 |              (1/2)|  /              (1/2)\
(exp(-Im(R x)))  |H(x, t, z) + R     |  \H(x, t, z) + R     /

exp(I R x)
value(%);
/ d            \              / d  / d            \\
I |--- H(x, t, z)| exp(I R x) + |--- |--- H(x, t, z)|| exp(I R x)
\ dz           /              \ dx \ dx           //

/ d            \
+ 2 I |--- H(x, t, z)| R exp(I R x)
\ dx           /

/              (1/2)\  2
- \H(x, t, z) + R     / R  exp(I R x)

/ d  / d            \\                             2
+ |--- |--- H(x, t, z)|| exp(I R x) + (exp(-Im(R x)))
\ dt \ dt           //

2
|              (1/2)|  /              (1/2)\
|H(x, t, z) + R     |  \H(x, t, z) + R     / exp(I R x) -

4
4 |              (1/2)|  /              (1/2)\
(exp(-Im(R x)))  |H(x, t, z) + R     |  \H(x, t, z) + R     /

exp(I R x)
simplify(%);
/ d            \              / d  / d            \\
I |--- H(x, t, z)| exp(I R x) + |--- |--- H(x, t, z)|| exp(I R x)
\ dz           /              \ dx \ dx           //

/ d            \                 2
+ 2 I |--- H(x, t, z)| R exp(I R x) - R  exp(I R x) H(x, t, z)
\ dx           /

(5/2)              / d  / d            \\
- R      exp(I R x) + |--- |--- H(x, t, z)|| exp(I R x)
\ dt \ dt           //

2
|              (1/2)|
+ exp(-2 Im(R x) + I R x) |H(x, t, z) + R     |  H(x, t, z)

2
|              (1/2)|   (1/2)
+ exp(-2 Im(R x) + I R x) |H(x, t, z) + R     |  R

4
|              (1/2)|
- exp(-4 Im(R x) + I R x) |H(x, t, z) + R     |  H(x, t, z)

4
|              (1/2)|   (1/2)
- exp(-4 Im(R x) + I R x) |H(x, t, z) + R     |  R
collect(%, exp(I*R*x));
/  (5/2)       / d            \      2
|-R      + 2 I |--- H(x, t, z)| R - R  H(x, t, z)
\              \ dx           /

/ d            \   / d  / d            \\
+ I |--- H(x, t, z)| + |--- |--- H(x, t, z)||
\ dz           /   \ dx \ dx           //

/ d  / d            \\\
+ |--- |--- H(x, t, z)||| exp(I R x)
\ dt \ dt           ///

2
|              (1/2)|
+ exp(-2 Im(R x) + I R x) |H(x, t, z) + R     |  H(x, t, z)

2
|              (1/2)|   (1/2)
+ exp(-2 Im(R x) + I R x) |H(x, t, z) + R     |  R

4
|              (1/2)|
- exp(-4 Im(R x) + I R x) |H(x, t, z) + R     |  H(x, t, z)

4
|              (1/2)|   (1/2)
- exp(-4 Im(R x) + I R x) |H(x, t, z) + R     |  R

## How to collect exp(I*(Omega*t-k*x-z*k[1])) and exp...

restart;
H := a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]));
I*(diff(H, z))+diff(H, x, x)+diff(H, t, t)+R*(H+conjugate(H))+R^2*(H+conjugate(H))*H;
value(%);
simplify(%);

 > restart;
 > H := a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]));

 > I*(diff(H, z))+diff(H, x, x)+diff(H, t, t)+R*(H+conjugate(H))+R^2*(H+conjugate(H))*H;

 > value(%);

 > simplify(%);

 >

## How to find the minimum value of the real part of ...

Please, how do I find the minimum of the real part of a complex function? I tried min ( ) function it didn't work.

Find attached the fileFinding_min_zero.mw

Import packages

 > restart: with(ArrayTools): with(Student:-Calculus1): with(LinearAlgebra): with(ListTools):with(RootFinding):with(ListTools):

Parameters

 > gamma1 := .1093: alpha3 := -0.1104e-2: k[1] := 6*10^(-12): d:= 0.2e-3: xi:= -0.01: theta0:= 0.1e-3: eta[1]:= 0.240e-1: alpha:= 1-alpha3^2/(gamma1*eta[1]): c:= alpha3*xi*alpha/(eta[1]*(4*k[1]*q^2/d^2-alpha3*xi/eta[1])): theta_init:= theta0*sin(Pi*z/d): n:= 10:

Assign g for q and plot g

 > g := q-(1-alpha)*tan(q)-c*tan(q): plot(g, q = 0 .. 3*Pi, view = [DEFAULT, -30.. 10]);

Set q as a complex

Assume  and subsitute the result into g and equate the real and complex part to zero, and solve for x and y.

 > f := subs(q = x+I*y, g): b1 := evalc(Re(f)) = 0: b2 := evalc(Im(f)) = 0:

Compute the Special Asymptotes

This asymptote is coming from the  from the definition of

 > qstar := (fsolve(1/c = 0, q = 0 .. infinity)):

Compute Odd asymptote

First, Since , then an asymptote occurs at  In general, we have

Next, we compute the entry of the Oddasymptotes that is close to qstar (special asymptote) as assign it to
ModifiedOaddAsym, and then find the minimum of the ModifiedOaddAsym. Searchall Function returns

the index of an entry in a list.

 > OddAsymptotes := Vector[row]([seq(evalf((1/2*(2*j+1))*Pi), j = 0 .. n)]); ModifiedOddAsym := abs(`~`[`-`](OddAsymptotes, qstar)); qstarTemporary := min(ModifiedOddAsym); indexOfqstar2 := SearchAll(qstarTemporary, ModifiedOddAsym); qstar2 := OddAsymptotes(indexOfqstar2);
 (4.2.1)

Compute x and y

Here, we solve for and  within the min. and max. of qstar2 and qstar, and substitute the results into .

 > AreThereComplexRoots := type(true, 'truefalse'); try    soln1:= fsolve({b1, b2}, {x = min(qstar2, qstar) .. max(qstar2, qstar), y = 0 .. infinity});    soln2:= fsolve({b1, b2}, {x = min(qstar2, qstar) .. max(qstar2, qstar), y = -infinity .. 0});    qcomplex1 := subs(soln1, x+I*y);    qcomplex2 := subs(soln2, x+I*y); catch:    AreThereComplexRoots := type(FAIL, 'truefalse'); end try;
 (4.3.1)

Compute the rest of the Roots

In this section we compute the roots between each asymptotes.

 > OddAsymptotes := Vector[row]([seq(evalf((1/2)*(2*j+1)*Pi), j = 0 .. n)]); AllAsymptotes := sort(Vector[row]([OddAsymptotes, qstar])); if AreThereComplexRoots then gg := [qcomplex1, qcomplex2, op(Roots(g, q = 0.1e-3 .. AllAsymptotes[1])), seq(op(Roots(g, q = AllAsymptotes[i] .. AllAsymptotes[i+1])), i = 1 .. n)]; elif not AreThereComplexRoots then gg := [op(Roots(g, q = 0.1e-3 .. AllAsymptotes[1])), seq(op(Roots(g, q = AllAsymptotes[i] .. AllAsymptotes[i+1])), i = 1 .. n)]; end if:
 (4.4.1)

Remove the repeated roots if any

 > qq := MakeUnique(gg):

Redefine n

 > m := numelems(qq):

Compute the time constants

 > for i to m do p[i] := gamma1*alpha/(4*k[1]*qq[i]^2/d^2-alpha3*xi/eta[1]); end do;
 (4.7.1)

Minimum of the Re()

 > for i to m do p[i] := min(Re(gamma1*alpha/(4*k[1]*qq[i]^2/d^2-alpha3*xi/eta[1]))); end do;
 (4.7.1.1)
 > ## I expected 0.20459 but return all the entries in the list.

## simplifying the expression...

I try to simplify the expression by putting exponential function into equation but the maple shows error which I can't fix it.simplification.mw

## finding the solution as f approaches to zero...

I am trying to find the solution (\Psi) as approaches zero. However, after applying the limit the solution becomes zero. See the attached .mw file.limit.mw

## Francis QR algorithm...

I have tried a code in python for Francis QR algorithm but didn't desire the result. I don't know if it is possible to code in maple.

Given that A^0 = [[3.0, 1.0, 4.0], [1.0, 2.0, 2.0], [0., 13.0, 2]].

1. Write a little program that computes 1 step of Francis QR and test your program by starting from

A^0 = [[3.0, 1.0, 4.0], [1.0, 2.0, 2.0], [0., 13.0, 2]]  and compute A^1, A^2 ...A^6.

I expected to get:

A^0 = [[3.0, 1.0, 4.0], [1.0, 2.0, 2.0], [0., 13.0, 2]],

A^1 = [[3.5,  -4.264, 0.2688], [-9.206, 1.577, 9.197], [0., -1.41, 1.923]],

... A^6 = [[8.056,  1.596, 8.584], [0.3596, -2.01, -7.86], [0., 2.576*10^(-16), 0.9542]].

But didn't get the same results.

Here is my python code:

# Import packages
import numpy as np
from numpy.linalg import qr # QR from Linear Algebra Library
import scipy.linalg   # SciPy Linear Algebra Library

A = np.array([[3.0, 1.0, 4.0], [1.0, 2.0, 2.0], [0., 13.0, 2]])
p = [1, 2, 3, 4, 5, 6]
for i in range(30):
q, r = qr(A)
a = np.dot(r, q)
if i+1 in p:
print("Iteration {i+1}")
print(A)

I would really appreciate your help.

Thank you.

 First 8 9 10 11 12 13 14 Last Page 10 of 87
﻿