nm

11558 Reputation

20 Badges

13 years, 135 days

MaplePrimes Activity


These are answers submitted by nm

may be you can use the definition of concave function. From Wiki

 differentiable function f is (strictly) concave on an interval if and only if its derivative function f ′ is (strictly) monotonically decreasing on that interval, that is, a concave function has a non-increasing (decreasing) slope.[3][4]

So just need one counter example. This is your g(x) function which is increasing and concave function g:=x-exp(-x). 

If you plot the derivative of   (2*x+5)*g(x), you will see is not concave.

 

Why would you load LinearAlgebra and then at same time make call to linalg:- ?

    Important: The linalg package has been deprecated. Use the superseding packages, LinearAlgebra

if you remove that then it works. It might have to do with how linalg works. I do dot know for sure, but this works.

To multiply these matrices/vectors, just use the dot. So intead of what you had

          linalg:-multiply(Ts_sksul, XCin)

you can just do

         Ts_sksul.XCin

 

fixed.mw

 

diff(x^n,x) does not equal n*x^(n-1), but rather 0 if n=1

you probably meant rather 1, and not rather 0..

This seems like a bug to me

it is not a bug. all CAS systems work on a general expressions, not specific values. 

 

 

 

To get derivative for specific you need to give specific value for n.

 

 

 

Maple by default uses 10 decimal points to display real numbers.

This works for 2021.1 on windows 10, using worksheet interface

restart;
interface(typesetting=extended);
Typesetting:-Settings(striptrailing=true);
V := 4;
K := 16.56;
H := 0.5;
q1 := diff(y[1](x), x) = V*y[2](x)/H - K*y[1](x)/H;

Or you could do

restart;
V := 4;
K := 16.56;
H := 0.5;
q1 := diff(y[1](x), x) = V*y[2](x)/H - K*y[1](x)/H:
convert(q1,rational)

See this post for reference. How-To-Delete-Zeros-After-Decimal-Point

btw, why are using evalf for? Your numbers already real.

 

When expression is   A+B then operands are A and B. And select selects operand which has what you wanted. So if the expression is t*u[1,1,1]*u[1,1,1,2]+2 then A=t*u[1,1,1]*u[1,1,1,2] and B=2, that is why it returned A.

When the input is t*u[1,1,1]*u[1,1,1,2] then expression is A*B*C and each one is now an operand. So A=t, B=u[1,1,1] and C=u[1,1,1,2] and that is why select now returned only u[1,1,1]

One way could be to do 

LT:=proc(expr, term)
 if type(expr,`+`) or nops(expr)=1 or expr=term then
    select(has, expr, term);
 elif type(expr,`*`) then
      if has(expr,term) then
          return expr;
      else
          return NULL;
      fi;
 else
     error "not expression?";
 fi;
end proc;

And now it works for both cases

 

 

may be

restart;
ode1:=diff(x__1(t),t)=x__1(t)-x__2(t)-3;
ode2:=diff(x__2(t),t)=12*x__1(t)-8*x__2(t)+4;
vars:=[x__1(t),x__2(t)];
A,b:=LinearAlgebra:-GenerateMatrix([rhs(ode1),rhs(ode2)],vars):
sys:=Vector(diff(vars,t)) = A.Vector(vars)-b

dsolve(sys)

ofcourse, you could just have done

dsolve([ode1,ode2])

And got same result.

edit

to answer comment:

Is there another way to set up something from an equation to a matrix? More like an output like the above one?

I am not sure I understand exactly what the question here. May be you mean for display only purposes you want to change how it prints on the screen? You can try this line instead

sys:=Vector(diff(vars,t)) = A %.Vector(vars)%- b

Now it looks like the one you showed.

I do not use 2D math Maple laanguage at all. So not sure if this is what you want.

one possibility could be

restart;
G[i,k]:=u[i] - u[k]-(u[i]-u[k])^2;

for i from 1 to 3 do
  for j from 1 to 3 do
     for k from 1 to 3 do
         G[i,k]:=u[i] - u[k]-(u[i]-u[k])^2;
      od;
  od;
od;

G[2,1];
G[3,2];

its latex

latex(G[2,3])

          G_{2,3}

 

double underscore could have worked  but do not know how to make it work with 2 indices (i,j).

For example , for the RHS you could do

u__i- u__k-(u__j-u__k)^2

But this would not work for G with double index.
 

 

 

 

You should really post full code you used, including the plot command used.  

It works for me on Maple 2021. no cut off.

restart;
h := x -> 1.23 + x*1*0.0001 + 0.12*log(50000*x) + abs((-1)*0.03*log(x/0.001));
plot(h(x),x=0..100)

 

restart;
interface(version); 

