MaplePrimes Questions

I have training video that shows the visualization window "docked" below the main window.   Can this work space arrangement be done in sim2017 ??  

Also I push the anchor button and nothing seems to happen 

Hi all, does anyone know why i can't export maple as a pdf file? I have tried saving as other type of files which works, but when pressing save as pdf nothing happens. 

 

I've used this guide, https://www.maplesoft.com/support/help/maple/view.aspx?path=worksheet/managing/exportPDF#bkmrk1

Hello all!
Can some one please help me in translating this code, for newton forward and backward interpolation, and get the same output in maple. I am not very good at matlab so that is why I am having problems converting it to maple code.

only forward or backward would be enough I am sure I will figure out the second myself.
https://www.codewithc.com/newtons-interpolation-in-matlab/

What is the best way to check if solve returned one or more solution? Currently I check if the returned sol is of type exprseq, and if so, I put the result in a list. If the sol is not of type exprseq, then I know only one solution is returned. Here is an example

foo:=proc(eq,x)
  local sol;
  sol:=solve(eq,x);
  if whattype(sol)='exprseq' then
     sol:=[sol];
  fi;
  return(sol);
end proc:

And now

Is there better way to do this?

 

Maple does not have a GOTO. I do ?goto and nothing comes up (I thought it did at one point, but it seems to be gone). I also saw 

99052-How-To-Write-Procedures-That-Use-Go-To-In-Maple

GOTO is considered bad, and I agree in general. But there ONE very good use for GOTO which can't be easily replaced, which is having a common exit label. (at one work place sometime ago, this was actually the only recommened use for it in the programming guidelines. and I agree.)

Without this, one ends up with deep if then else if then else if then else., etc....

But having a common exit, where one can do common clean up things is very good. This reduced code duplication and actually makes the logic more clear.

Here is just some silly example to  illustrate

foo:=proc(x)
  if x=10 then
     .....
    close file, print common message
    return(final_result);
  fi;

  if x=12 then
     .....
    close file, print common message
    return(final_result);
  fi;

 etc...

end proc;

With common exit point, one could do

foo:=proc(x)
   if x=10 then 
      .....
     final_result :=...
     goto common_exit;
   fi;

   if x=12 then 
      .....
     final_result :=...
     goto common_exit;
   fi;

common_exit:
   close file; 
   print common message;
   return(final_result);

end proc;

The alternative is to have deep  nested if then else, like this

foo:=proc(x)
    if x=10 then 
       ..... 
       final_result :=...;
    else
         if x=12 then 
            ..... 
            final_result :=...;
         else
             if x= 20 then
                .....
                final_result :=...;
             fi;
         fi;
   fi;

  close file; 
  print common message;
 return(final_result);
end proc;

For complicated logic, I do not think the last case is better than the second one using GOTO.

The second case also eliminates duplicate code as was done in first case. Also first case has multiple return points from the proc, which is not good. As having one common return point is better.

Why was goto removed from Maple? Can one still use it somehow? Where is the documenation for it?

update

 

goto seems to be there. I did not think of trying, since ?goto did not show it. But now I found I could do this and it works

foo:=proc()
  local x;
  x:=10;
  goto(common_exit);
  x:=20;
common_exit:
  print(x);
end proc;

So please Maplesoft., do not remove GOTO.

Hi, I realise it looks a little messy and I apologize for that, but I wanted to exclude the data pairs for which x or y are equal to 1, and the manner in which I have done has always worked for me thus far, so I would like to understand why or how I should produce output like this in the future thanks in advance.

 


 

`𝓃` := proc (X) options operator, arrow; numer(X) end proc:

`𝒹` := proc (X) options operator, arrow; denom(X) end proc:

delta := proc (x, y) options operator, arrow; piecewise(x = y, 1, x <> y, 0) end proc

