## plotting multiple graphs on the same plot?...

work.mw

I'm having problems plotting these three functions on the same graph. I can get two of them, but as soon as I try to add the third, it throws a couple errors no matter what I do. It doesn't help that the docs are confusing. The first two functions are approximating diff(y(x),x) = -2xy(x)+1 with the Euler method (step size of 0.05 and 0.1) that I implemented using a for loop. I gather the data into an array and then plot those. That works. But once I try to set y(x) equal to a Taylor approximation, I can plot that graph but the values for the other functions are strangely absent. I've attached my work. What is wrong with my syntax and how can I plot all three functions at once?

## How to specify plot range via value?...

I want to plot a function f(x,y)=x^3-2x^2y. But I only want to plot values where $x^2+y^2 <= 1$. So far I specified the plotting range in the standard way, but I really need to specify it like I described. I want to use plot3d.

## Solving system of Pdes...

Hello,

How can we write a code for solving following system of Pdes ?

restart;
PDE1:=m1*diff(w1(x,t),t$2)-S1*diff(w1(x,t),x$2)+k*(w1(x,t)-w2(x,t))=F1(t)*delta(x-x1);
PDE2:=m2*diff(w2(x,t),t$2)-S2*diff(w2(x,t),x$2)+k*(w2(x,t)-w1(x,t))=F2(t)*delta(x-x2);


In here,  Ki, mi, xi and k are constants where i=1,2.

Since F1(t) and F2(t) are unspecified (ungiven) functions, solutions u1,u2 which we seek, will be depended on  F1(t) and F2(t).

## Elements and length of a PolynomialIdeal!...

When one uses the PolynomialIdeals package, then how should he ask the elemnts in an ideal or the number of generators?

An idea can be writing a proc getting a polynomialideal and returning a list with the generators as its elements in this way. Converting the polynomialideal to a list, then deleting its three last entries. But I'm wondering if there is any other way to do this? It's reasonable to be able to ask generators of an ideal of result of some computations in polynomialideal package.

## Labeling axis at desired distance (change the defa...

Dear Maple users,

I want to label Y axis such that it doesn't encroach the numbers. The figure below illustrates the difficulty I am facing. How can I change the default setting to put letter '\bar{U}' at some distance from Y axis so that it doesn't look crowded? Thanks.

Edit. One crude way to do this is by using typesetting command.

labels = [log(n), typeset(conjugate(U), " ")]

## error writing diff. equ....

i am trying to write the differential equation

u_{t}=u_{xx}+2u^{2}(1-u) in my maple 15.

but it shows error,

Error, empty number and  1 additional error.

## Lattice Package Updated

by: Maple

The Lattice package to investigate particle accelerator magnet lattices (original post) has been updated to V1.1. This is a significant update, addressing a number of inaccuracies and bugs of V1.0 as well as introducing new elements: Octupole, Fringe effect in dipoles, a MatchedSection allowing to insert a piece of beamline when the details are irrelevant, and a few experimental elements like WireQuad. New functions include the 6th synchrotron-radiation integral I6x, momentum compaction alphap and TaylorMap, which allows to compute the Taylor expansion of  the non-linear map to any degree.

The code and documentation are available in the Application Center.

U. Wienands, aka Mac Dude

## Finding better adjusted r-squared values by removing...

by: Maple

A couple of weeks ago, I recorded a short video that discussed various applications for the Statistics:-Fit command. One of the more interesting examples examined how manually adjusting the number of parameters used for a regression model affected the resulting adjusted r-squared value.

I won’t go into detail about r-squared here, but to briefly summarize: In a linear regression model, r-squared measures the proportion of the variation in a model's dependent variable explained by the independent variables. Basically, r-squared gives a statistical measure of how well the regression line approximates the data. R-squared values usually range from 0 to 1 and the closer it gets to 1, the better it is said that the model performs as it accounts for a greater proportion of the variance (an r-squared value of 1 means a perfect fit of the data). When more variables are added, r-squared values typically increase. They can never decrease when adding a variable; and if the fit is not 100% perfect, then adding a variable that represents random data will increase the r-squared value with probability 1. The adjusted r-squared attempts to account for this phenomenon by adjusting the r-squared value based on the number of independent variables in the model.

The formula for the adjusted r-squared is:

Where:

n is the number of points in the data sample

k is the number of independent variables in the model excluding the constant

By taking the number of independent variables into consideration, the adjusted r-squared behaves different than r-squared; adding more variables doesn’t necessarily produce better fitting models. In many cases, more variables can often lead to lower adjusted r-squared values. In particular, if you add a variable representing random data, the expected change in the adjusted r-squared is 0.

As such, the adjusted r-squared has a slightly different interpretation than the r-squared. While r-squared is perceived to give an indication of the measure of fit for a chosen regression model, the adjusted r-squared is perceived more as a comparative tool that can be useful for picking variables and designing models that may require less predictors than other models. The science of “gaming” models is a broad topic, so I won’t go into any more detail here, but there’s lots of great information out there if you are looking to learn more (here’s a good place to start).

The following example adjusts a fitted model by adding or removing variables in order to find better adjusted r-squared values.

with(Statistics):

The Import command reads a datafile into a new DataFrame.

ExperimentalData := Import(FileTools:-JoinPath(["Excel", "ExperimentalData.xls"], base = datadir));

