MaplePrimes Questions

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.

I describe my problem accurately in mws file. I have a step function
 

First step. This is f(x) function

 

 

f := piecewise(-2 <= x and x < -1, 1, -1 <= x and x < 0, -1, 0 <= x and x < 1/2, 2, 1/2 <= x and x < 1, -2, 0)

piecewise(-2 <= x and x < -1, 1, -1 <= x and x < 0, -1, 0 <= x and x < 1/2, 2, 1/2 <= x and x < 1, -2, 0)

(1)

Next step. I try to approximate this function f(x) using wavelet transform, and  I  want to decomposite this function, choose wavelet Haar function and scaling functon  , choose basisn funtion from multiresolution analysis of the Lebesgue space  L^2(R). I choose  such wavelet fucntion `&varphi;`(x) from space MRA V0 and scaling function psi(x)from space MRA V0:NULL

`&varphi;__0` := piecewise(0 < x and x < 1/2, 1, 1/2 < x and x < 1, -1, 0)

piecewise(0 < x and x < 1/2, 1, 1/2 < x and x < 1, -1, 0)

(2)

`&psi;__0` := piecewise(0 < x and x < 1, 1, 0)

piecewise(0 < x and x < 1, 1, 0)

(3)

After I try approximate initial function f(x), decomposed using such contruction:

"f(x) =(&sum;) (&sum;)`C__m,k` `&varphi;__m,k`(x)  &approx;   f(x) =(&sum;)`C__i` `&varphi;__i` (x-k)"

"f(x) = (&sum;) (&sum;)`D__m,k` `psi__m,k`(x)    &approx;   f(x)=(&sum;)`D__i` `psi__i` (x-k)"

where coeff m shows, space MRA, to which the basis function belongs, and kk shows,basis function shift (x-k)

i.e. I try decompose function respective to basis function, where coeffs calculate the such way:

`C__m,k` = int(f(x)*`&varphi;__m,k`(x), x = -infinity .. infinity)

`D__m,k` = int(f(x)*`&psi;__m,k`(x), x = -infinity .. infinity)

The approximation is considered satisfactory if the following condition is  true:

sup = LinearAlgebra[Norm](f(x)-(sum(sum(`C__m,k`*`&varphi;__m,k`(x), k = 0 .. infinity), m = 0 .. infinity))) and LinearAlgebra[Norm](f(x)-(sum(sum(`C__m,k`*`&varphi;__m,k`(x), k = 0 .. infinity), m = 0 .. infinity))) <= .1

sup = LinearAlgebra[Norm](f(x)-(sum(sum(`D__m,k`*`&psi;__m,k`(x), k = 0 .. infinity), m = 0 .. infinity))) and LinearAlgebra[Norm](f(x)-(sum(sum(`D__m,k`*`&psi;__m,k`(x), k = 0 .. infinity), m = 0 .. infinity))) <= .1

For example `&varphi;__i` calculate that such way:

`&varphi;i` := proc (j, k, t) local a, b, c, m; m := 2^j; a := k/m; b := (k+1/2)/m; c := (k+1)/m; return piecewise(a <= t and t < b, 1, b <= t and t < c, -1) end proc

if `&varphi;__i`the wavelet Haar functions:

`&varphi;__i` := piecewise(a <= x and x < b, 1, b <= x and x < c, -1, 0)

piecewise(a <= x and x < b, 1, b <= x and x < c, -1, 0)

(4)

a = k/m, b = (k+.5)/m, c = (k+1)/m

Then vector of Haar functions compute using the follow code:

N := 2^J; `&varphi;d` := Vector(N); H := Matrix(N, N); T := Vector(N); `&varphi;d`[1] := `&varphi;1`(t); for i to N do T[i] := (i-1/2)/N end do; for j from 0 to J-1 do m := 2^j; for k from 0 to m-1 do i := m+k+1; `&varphi;d`[i] := `&varphi;i`(j, k, t) end do end do; for i to N do for j to N do H[i, j] := eval(`&varphi;d`[i], t = T[j]) end do end do

``

Then integrals

`&approx;`(int(`&varphi;__m,k`(x), x = -infinity .. infinity), `p__d,1`(x)) and `p__d,1`(x) = int(`&varphi;__d`(x), x = 0 .. x) and `&approx;`(int(`&varphi;__d`(x), x = 0 .. x), `P__d `*`&Phi;__d`)

`&approx;`(int(`&psi;__m,k`(x), x = -infinity .. infinity), `p__d,1`(x)) and `p__d,1`(x) = int(`&psi;__d`(x), x = 0 .. x) and `&approx;`(int(`&psi;__d`(x), x = 0 .. x), `P__d `*`&Psi;__d`)