fname:="G:/data/tmp/ftest.mpl":
f:=proc(n)
  local i,k;
  for i to n do f(i):=parse(cat("", seq(k mod 10, k=1..10*i))) od;
  f(n);
end:

f(80):
length(%);  # 800, ok
save f, fname;
f:='f':
#restart;
read fname:
f(80):
length(%);  # 100  ???

one way might be to use solve or PDEtools:-Solve

restart;
eq:=5*x^3-x^2+x-1=0;
PDEtools:-Solve(eq,x)

This is how I do these things.  

Rule of thumb, always use PDF files for images if possible. If not, export to .eps/ps, then convert the eps to PDF, then use that in the incluegraphics command in Latex. Latex compilers (pdflatex and lualatex, etc...) can read pdf image file for many years now.

I do not use the Maple worksheet GUI to export anything, as I do all this in code. Something like this

p:=plot(.....); #your plot command
plotsetup(ps, plotoutput="file_name_here",plotoptions = `noborder`);
print(p);
plotsetup(default):

The above will create file_name_here.ps. Choose any name you want for the file.

Now I run the commands

epspdf filename.ps
pdfcrop --margins 10  filename.pdf  filename.pdf

The first command convert the .ps file to pdf. The second crops it.

I've been doing this for years in all my Latex. It works very well for me. 

I just applied these to your image

with(plots):
scheme1 := ["zgradient",["Blue","Cyan","Green","Yellow","Orange","Red"]]:

P1:=plot3d(x*y, colorscheme=scheme1,style=surfacecontour ): 
P2:=plot3d(x*y,colorscheme=scheme1,style=point,symbol=asterisk): 
final_plot:=display({P1,P2}); #I want to export this figure to .eps
plotsetup(ps, plotoutput="file_name_here",plotoptions = `noborder`);
print(final_plot);
plotsetup(default):

Here is the result

\documentclass[11pt]{article}
\usepackage{graphicx}
\begin{document}
This is my graphics generated in Maple 2020.2 

\includegraphics[width=0.9\textwidth]{file_name_here}
\end{document}

In Mathematica, this is much easier, since Mathematica Export command can export plots and other Graphics to PDF directly.

May be in Maple 2021 exporting to PDF using the export() command will be supported.   I have no idea why Maple still does not support PDF format in the export command. PDF is the most universal format there is.

https://www.maplesoft.com/support/help/Maple/view.aspx?path=Export

foo5.pdf

There are all build in. But you could always make a function and make your own. For example for Hessian, something like

my_hessian:=proc(f::algebraic,vars::list(name))
 local n:=numelems(vars);
 local A:=Matrix(n,n);
 local i::posint,j::posint;
 for i from 1 to n do
   for j from 1 to n do 
       A[i,j]:=diff(diff(f,vars[i]),vars[j]);
   od;
od;
return A;
end proc;

You call it as

my_hessian(cos(x*y),[x,y])

Compare to

VectorCalculus:-Hessian(cos(x*y),[x,y])

It is ofcourse better to use the build in ones, as those have been tested over many years and have more options.

edit: changed function to algebraic. and vars also. Thanks to Carl Love reply below. 

It is better to make an attempt, and then ask for help when stuck. This way you'll learn better.

But I will make an attempt at part (a) for now.

f:=x->sin(x);
g:=x->cos(x);
plot([f(x),g(x)],x=0..Pi/2);

To find area bounded

h:=x->`if`(f(x)>g(x),f(x),g(x));
plot(h(x),x=0..Pi/2,view=[default, 0..1],filled=true);

To find the above area, use int. 

evalf(int(g(x),x=0..Pi/4)+int(f(x),x=Pi/4..Pi/2))

                1.414213562

 

One possible way

subs(exp(a)=p,expand(exp(-a)))

 Would you tell me what steps Maple might have gone through in order to come to the answer?

Maple does not show steps of solution. You might try the new Maple Learn application. (it can show step by step solution for some commands)

For Maple, you could look at trace by adding the command infolevel. For your problem it says

infolevel[solve]:=5;
eq_VR := VR = solve(eq_VS_m1, VR) assuming VS > 0, VR> 0;


solve: Warning: solve may be ignoring assumptions on the input variables.
solve:
             {VR::(RealRange(Open(0), infinity)), 


Main: Entering solver with 1 equation in 1 variable
Dispatch: dispatching to Rename handler
Dispatch: renaming conjugate(Sr) = _S000003
Recurse: recursively solving 1 equations and 1 inequations in 1 variables
Dispatch: handling polynomials of the form a*x^n-b
Dispatch: handling a single polynomial
Main: solving successful - now forming solutions
Main: Exiting solver returning 1 solution

Quadratic: solving a quadratic polynomial explicitly

So it looks like from the trace it used the standard quadratic formula.

 

First 7 8 9 10 11 12 13 Last Page 9 of 19