Items tagged with example example Tagged Items Feed

I can;t seem to get DSOLVE working.  Will some kindly soul please send me a complete example, starting with an f(x) & clearly documented?   Many thanks.

 

 

AB

Hello. I have a question. If you can help me, i am pleasure.

Have nice day. :)

 

Question: Enter a number after maple find(understand) to prime number or normal number.

 

restart;
> asal := proc(n)
> local m;
> if n<2 then
> m := s=n/2+1;
> print(m);
> else
> for i from 2 to n do
> if irem(n,i,0) then
> print("asal değil");
> if i = m then
> print("asaldir");
> end do;
> end if;
> end if;
> end proc;

 

Hi is there a way to identify curves in your plot? Especially when you dont know it yourself?

 

For example, I have 10 polynomials all order 5 and up, whilst I can trial and error identify which one is which it is very inefficient.

I used to use Mathematica, and I could manually label the curves with color which allows to see which curve is which. I assume there is something of the sort for Maple?

Hi, My name is mohammed and I am a P.h.D student . I am a new user with Maple . I had two questions

First one : How can I execute a number of commands by using worksheet or document mode ? can any one  provide me an example?

Second : How can I measure the time for a number of command? can any one provide with syntax of the command?

Hi,

 

I've encountered a problem with Maple.

 

Is it possible to create a procedure which both displays some plots and also returns a value?

 

When I write a simple example:

 

It plots a circle as expected.

But when I add return:

 

It returns value 2, but no plot is displayed.

Is it possible to do both, display and return a value?

I used to write two copies of procedure, one for plotting and one for returning value.

But thats not "pretty" solution.

 

Thanks for help.

