MaplePrimes Questions

Search Questions:

Latest Questions Latest Questions Feed

Hi everybody, 

 

Could somebody just explain me why commands L[1..5] and L[3..6] below do not seem to return "the same type of thing" ?

 

L := Array(1..10, [$(1..10)]);

L := Array(1..10, {(1) = 1, (2) = 2, (3) = 3, (4) = 4, (5) = 5, (6) = 6, (7) = 7, (8) = 8, (9) = 9, (10) = 10})

(1)

L[1..5];
whattype(%);

Array([1, 2, 3, 4, 5])

 

Array

(2)

L[3..6];
whattype(%);

Array(3 .. 6, {3 = 3, 4 = 4, 5 = 5, 6 = 6}, datatype = anything, storage = rectangular, order = Fortran_order)

 

Array

(3)

 


Thank you for your attention


Download array.mw

Hey,

I want to solve this equation and looking at the plot there are at least 3 solutions. I want the greatest/smallest negative solution. Unfortunately using solve with assumptions produces no results and solve without assumptions only finds two solutions.

Can you please help me?

#select greatest negative value from solution

restart:

expr:= ax*cos(lambda)+ay*sin(lambda)-(a+b*lambda)

ax*cos(lambda)+ay*sin(lambda)-b*lambda-a

(1)

ax:=1:ay:=2:a:=0.5:b:=0.25: #examplanatory values

plot(expr)

 

 

assume(-2*Pi<lambda,lambda<0): #does not work

 

sol_lambda:=[solve(expr=0,lambda, useassumptions)];# returns empty list even though without assumption one solution is found

Warning, solutions may have been lost

 

[]

(2)

sol_lambda:=[solve(expr=0,lambda)]; #returns only two solutions even though looking at the plot 3 are there

Warning, solve may be ignoring assumptions on the input variables.

 

Warning, solutions may have been lost

 

[2.190357220, -.2688724573]

(3)

sol_l_v:=evalb~(sol_lambda<~0); #dirty workaraound

[false, true]

(4)

sol_l_add:=[ListTools:-SearchAll(true,sol_l_v)] ; #this seems overly complicated

 

[2]

(5)

lambda:=sol_lambda[sol_l_add[-1]];  #to select the last entry

 

-.2688724573

(6)

expr; #test

 

0.

(7)

 


Download select_solution.mw

Thanks!

Honigmelone

hi

how i can plot 4 curve in one graph in maple??

this data is given in excel format as below

thanks

16.3.xlsx

how to specify color at the turning point of mountain shape in dualaxisplot

woud like to specify a point with another color at the top of peak shape line diagram

Hi,

This is regarding numerical solution of a function and plot. I have a function in the form of f1(omega,arctan(f2(omega))), and i need to plot it with omega (as the expression is too long i cant insert it here). Now, if i am changing the range of omega in plot command then I am getting different plots for the small values of omega. Let's say if i change the range from 1..10 to 1..50 and look at the plot in the range of 1..3 then the plots looks different. Apart from this if i change the value of Digits  from 10 to 30 or 40 then every time i am getting an entire different  plot. As the expression if too long i cant convert it to Matlab expression and plot there. How to fix these issues. Please help me regarding this.

Regarding

Sunit

 

Dear all,

I am trying to solve the following equation:

y(z) = F(z) + int(sqrt(z - sigma)*y(sigma), sigma = 0..z);

intsolve(%, y(z));

But i get the following error: 

Error, (in intsolve) numeric exception: division by zero

