MaplePrimes Questions

How to make this program more effective ?
 

A := [-3, 1, 2];
B := [-2, -1, 1];
C := [0, 3, -3];
                        A := [-3, 1, 2]

                        B := [-2, -1, 1]

                        C := [0, 3, -3]

alpha[1] := 2;#weight
alpha[2] := -1;
alpha[3] := 1;
                         alpha[1] := 2

                         alpha[2] := -1

                         alpha[3] := 1

x[1] := A[1];
x[2] := B[1];
x[3] := C[1];
                           x[1] := -3

                           x[2] := -2

                           x[3] := 0

y[1] := A[2];
y[2] := B[2];
y[3] := C[2];
                           y[1] := 1

                           y[2] := -1

                           y[3] := 3

z[1] := A[3];
z[2] := B[3];
z[3] := C[3];
                           z[1] := 2

                           z[2] := 1

                           z[3] := -3

sum(alpha[i], i = 1 .. 3);
                               2

xG := sum(alpha[i]*x[i], i = 1 .. 3)/sum(alpha[i], i = 1 .. 3);
                            xG := -2

yG := sum(alpha[i]*y[i], i = 1 .. 3)/sum(alpha[i], i = 1 .. 3);
                            yG := 3

zG := sum(alpha[i]*z[i], i = 1 .. 3)/sum(alpha[i], i = 1 .. 3);
                            zG := 0
Thank you.

Hello everybody! 

Since least squares is not fully understood by me all that well, and the way my Dutch book throws me into the deep whitout really showing how things are done, i decided to look for some videos on Least Squares in Maple on YouTube. Well, i did found one, but then this happened. "Error, (in sum) summation variable previously assigned, second argument evaluates to 1 = 1 .. 5" I just want to go further with the video, but now im stuck and i have no clue how to go on. 

https://youtu.be/8zh73UrJW6M?t=948 This is the video at the moment the part where i get stuck is shown. 

I really like these sort of videos while they really do help out. I think its great. 

This is my maple worksheet:


 

with(Statistics); with(CurveFitting); with(LinearAlgebra); with(Optimization); with(plots); interface(imaginaryunit = I)

I

(1)

"f(x):=b[0]+(∑)(b[k]*sin(k*x))"

proc (x) options operator, arrow, function_assign; b[0]+sum(b[k]*sin(k*x), k = 1 .. 5) end proc

(2)

X := [seq(3.*k*(1/10), k = 1 .. 10)]

[.3000000000, .6000000000, .9000000000, 1.200000000, 1.500000000, 1.800000000, 2.100000000, 2.400000000, 2.700000000, 3.000000000]

(3)

Y := map(proc (x) options operator, arrow; x^2 end proc, X)

[0.9000000000e-1, .3600000000, .8100000000, 1.440000000, 2.250000000, 3.240000000, 4.410000000, 5.760000000, 7.290000000, 9.000000000]

(4)

F := CurveFitting:-LeastSquares(X, Y, x, curve = f(x))

HFloat(9.017880939782968)-HFloat(7.700034497920161)*sin(x)-HFloat(3.0589327899122045)*sin(2.*x)-HFloat(1.6899646233017431)*sin(3.*x)-HFloat(1.40247653582845)*sin(4.*x)-HFloat(0.82531550630546)*sin(5.*x)

(5)

smartplot(HFloat(9.017880939782968)-HFloat(7.700034497920161)*sin(x)-HFloat(3.0589327899122045)*sin(2.*x)-HFloat(1.6899646233017431)*sin(3.*x)-HFloat(1.40247653582845)*sin(4.*x)-HFloat(0.82531550630546)*sin(5.*x))

 

display(data, plot(f(x), x = 0 .. 3))

Warning, expecting only range variable x in expression b[0]+b[1]*sin(x)+b[2]*sin(2*x)+b[3]*sin(3*x)+b[4]*sin(4*x)+b[5]*sin(5*x) to be plotted but found names [b[0], b[1], b[2], b[3], b[4], b[5]]

 

Error, (in plots:-display) expecting plot structure but received: data

 

data := LinearAlgebra:-Transpose(`<,>`(`<|>`(.3000000000, .6000000000, .9000000000, 1.200000000, 1.500000000, 1.800000000, 2.100000000, 2.400000000, 2.700000000, 3.000000000), `<|>`(0.9000000000e-1, .3600000000, .8100000000, 1.440000000, 2.250000000, 3.240000000, 4.410000000, 5.760000000, 7.290000000, 9.000000000)))

Matrix(%id = 18446746050376108382)

(6)

p1 := plot(data, style = point, color = "green")

 

display(p1, plot(F, x = 0 .. 3), plot(x^2, x = 0 .. 3, color = "black"))

 

with(CurveFitting)

``

CurveFitting[Interactive](X, Y)

9.01788093978297-7.70003449792016*sin(x)-3.0589327899122*sin(2.*x)-1.68996462330174*sin(3.*x)-1.40247653582845*sin(4.*x)-.82531550630546*sin(5.*x)

(7)

smartplot(9.01788093978297-7.70003449792016*sin(x)-3.0589327899122*sin(2.*x)-1.68996462330174*sin(3.*x)-1.40247653582845*sin(4.*x)-.82531550630546*sin(5.*x))

 