The dataset has seven variables: time and experimental readings for 6 various concentrations. Removing “time” from our variable set, the convert command converts the values in the DataFrame to a Matrix of values.

ExMat := convert( ExperimentalData, Matrix )[..,2..7];

We start by fitting a model that includes predicting variables for each of the columns of data. We mark “Concentration A” as our dependent variable.

Fit( C + C2*v + C3*w + C4*x + C5*y + C6*z, ExMat[..,2..6], ExMat[..,1], [v,w,x,y,z], summarize=embed ):

From the above, we can observe that both the r-squared and adjusted r-squared are reasonably high, however only one of the coefficient values has a significant p-value, C3.

Note: Maple shows all p-values less than 0.05 in bold.

Let's try to fit the data again, this time keeping the two coefficients with the lowest p-values and the intercept.

Fit( C + C3*v + C5*w, ExMat[..,[3,5]], ExMat[..,1], [v,w], summarize=embed ):

From the above, we can see that the r-squared value does go down, however the adjusted r-squared goes up! Let's fit the model one last time to see if removing C5 increases or decreases the adjusted r-squared.

Fit( C + C3*v, ExMat[..,3], ExMat[..,1], [v], summarize=embed ):

We can see that the final adjusted r-squared value is lower than the previous two, so we are probably better to keep the additional C5 coefficient value.

You can see this example as well as a couple of other examples of using the Fit command in the following video: https://www.youtube.com/watch?v=YWRgRvlJpjY

## How to program a for loop inside a procedure and m...

I'm trying to program a procedure that will return me a list of positions defining equally spaced points (planets) around a circumference, for example:
PSI := [0, Pi]; # Location of 2 planets
PSI := [0, ((2/3)*Pi) , ((4/3)*Pi) ]; # For 3 Planets
I'm new to maple so most commands are new to me, I tried building the size of the list with [0 $n] because I want the first position to always be at 0 degrees. The first problem is that I get this error:  > nplanets := 2;  (1)  > make_PSI := proc(nplanets); local n,psin,i,PSI: n = nplanets; psin :=(pi*2)/n; PSI := [0$ n]; for i from 1 to n do  angle :=(psin*i);  op(i,PSI) := angle; end do; end;
 >
 >

## Strange change of characters...

If I let Maple be running on the computer for a while, maybe a day or 2 or so, I almost certainly get a change of several

characters. See my favourite palette:

As you can see the eternity sign e.g changes to a big N. If I rerun the worksheet everything works ok except for the change of characters.

Not seen above: :=  changes to d

Remedy?

## how I can pdsolve three equations...

hello...how I can pdsolve three equations with related boundary conditions?

thanks...

 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 > partial equations
 >
 >
 >
 > # BOUNDARY CONDITIONS
 >
 >
 >
 >
 >

hello...how I can pdsolve three equation with related boundary conditions?

thanks...

for_site.mw

## Unable to find where in my code "Thaw" is being ca...

Hello,

I'm having trouble seeing which command is calling the "thaw" for the code below and was wondering if someone is able to save me the trouble from working it out myself. i know its not when the "is" function is called from viewing the showstat for it, but the output prior to mapping that function pops out with no troubles, so im guessing its the generic mapping proc, but of course, in built function so i can only assume its the same way i would write it but im pretty sure i dont use thaw either so anyway the line in question:

map(is, seq(seq(map(eval, Matrix(3, omega[1]) = Matrix(3, omega[0]), [n = i, m = j]), i = 1 .. 10), j = 1 .. 10));
Error, (in thaw) too many levels of recursion

## how to calculate Gibbons-Hawking boundary term for...

Hi guys ,

i have a manifold ( schwarzschild spacetime ) which want to find Gibbons-Hawking boundary term.

boundary.mw

## Maple corrupts string larger than one million when...

Maple 2017.1 on windows 7.

This is VERY frustrating. If I have a string which is too long (do not blame me, it is Maple's output), and  try to save it to text file using fprintf(), then Maple decides to insert CARRIAGE RETURN at about each 1,000,000 characters intervals.

So if the string happened to be 5 million chars, and instead of getting one long line in the file for this one result, It writes 5 lines in the file.

Becuase of this, I can't postprocess this output, since the program that reads the file expects one line per one result. So it fails to parse it. And having to post process the file to correct this is not easy at all.

Why is there a limitation of writing long string to a file without it being chopped of like this? Is there a way to work around this? Here is a MWE

restart;
directory("C:\\bug");
result:=int((a+b*tan(e*x+d)+c*tan(e*x+d)^2)^(1/2)*tan(e*x+d)^2,x):
result_as_string:=convert(result,string):
fd := fopen("out.txt",WRITE):
fprintf(fd,"%s\n",result_as_string);
fclose(fd);


As you can see, I wrote the result as one string. Now if you look at the file out.txt in the directory (you might want to use good editor for this, such as vi or textedit), you will see many lines in there, and not one long line as expected. Or you can run this code

restart;
directory("C:\\bug");
number_of_lines :=0:
while line <>0 do
number_of_lines :=number_of_lines + 1:
od:
print( number of lines read is ,number_of_lines);


The above gives

 number of lines read is , 24

This problem now means I am not able to continue with what I am doing. Does this happen on other platforms?

I think this happens due to Maple limits

[Length of output exceeds limit of 1000000]

However, I am NOT dispalying anything on the screen. This is all going to text files.  It seems Maple output limits of 1,000,000 is confusing fprintf() to a file as well?