My guess would be that there appears a limit in the calculation which exists but is not evaluated properly by Maple. Is it possible to pass this kind of exception (comparable to http://www.maplesoft.com/support/help/errors/view.aspx?path=Error,%20numeric%20exception%3A%20division%20by%20zero)

Thanks and best regards

Ferdinand

 

 

 

I have tried to solve a matrix with the function "LinearSolve" as seen in the picture, but instead of solving it just gives me back the operation i wrote (3). My which is to solve an equation system a quick as possible - have a templet fill in the matrix and press enter. I thought this "LinearSolve" function was the easiest way of doing. I know that I can right click and choose the function, but I want it as a command.

 

Any solutions on how to use the "LinearSolve" command to solve an equation system?

 

Hi, 

I'm solving a 2D grid with some finite-diference methods. The result is a surface, i.e f(x,y) = z. Where X and Y and points on a grid. 

 

I then need to integrate over this grid, i.e

int(f(x,y),[x=0..10, y=0..10]) 

I have tried interpolating the grid. I've used CurveFitting:-ArrayInterpolation() to interpolate points in this 2D space and then integrate over them. 

I'm using a 30x30 grid, but this interpolation scheme takes far too long. The function generated from the ArrayInterpolation creates an interpolation every time a point is evaluated, which I assume is why the integral is very computationally expensive. 

I would like to create a piecewise analytic function from the 2-D grid, perhaps using CurveFitting:-Spline(), however from my understanding this only works for 1D objects? 

Is there any better solution for integrating a 2D numeric grid?

Thanks in advance

After using the Groebner and PolynomialIdeals packages, Maple goes into a long calculation when I make an entry of the form

name:=polynomial expression. This can take 10's of minutes for an expression of two lines. The only solution I have found is to save the sheet and restart it and enter the line name:= etc. before loading Groebner and PolynomialIdeals. This is most inconvenient. Is there a better workaround?

Hello

I am working my way back to use Maple for some calculations I did in the past.   ListTools seems to have some of the functions I need but I couldn't find anything that gives me the position of all groups of repeated elements in a list of a list.  For instance, ListTools:~MakeUnique removes the copies of all repeated elements but it seems that there is no counterpart function that gives the position of the repeated elements, is there?

Search and SearchAll return position but they seem to be the only ones.  

Example:

a:=[[x+y+z],[2*x+y+z],[x-y+z],[2*x+y+z]];

and the expected output would be

pos:=[[1],[2,4],[3]];

Many thanks

Ed

 

HI there,

 

I have the following problem: I want to improve the runtime of my script (Maple 2016) and want to use multithreading/tasking.

First I have this script (let's start with an easy example):

>restart;
  with(LinearAlgebra): 
  with(Student[MultivariateCalculus]):
  with(plots):
  with(Statistics):
  with(Threads):
  with(RealDomain): #I know, I don't need all of that here

>cdf := x-> int(PDF(GammaDistribution(4.5/100,2.5),xi-0.068),xi=0.068..x):
>N:= 20:
>sample := (i) -> solve( (1/(2*(N+1))+1/(N+1)*i)=cdf(x),x): #this is an equidistant sampling

> smpl := [Seq(sample(i),i=1..(N-1))]; #I try to run a multithread seq -> got it from the documentation

   Error, (in assuming) when calling 'Engine:-Process'. Received: 'type `System` does not exist'

I get this error message, but I don't really know what to do with it. I googled and searched, but I couldn't find useful help. Note that when I run this command, I still use only one processor (at least until it returns the error). I also tried:

>smpl := Map(sample,sample_dists);>N:= 20:
   Error, (in assuming) when calling 'Engine:-Process'. Received: 'type `System` does not exist'

I also tried to implement it with threads:

> cont := proc()
      global mutex_sample, smpl:
      smpl := [op(smpl), _passed]: #add the results of the tasks to the smpl var.
      print("Sampling Done");
   end proc:

> sample := proc(cdf, min, max, N) #samle the region
      local output:
      seq(solve(,x),i=0..(N-1)); #return value
   end proc:

> startSampling := proc()
      local sampling_tasks,i:

      print("Starting Sampling!");
      sampling_tasks := []:
      for i from 1 to kernelopts(numcpus) do #for each processor
          sampling_tasks := [op(sampling_tasks), Task=[sample, cdf, i/(kernelopts(numcpus)+1),(i+1)/(kernelopts(numcpus)+1),ceil(N/kernelopts(numcpus))]]; #sample a region
      end do:

      print("Starting Sampling Tasks!");
      Threads:-Task:-Continue( cont, op(sampling_tasks)); #start sampling threads
      print("Sampling Tasks started!");
   end proc:

> Threads:-Task:-Start( startSampling ); #start everything

"Starting Sampling!"
"Starting Sampling Tasks!"
"Sampling Tasks started!"
Error, (in assuming) when calling 'Engine:-Process'. Received: 'type `System` does not exist'

 I know I'm doing here something systematically wrong, but I can't figure it out.

I would be very greatful, for your help or insiged.  

 

EDIT: 
1) The presented script might doesn't make sense (or might be pointless), because I have a much larger and more complex (model) in my original script. But, my script didn't work (exactly same error). So, I tried this simple example, to figure out what the problem is. But it didn't work either. I thought, it might be better (didactically) to find the problem in the simple code. It might be easier to explain in a forum and easier to analyse. (SO I could then see why my more complex code is not working).

2) I was running the script in Linux (Ubuntu 16.04 x64) and it produced this error. I also run the script in Windows 10.2 where I got the same error (and sometimes I got an "Maple Kernel cannot be reached" message where I had to restart Maple.

3) I noticed that solve sometimes returns a complex solution (usually it returned: "value + 0.0 I"). I therefore added "with(RealDomain): ", which had the consequence that some sample points were "NULL". I know that, and that is another issue, which I'm not bothered about (right now).

SOLUTION: (most likely)
Thanks to everyone who replied. But Carl_Love probably is right by pointing out that int, solve, fsolve ... are not thread-safe and therefore caused the crahses/error messages, while calling thesefunctions in different threads.

Hello

I wonder if there is a function to retrieve only the monomials from a multivariable polynomial in x, y and z. Below is one such polynomail.

 

theta[2]*x3*x0-theta[8]*x2*x1*x0-theta[2]*x2*x1-theta[6]*theta[2]*x2*x0^2-theta[4]*theta[2]*x2*x0-theta[2]*theta[7]*theta[10]*x1*x0^3+theta[8]*theta[2]*theta[9]*x1*x0^2-theta[2]*theta[5]*theta[10]*x1*x0^2-theta[2]^2*theta[3]*theta[10]*x0^3+theta[6]*theta[2]^2*theta[9]*x0^3+theta[4]*theta[2]^2*theta[9]*x0^2

and the result

[x3*x0,x2*x1*x0,x2*x0^2,x2*x0,x1*x0^3,x1*x0^2,x0^3,x0^2]

Many thanks

 

Ed

 

I downloaded a maplesoft apps, and wat to activate, an activeation form displayed requiring me to put in a purchase code of which i don't know or have. How can i get it or where can i find it? please some one help.

Does anyone know what the default function is for the pre-subscript and pre-superscript?  I would like to use them for a variable name to represent the local reference frame and global reference frame in my multibody calculations.  Thanks

5 6 7 8 9 10 11 Last Page 7 of 1360