with*LinearAlgebra

LinearAlgebra:-LeastSquares({Equate(`~`[f](X), Y)[]}, {seq(b[k], k = 0 .. 5)})

{b[0] = HFloat(9.017880939782952), b[1] = HFloat(-7.700034497920145), b[2] = HFloat(-3.0589327899122054), b[3] = HFloat(-1.6899646233017416), b[4] = HFloat(-1.4024765358284492), b[5] = HFloat(-0.8253155063054547)}

(8)

A, v := LinearAlgebra:-GenerateMatrix(Equate(`~`[f](X), Y), [seq(b[k], k = 0 .. 5)]); LinearAlgebra:-LeastSquares(A, v)

Vector[column](%id = 18446746050376098150)

(9)

Optimization:-LSSolve([v, A])

[2.61443732196701051, Vector[column](%id = 18446746050376094654)]

(10)

Optimization:-LSSolve([seq(f(X[k])-Y[k], k = 1 .. 10)])

Error, (in sum) summation variable previously assigned, second argument evaluates to 1 = 1 .. 5

 

NULL


Thank you very much! 

Greetings,

 

The Function
 

Download Least-Squares_Fitting_in_Maple_video.mw

Is there a way to execute an entire worksheet for a list of values of a parameter.
Sometimes executing in the standard loop can be cumbersome given you have to add catch statements for errors to prevent the loop from stopping.

Hi,

I'm not able to find a way to bring an equation into it's "polynomial" form:

I'd like this expression in the form of:

c1*v^3+c2*v^2+c1*v+c0 = 0

where c1...c4 are my coefficients

How can I do that? 

Hello guys
I'm having trouble converting the RootOf function. Attached is a simple notebook.

Sincerely,

Oliveira

Example.mw

Dear Maple Users:

Could you help in the following question?

How do I use a symbol as a subscript, e.g.  A_*, to label an axis?

X := vector([seq(x, x = 1 .. 5)]);
Y := vector([seq(x, x = 6 .. 10)]);
X[1];
Y[1];
Yfactor := evalf(X[`1`])/Y[`1`];
evalf(Yfactor);
                      X := [1, 2, 3, 4, 5]

                     Y := [6, 7, 8, 9, 10]

                               1

                               6

                                         X[1]
                        Yfactor := -------
                                         Y[1]

                              X[1]
                              ----
                              Y[1]

m := 1;
X := vector([seq(x, x = 1 .. 5)]);
Y := vector([seq(x, x = 6 .. 10)]);
Yfactor := X[m]/Y[m];
evalf(Yfactor);
                             m := 1

                      X := [1, 2, 3, 4, 5]

                     Y := [6, 7, 8, 9, 10]

                                           1
                          Yfactor := ---
                                           6

                          0.1666666667

hi guys,

suppose we have general metric form in 4-D. I want to calculate Covariant derivative of Riemann, Ricci and Weyl tensors.

please help me.

with best,

I dont know why I could not solve this problem.

I have attached my worksheet.

Please anyone help me to get solution to this problem.

Thank you so much

fypppp.mw

DLMF offers different encodings for mathematical expressions. Example:

 

I was wondering if TeX or pMML (never seen before)  can be imported into Maple and subsequently be used as  Maple Input.

When taking notes I sometimes use the palette to insert a matrix into a worksheet. When I do this, the main aspect that is useful to me is being able to visualize matrix expressions as I would write them.

I would like to do the same but for determinants of matrices. Is there a way to get almost the same thing as with the matrix palette, but with vertical bars denoting a determinant rather than the brackets used for matrices?

How do we compute integrals of functions or expressions that have units attached?
For example

v__1 := proc (t) options operator, arrow; 3*Unit('m'/'s') end proc

proc (t) options operator, arrow; 3*Unit('m'/'s') end proc

(1)

v__2 := 4*Unit('m'/'s')

4*Units:-Unit(m/s)

(2)

s__1 := int(v__1(t), t = 0 .. 5)

15*Units:-Unit(m/s)

(3)

s__2 := int(v__2, t = 0 .. 5)

20*Units:-Unit(m/s)

(4)

NULL


The results of the integrals have the wrong units.

Download integration_with_units.mw

I have X=+-1,

and I want to calculate X^n.

 Thank's

Dear members of the forum, please tell me if it is possible to calculate the series presented below by Maple 2022. As far as I understand, first you need to calculate the inner and then the outer sum, but I don’t know how to do this with the help of the program, this series does not converge, as it seems to me, but I can be wrong, if the series diverges, then I need to show it.

Sorry for my ignorance, but maybe I wrong apply such commands for calculation this sums:

Sum(F, a = 1 .. infinity, b = 1 .. infinity) = DefiniteSummation(F, a = 1 .. infinity, b = 1 .. infinity)

I understand, that Sum () not be able to recive more than one args, but I don't understand how to make this calculation...

Any idea? Thanks for advices and help!

Dear All,

I have an executable program which I have generated with Fortran. Is it possible to run such a program from Maple? It sounds a bit weird but that would simplify my computation, since I would not need to use scripts in Linux. Thank you very much.

Cheers.

First 119 120 121 122 123 124 125 Last Page 121 of 2308