This is pretty similar to my last question. but I found this maple code on a website that is suppose to find a vertex coloring of a graph G. The output is is supposed to be a list for example like [3, table([y = 1, k = 2, c = 2, m = 3, h = 1, x = 1] where the first part (in this case 3) is the number of colors and 1,2,3 in the second part are the colors to which each vertex is assigned.  However, no matter what graph I run this on I get everything equal to 1. such as [1, table([y = 1, k = 1, c = 1, m = 1, h = 1, x = 1])]. Why is this happening?  
color:=proc(G)
  local i, j, C, U, V, total_used;
  V:=Vertices(G); total_used:=1;
  C[V[1]]:=1;
  for i from 2 to nops(V) do
    C[V[i]]:=0;
  end do;
  for i from 2 to nops(V) do
    U:={};
      for j from 1 to nops(neighbors(V[i], G)) do
      U:=U union C[neighbors(V[i], G)[j]];
       end do;
    j:=1;
    while member(j, U) do
      j:=j+1;
     end do;
    C[V[i]]:=j;
    if j>total_used then
      total_used:=j;
    end if;
   end do;
  [total_used, eval(C)];
end:

With your help I have a solution to a system of three equations:

(parameters are calculated on the basis of the data (for different values) - one example below)
A1=0.00002072968491, A2=0, A3=0.001946449287, A4=0.01946449287

B1=, B2=0, B3=0.0004773383613, B4=0.00004773383613

C1=, C2=0, C3=, C4=0.00009087604510

 

eqa1: = A1 * (diff (Tg (x), x, x)) + A2 * (diff (Tg (x), x)) + (A3 + A4) * tan (x) + A3 * Tg (x) + A4 * Tw (x) = 0;

eqa2: = B1 * (diff (Tw (x), x, x)) + B2 * (diff (Tw (x), x)) + (B3 + B4) * Tw (x) + B3 * Tg (x) + B4 * tan (x) = 0;

eqa3: = C1 * (diff (Tz (x), x, x)) + (C3 + C4) * Tg (x) + C3 * tan (x) + C4 * Tw (x) = 0;

 

indets ({eqa1, eqa2, eqa3}) minus {x};

res: = Dsolve (eval ({eqa1, eqa2, eqa3}) union {boundary conditions ??}, numeric);

 

for k from 0 to 20 evalf (res (k), 4); from;

c1:= 0.524:

c2:=0.05:

m: = 0;

for m from 0 to 20 and

T (m): = c1 * rhs (op (6, res (m))) + c2 * rhs (op (2, res (m))) + (1-c1-c2) * rhs (op (4, res (m))); print (m, T (m)); end to:

 

How and what type boundary conditions (I was thinking about the simplest or third type) to be able to determine the values on the y-axis on the graph. For example, the values started at -10, and ended at 10 (at a point (x, -10), (x, 10) in the coordinate system for a predetermined x, for example, from 0 to 20 which start at the point (0, -10 ) and stop at the point (20,10)). My main purpose is to collect these three solutions  to one equation T (x) = az * Tz (x) + and * Tw (x) + ag * Tg (x), and the ends of the graph, they should be in the above-mentioned points (0, -10 ) - start and (20,10) - stop.

 

Now thank you very much for the advice.

Ewa.

Hi all,

Assume that we have a vector, namely v:=[1,-2,3,-4] and we want to construct special matrix namely Z, from Vector v as follow:

first row is 1, secnond row is -2,..., the end row is -4 namely
Matrix([[1,1,1,1],[-2,-2,-2,-2],[3,3,3,3],[-4,-4,-4,-4]]);

in the other word every row of matrix is 4 times corresponding componet in vector.(for example v is (1*4))

how can we do this?

best wishes

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

Hi all.  I have researched into this problem.  But I could not find a solution to this.

Here is an example.

I have a set of independent variables, say there are 5 of them.  They are 1. Gender 2. Age group 3. Full or part time 4. First language.

I have a set of dependent variables.  Let us consider for an example 6 of them.  They are (i) Develops breast cancer (ii) Develops skin cancer (iii) Develops lung cancer (iv) develops prostate cancer (v) Lives till 50 (vi) Lives till 60 ...

How do I perform the following prediction:

(A) If a person is male and above 50, what are the chances that he is likely to develop prostate cancer?

(B) If a person is female and works part time, what are the chances that she is likely to develop breast cancer and lives till 60?

I need to develop a code and formula to do this?  Can someone please advise?

Many thanks.

Kind regards,

Kris

I am trying to find a way to take the rows of a matrix and put them in a sequence.  For example if i have the matrix 

M:=Matrix(3,[[1,1,1],[2,2,2],[3,3,3]]);

I want to rewrite it as S:= {111222333}.  

Sorry if this is not clear.  I know how to create a sequence, but I want to be able to use the Matrix and output a sequence without manually inputing the numbers.  

Thank you in advance for your help.  

Following @acer 's challenge to create some more examples for the Rosetta Code project, I've put together some code that constructs Stem-And-Leaf plots here.

I've also attached a new mathapp ( StemAndLeafDisplay.mw ) that contains the code as well as an interactive example for Stem-Plots. This MathApp is also viewable online at the following mobius project page.

This older post may also be of interest for anyone looking to make a stem and leaf plot with decimals.

how gr operators work?

I tried to run example given there but it is not working,

where can I get more examples to understand working of Gr operators work?

specially for raychaudhuri equations.

Given the lagrangian from the pendulum physics example on the help page,

or text format.

L := -sin(omega*t-phi(t))*(diff(phi(t), t))*a*l*m*omega+(1/2)*(diff(phi(t), t))^2*l^2*m+cos(phi(t))*g*l*m

 

 

 

In Maple 18, the Database package has been updated to include support for SQlite databases as well as a new option for plots to change the background images on plots.  To showcase both of these features, our engineering team put together an example that optimizes the flight path of a pan-US delivery drone.

This application extracts the latitude and longitude of those zip codes from an SQLlite database (the application includes the database, which cross-references US zip codes against their latitude, longitude, city and state). The application then performs a traveling salesman optimization and plots the shortest path on a map of the US.

To download the application click here: PanUSDeliveryDro.zip

I have two equations that are valid under the substitution sin <-> cos, so a simple way to generate the second equation is to replace all occurrences of sin with cos. But Maple gets the wrong answer when I do this, because of its built-in simplification. Here is an example. Z1 and Y1 shows the problem; Z2 and Y2 shows that my attempt to overcome the problem doesn't work.  Z3 doesn't work either, proving that the problem is internally generated by Maple because Maple insists on ordering variables in its own way, no matter how I write them.

________simplified example from Maple 15

restart;
Z1:=sin(-a*x+b);
Z2:='sin(-a*x+b)';
Z3:=sin(b-a*x);



                         -sin(a x - b)
                         sin(-a x + b)
                         -sin(a x - b)
Y1:=subs(sin=cos,Z1);
Y2:=subs(sin=cos,Z2);


                         -cos(a x - b)
                         -cos(a x - b)
 correct answer should be cos(-a*x+b) but the calculated results are off by a minus sign.

Ans1:=evalf(subs(a=1,b=2,x=3,[Y1,Y2,cos(-a*x+b)]));
          [-0.5403023059, -0.5403023059, 0.5403023059]

Question: How do I override Maple's desire to stick the "-" sign outside the sin function?

1 2 3 4 5 6 7 Last Page 1 of 87