Items tagged with syntax syntax Tagged Items Feed

Hi Mapleprimes community,

 

I am a maple novice and was trying to write a procedure but cannot tell what my syntax error is.  I would greatly appreciate if anyone can point out what I did wrong or any improvement in the code that I can make.  Thanks

SLRrepeatedsample_pr.mw

 

Henry

One can do igcd(12,8), and igcd(16,3), etc...

But how to define a list/set/array/vector/matrix, etc... that contains these pair of numbers, and then call/map igcd on this list?

I tried putting the pair of values in a list and set and even a matrix, calling calling map(igcd, lst) but not getting it right.

The confusing part for me with Maple is to know which data structure to use for each function, since there are more than one. Here are my silly attempts:

lst:={{12,8},{16,3}};
map(igcd,lst);

lst:=<<12|8>,<16|3>>;
map(igcd,lst);

lst:=[{12,8},{16,3}];
map(igcd,lst);

I was looking for something like in Mathematica:

lst = {{12, 8}, {16, 3}};
GCD @@ lst

    {4, 1}

I am sure it is possible to do this in Maple (i.e. map igcd to list of pair of numbers), I just can't get the syntax right. I did look at few examples somewhat related, but did not understand what they are doing. They said I need to pass an extra argument for map in this case?

thank you

Solve Differential Equation: y''-3y'-4=e^xsin4x

Hi,

     I'm reading in a file as

eigvect:=ImportMatrix("C:\\Users\\Sorted_Eigenvectors_1.txt", source=csv):

but I want to generalize this to 

eigvect:=ImportMatrix("C:\\Users\\Sorted_Eigenvectors_i.txt", source=csv):

where i is a positive integer, I tried

eigvect:=ImportMatrix("C:\\Users\\Sorted_Eigenvectors_%d.txt",i, source=csv):

but this is incorrect. What is the correct syntax?

Thanks!

Hi,

I wonder if you could help me. I'm trying to calculate the eigenvalues of a complicated 3x3 matrix in Maple, but I'm not very familiar with Maple syntax. The answer maple has provided me with is in the form,

(&*(sin(pi*q/P),P/T,3x3 matrix))

How do I interpret this result? The eigenvalues are scalars.

Thanks for your help,

Sian

 

 

Hi everyone, I'm new to the forum and also new to Maple.

 

I am trying to do the following:

"Write a procedure, marks, to take a student’s mark and output the appropriate grade, based on the following table:"

Mark

0   – 39.99

The school computer labs use Maple 15. As it is a considerable drive for me to come in and use the lab during the hours I am not on campus, I picked up Maple 16. This has worked fine for me until today. I am trying to use the "polarplot" command to plot two equations r=8*cos(3θ) and r=4-2.5cos(θ). Doing so on the computer lab Maple 15 plots fine. When I do so on Maple 16 on my computer I get something different. If I switch the order of the equations on 16 I get...

In some cases if not always, "fi" can be used to close an "if" clause, instead of "end if" and "od" can be used to close a "do" clause, instead of "end do".

These short forms are intuitive and can save a lot of space; for instance say you have 5 "do" clauses to be closed, it is a lot shorter to type "od:od:od:od:od:" than  "end do:end do:end do:end do:end do:"

Yet for some reason it does not seem to be a recommended short form. The Advaced Programming Guide (dated 2008...

Hi,

I know all the necessary computational steps to create a Linear Regression line, but I am having trouble making it into a succient procedure. I have to make a 3 procedures for three methods, minimizing Vertical distance, Horizontal, and lastly, Diagonal. 

I uploaded an example of my work to compute a linear regression line, minizming vertical distance. I have all the necessary steps for horizontal and diaganol as well. 

 

 

My program is to compute the sequence of integrals of Jn = int(x^(2n)*sin(pi*x), x=0..1) for n=1...N to 10s.f where N=10.

This is my program but it keeps telling me it is missing an operator and I'm unsure why.

N:= 10:
In:= evalf(2/Pi):

for n from 0 by 1 to (N - 1) do

In:=evalf((1/(Pi^2))*(Pi-((2n+1)*(2n+2)*In))):

maple_In := evalf(Int((x^(2n))*sin(Pi*x), x = 0..1), 20):

printf( "%d %10.10f %10.10f %10.10f \n" , n + 1 , In , maple_In , abs( In - maple_In ...

When I solve a system of equations, the result, even if it's a single numerical solution, is no longer given as a number, but like this:

a := solve({x^2=1, x&gt;0}, x);

a:={x = 1}

Now i'd like to use the variable a with the value

I want to calculate above integral in Maple15,  the parameters n_1, n_2 and n_3 are all positive integers.
I tried to input the following command: int(int((1-x)*(1-y)(x+y)*(x^n_1)*(y^n_2)*(1-x-y)^n_3, y=0..1-x),x=0..1);

After I pressed enter it then appeared an error message: "Error, unable to match delimiters"

I am a transplant from to Mathematica to Maple and still getting used to things. Could somebody please help me finding the maximum of f with repect to the constraints and with the variables below. I keep getting  syntax error, no matter how many times I check the documentation page. Thank you very much

f:=1/((4 a - 3 M) (-4 b + 3 M)) (-9 M^3 - 16 a b x +
    12 a M x + 12 M^2 x + 16 b x^2 - 12 M x^2 + 12 b M y +
    12 M^2 y - 16 b x y - 16 M x y - 12 M y^2 + 16 x y^2)...

Hi,

I'm trying to use powsolve to give me the power series of a differential equation. It's been working wonderfully, afaik, but once I put in exp(x) it refuses to run. Here's my code:

 >with(powseries);

>a := powsolve(diff(y(x), x, x)+y*exp(x) = 0, y(0) = 1, (D(y))(0) = 2); tpsform(a, x)

 

and the error I'm getting:

Error, (in powseries:-powsolve) final value in for loop must be numeric or character
1 2 3 Page 1 of 3