where `P__d ` is an d-square matrix called an operational matrix of integration

pn := proc (i, n, t) if n = 1 then return int(`&varphi;d`[i], t) end if; return int(pn(i, n-1, t)) end proc

NULL

And now, it's not working, so I have troubles for calculate coeffs and writing and  plotting this result, so, I have some questions:

1) How to calculate coeffs `C__m,k`and `D__m,k`  for my fucntion f(x) and get value of coeffs?
2) How to implement integration and write the final sum (approximation of function f(x)?

3) How to calculate  

LinearAlgebra[Norm](f(x)-(sum(sum(`C__m,k`*`&varphi;__m,k`(x), k = 0 .. infinity), m = 0 .. infinity)))

LinearAlgebra[Norm](f(x)-(sum(sum(`D__m,k`*`&psi;__m,k`(x), k = 0 .. infinity), m = 0 .. infinity)))

and plot initial function f(x) and approximation sum at one plot?
 

Do I understand correctly that I need to calculate this integral for my function on each interval of my function?

int(`&varphi;__m,k`(x), x = -2 .. -1); int(`&varphi;__m,k`(x), x = -1 .. 0); int(`&varphi;__m,k`(x), x = 0 .. 1/2); int(`&varphi;__m,k`(x), x = 1/2 .. 1)

int(`&psi;__m,k`(x), x = -2 .. -1); int(`&psi;__m,k`(x), x = -1 .. 0); int(`&psi;__m,k`(x), x = 0 .. 1/2); int(`&psi;__m,k`(x), x = 1/2 .. 1)

How to implement this procedure?


Code for calculating procs a I try ude from this source: http://www.m-hikari.com/ams/ams-2012/ams-125-128-2012/sunmonuAMS125-128-2012.pdf

Download LR1.mw

I would be very grateful for any help!

Electric circuit problem.
How to solve this four resistors circuit by Syrup? ... EDIT; This is not my electric circuit problem. My exercise how to use Maple. Below is the problem.

This electric circuit problem is very hard to solve. Maple or other math program must need to solve.

How to make one ohm by using one-ohm resistors while each resistor must flow different current.

Using 1 A current source, node 1 shows 1 V.

The electric circuit below shows 1 ohm, however, the current of each resistor is same.

So, this is not the answer.

NULL

restart; with(Syrup); ckt := [-Iin(1), `&//`(R1(1), R2(1)), `&//`(R3(1), R4(1))]; Draw(ckt)

 

NULL

Download Make_one_ohm_by_one_ohm.mw

Hello,

In the code below I would expect the a-bar to be replaced in, just like the b below it. Is there something i'm missing here? I applied the bar using the Maple accent palette.

I knew it can't be true that timelimit in Maple 2022 no longer hangs and it is only a matter of time before I find a case where it still hangs.

Here are examples. timelimit hangs. No error or anything, it just hangs. timelimit is just ignored. set the limit to 60 seconds  (CPU time), and waited for 20 minutes (real time) and nothing happend.

I hope in Maple 2023 this will be fixed. Could others confirm this? it only hangs when adding the method=_RETURNVERBOSE otherwise it does not hang.

interface(version);

`Standard Worksheet Interface, Maple 2022.0, Windows 10, March 8 2022 Build ID 1599809`

Examples of timelimit hangs in Maple 2022

 

Example 1

restart;

integrand:=(B*x+A)/(c*x^2+b*x+a)^2/(f*x^2+e*x+d)

try
  timelimit(60,int(integrand,x,method=_RETURNVERBOSE));
catch:
  print("Timed out");
end try;

 

Example 2

restart

integrand:=(5*x^4-x^3+3*x^2+x+2)*(2*x^2-x+3)^(1/2)/(5+2*x)^3

try
    timelimit(60,int(integrand,x,method = _RETURNVERBOSE));
catch:
  print("Timed out");
end try;

 

 

Download int_hangs.mw

This is a serious problem.

I change "how should maple handle the creation of new math engine?" to "Create new engine for each document". Then click on "Apply globally".  This is under Tools->Options->General

After I close Maple and start it again, I found it back to "Share one engine among all documents" ??

Why is that and how to make this permanent? 

Btw, the start Maple 2022 icon still says "Maple 2022 shared server". THis is in the start program menu. I complained about this in Maple 2021 but it is still not fixed.  https://www.mapleprimes.com/questions/231901-Why-Maple-2021-Only-Shows-shared-Server