[seq(seq(piecewise(`or`(`mod`(`&nscr;`(product(1-delta(`mod`(x, ithprime(j)), 0)/ithprime(j), j = 1 .. x)), y) = 0, `and`(`and`(`and`(`mod`(`&dscr;`(product(1-delta(`mod`(y, ithprime(j)), 0)/ithprime(j), j = 1 .. y)), x) = 0, igcd(x, y) = 1), x <> 1), y <> 1)), [x, y], NULL), x = 1 .. 20), y = 1 .. 20)]

[[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [10, 1], [11, 1], [12, 1], [13, 1], [14, 1], [15, 1], [16, 1], [17, 1], [18, 1], [19, 1], [20, 1], [3, 2], [5, 2], [7, 2], [9, 2], [10, 2], [11, 2], [13, 2], [15, 2], [17, 2], [19, 2], [20, 2], [7, 3], [13, 3], [14, 3], [19, 3], [5, 4], [13, 4], [15, 4], [17, 4], [11, 5], [7, 6], [13, 6], [19, 6], [15, 8], [17, 8], [19, 9], [11, 10], [13, 12], [17, 16], [19, 18]]

(1)

``

``

``

``

``


 

Download 05062018.mw

Larson 6th edition gives the following solution; 

However, LineInt(VectorField(`<,>`(x, y)), Path(`<,>`(4*t, 3*t), t = 0 .. 1))

returns 25/2 and 

LineInt(VectorField(`<,>`(x, y)), Path(`<,>`(4*t, 3*t), t = 0 .. 1), output = integral)

returns

Int(25*t, t = 0 .. 1)

Why are the solutions different?

lineInt.mw

 

hi

by passing all steps to install Maplesim 2017.3 i confort the error "The system cannot find the file specidied" when i want to open it. what shoud i do?


In the following file when p is a fraction other than 1/2 the integral is not evaluated. Please help

INTEGRAL2.mw
 

 

I am stumped at this.

I made a proc A which takes arguments using keywords. When I call A directly, it works. When I pass the argument I want to call A with to another proc B, and then from B call A with that argument, it fails. Maple tells me that it missing arguments. Here is a MWE

restart;
procA := proc({the_equation::`=`:=NULL})
  print("it worked, you passed in ", the_equation);
end proc:

procB :=proc(the_equation)
  print("inside procB, the equation is ", the_equation);
  procA('the_equation'=the_equation); 
end proc:

 

Now, calling procA directly, works

the_equation:= y=3:
procA('the_equation'=the_equation);

              "inside procA, you passed in ", y = 3

But when caling procB, and then have procB call procA, the argument passed in is NULL

procB(the_equation);

                  "inside procB, the equation is ", y = 3
                 "inside procA, you passed in "  <=== WHY NULL?

   

 

 

I must be doing something wrong, I just do not see it.

I am learning argument passing using keyword, which I like more than positional arguments.

I wanted to have an argument which should be only an equation, to be passed in.

So I typed

restart;
foo:=proc({the_equation::`=`:=NULL}) 
   print (the_equation); 
end proc;

And this works when calling it as

the_equation := y=5:
foo('the_equation'= the_equation);

But it does not work, if I put the value of "the_equation" variable in the call itself, like this

foo('the_equation'= y=5);
Error, `=` unexpected

Which is a little strange. So it seems frontend does not like to parse it. A workaround (other than using a variable) is

foo('the_equation'= 'y=5');

Just found it a little odd, that using a variable for y=5 works, but not putting value of the variable  directly there. I thought they should be equivalent.

Since I expected Maple to evaluate and replace the variable "the_equation" back by "y=5" so we end up with the call "foo('the_equation'= y=5);".

But that is not what seems to happen in Maple.

Question is, should the call foo('the_equation'= y=5);  have failed parsing?

Update: rebooting the PC fixed this error for me. Now help comes up OK.

original question:

I am on windows 7, home editon, running Maple 2018.

For some reason, now each time I tried to get help, I get the message that it lost connection with server. I closed Maple, started it up again, and same error happens. Movie below.

This also happend from new worksheet also Each time I type ?anything I get the above.

 

Any idea what can cause it? and where I should look for errors?

I did not nothing before this to anything on system. Was just editing some worksheet which opens fine. It is only help that seems to be having hard time.

 

 

CODE:

sys_ode := 2*C__5*(diff(w(x), x))-C__1*(diff(u(x), x, x))-2*C__4*(diff(w(x), x, x, x))-Q(x) = 0, 2*C__2*u(x)-C__1*(diff(w(x), x, x, x))-2*C__3*(diff(u(x), x, x)) = 0

ics := (D(u))(0) = 1, ((D@@2)(w))(0) = 0, (D(u))(100) = 1, ((D@@2)(w))(100) = 2

 

NOTE:

C__1 to C__5 are constants. 

Following is the screenshot, is there anything wrong with my code?

Thanks for any answer or suggestion!

Dear All

I want to plot A long rod with length L and its cross-section is a rectangle

Hello, 

I am trying to plot 2 equations divided in 3 intervals (tini..tr, tr..te, te..tfin1), but when i try to solve the first equation it appears:

"Warning, cannot evaluate the solution further left of .66099564e18, probably a singularity"

Is it possible avoid this point?

About the second equation, when i try to solve between "te and tr" the program says that the argument is invalid.

Can someone help me?

Here is the program:

restart;

Digits := 20;

M := 0.122e20*0.152e25;
kappa := evalf(sqrt(8*Pi/M^2));
rrhoCC := 0.769e-41*(0.1e-28*0.561e24)*0.152e25^4;

rrhoM0 := 0.1e51;
rrhoR0 := 0;
rrhoM := proc (t) options operator, arrow; rrhoM0/a(t)^3 end proc;
rrhoR := proc (t) options operator, arrow; rrhoR0/a(t)^4 end proc;
pM := proc (t) options operator, arrow; 0 end proc;
eq1 := diff(a(t), t) = a(t)*kappa*sqrt(rrhoM(t)+rrhoCC)/sqrt(3);
eq2 := 2*(diff(a(t), t, t)) = -(1/3)*kappa^2*(rrhoM(t)+3*pM(t)-2*rrhoCC)*a(t);
tini := 0.1e19;
sys1 := {eq1, a(tini) = 1.0};
sys2 := {eq2, a(tini) = 1.0, (D(a))(tini) = 0.284e-17};
with(DEtools);
with(plots);
tfin1 := 0;
te := 10^(-32);
tr := 10^12;
singularities(eq1, a(t));
singularities(eq2, a(t));
p1a := dsolve(sys1, type = numeric, abserr = 10^(-15), relerr = 10^(-15), range = tini .. tr);
p1b := dsolve(sys1, type = numeric, abserr = 10^(-10), relerr = 10^(-10), range = tr .. te);
p1c := dsolve(sys1, type = numeric, abserr = 10^(-10), relerr = 10^(-10), range = te .. tfin1);
fig1a := odeplot(p1a, [t, a(t)]);
fig1b := odeplot(p1b, [t, a(t)]);
fig1c := odeplot(p1c, [t, a(t)], color = red);
display(fig1a, fig1b, fig1c);
p2a := dsolve(sys2, type = numeric, abserr = 1.*10^(-12), relerr = 1.*10^(-12), range = tfin1 .. te);
p2b := dsolve(sys2, type = numeric, abserr = 1.*10^(-12), relerr = 1.*10^(-12), te .. tr);
p2c := dsolve(sys2, type = numeric, abserr = 1.*10^(-12), relerr = 1.*10^(-12), range = tr .. tini);
fig2a := odeplot(p2a, [t, a(t)], color = green);
fig2b := odeplot(p2b, [t, a(t)], color = green);
fig2c := odeplot(p2c, [t, a(t)], color = green);
display(fig2a, fig2b, fig2c);
display(fig1a,fig2a,fig1b,fig2b,fig1c,fig2c);

 

 

 

First 814 815 816 817 818 819 820 Last Page 816 of 2427