I do not think this has anything to do with it. But who knows.

I noticed this when I started new worksheet and could not do anything in it because another worksheet was running something even though I made sure I had set the engine to start new one for each worksheet (this is the very first thing I do after I install Maple each time).

Any workaround to make the setting for the engine not change after closing Maple?

Windows 10. Maple 2022.

This was very surprising!!

x:=3;
                               3
g:=x;h:=x^2;
                               3
                               9
subs(x=4,g);subs(x=4,h);
                               4
                               9

This is inconsistent! After g and h have been assigned values, they do not depend on x anymore, so g should not be turned into 4 by subs

How to draw a streamlined pattern of contour plot like this

The ODE is given by

and boundary condition is

and 

Streamline function

Thanks and Regards

The Physics Update package install or upgrade via cloud is not working now. See the error code:

Fetching package "Physics Updates" from MapleCloud...
ID: 5137472255164416
Version: 1183
URL: https://maple.cloud

File size is 5148672 bytes(4 MB).

Installing package...
PackageTools:-Install("/tmp/cloudDownload17017141919364770870/Physics+Updates.maple",overwrite=true,pkgname="Physics Updates");

ERROR: The package could not be installed.
error PackageTools:-Install, "this package is intended to work with Maple %1; it can not be installed in the version you are using -- %2", "2022", "2021"

Same problem on Maple 2021 and Maple 2022 (linux and windows version).

Any help?

Dear all

I have a box contains 3 red balls and 3 white balls, we select one ball three times and we define Z to be  the number of red balls selected. 
Since, we selected three times a ball and we count the number of red balls selcted after this experiment, we have 
Z(Omega)={0,1,2,3}

Now, How CAN I determine the sigma algebra generated by Z ( which is a random variable). 
The following code  calculate the sigma algebra generated by any subset  A subset of global set X , 
I would like to use it, to verify the descripted experiment in probability. 

sigma_algebra_random_variable.mw

thank you 

I am trying to solve the following ode in Maple. Here is the code below 

dsolve(diff(b(x), x, x, x)/2 + diff(b(x), x, x)/x + 2*diff(b(x), x)/(x^2 + 1)^2 - 4*x*b(x)/(x^2 + 1)^3 = 0)

and the output I get is the following:

b(x) = DESol({-8*x^2*_Y(x) + (4*x^3 + 4*x)*diff(_Y(x), x) + (2*x^6 + 6*x^4 + 6*x^2 + 2)*diff(_Y(x), x, x) + (x^7 + 3*x^5 + 3*x^3 + x)*diff(_Y(x), x, x, x)}, {_Y(x)})

I don't understand what the function _Y(x) means. Could someone please explain? 

Thanks in advance!  

For example for an ellipsoid with principal axes 3, 2 and 1 along the x, y and z coordinate axes respectively, with center at the origin and truncated at x equals 1.

What math will reveal its center of mass and its moment of inertia for an axis of revolution through the center of mass and parallel to the y axis?

I am trying to vopy paste a table of 10*20 from maple sheet to ms word but failed. His their any special way of copying tables from maple sheet to ms word without formating chnages?

Please, how can I find all the roots  of: (H/(Hc))^2 -(4*q^2)/Pi^2*((tan(q)- q/(1-alpha))/(tan(q)-q)) with q=(i-1)*Pi+Pi/2..i*Pi+Pi/2 for n=20.

See my attempt below:

restart:with(RootFinding):
a[1] := .1093; k[3] := 7.5*10^(-12); k[2] := 3.8*10^(-12); d := 0.2e-3; eta[1] := 0.240e-1; alpha[2] := -.1104; alpha[3] := -0.1104e-2; eta[2] := .1361; xi := 1.219*10^(-6); alpha := 1-alpha[3]^2/(a[1]*eta[1]); theta[0] := 0.5e-1;
Hc := (Pi/d)*sqrt(k[2]/xi):

H := 5.5*Hc;
lambda := a[1]/(xi*H^2);

RootFinding:-NextZero(proc (q) options operator, arrow; (H/(Hc))^2 -(4*q^2)/Pi^2*((tan(q)- q/(1-alpha))/(tan(q)-q)) end proc, 0);

for j to 9 do RootFinding:-NextZero(proc (q) options operator, arrow; H^2/Hc^2-4*q^2*(tan(q)-q/(1-alpha))/(Pi^2*(tan(q)-q)) end proc, %) end do;

Error, invalid input: RootFinding:-NextZero expects its 2nd argument, zz, to be of type numeric, but received FAIL

First 316 317 318 319 320 321 322 Last Page 318 of 2416