MaplePrimes Questions

Are there any video tutorial or online (recorded) webinar that show the details of object oriented programming in Maple. Also please suggest any great book in recent times that focus on programming features in Maple.

I see a lot of tutorials and books on Maple that goes into depth about applications in mathematics but can't find any good resource that help me learn the advanced features of Maple programming in particular new ones that have been introduced since Maple 15.

I want to make a 3D image of a US one cent coin (a penny).  To produce one face of the penny I thought of doing

plot3d(0, y=-sqrt(1-x^2)..sqrt(1-x^2), x=-1..1, image="penny.png");

but this distorts the circular image into something that's not quite circular:

What is a better way of doing that?

 

 

Here is the image penny.png that I used: 

I have  sum((r+1)*(r+2)*(r+3)*(r+4)*F(r+4)*(k-r+1)*F(k-r+1), r = 0 .. k) =c (constant); 

outputs: for k=0,1,2,...

                        24 F(4) F(1) = c
                48 F(4) F(2) + 120 F(5) F(1) = c
        72 F(4) F(3) + 240 F(5) F(2) + 360 F(6) F(1) = c....

but I  need the alternate form

F(4)=c/24*F(1),

F(5)=(c-48F(4)F(2))/120*F(1),

F(6)=(c-72*F(4)*F(3)-240*F(5)*F(2))/360*F(1).....

How to change this?

Probably quite simple, but I can't get it done:

I need to search a column of a matrix (floats in ascending order). If a specific value is exceeded, i want to know the row index.

I'm more used to Matlab, it would be like an equivalent to the matlab "find" command.

How to proof exp(x) is transcendental function without using calculus?

How to write this equation in maple?

g(k-r-1);

conditions:=

1.r from 0 to k, 

2.g(0)=1;

3.g(n)=0, where n not equal to 0.

 

How can one find the number of real solutions of a polynomial, when the polynomial is depending on a parameter. For instance, gven the following polynomial

x^4-2x^3-x^2+8x+8-2t

for t in the reals

How can I find the number of real solutions? I know you can use solve(..., reals), if the polynomial wasn't parametrized, but can maple take the parameter into account? 

Download HowToDefineTensorRankZero.mw

Using the latest Physics package, I try define a tensor of rank zero, but an error accurs:

> Define(Theta = varepsilon[mu, ~mu](X));
Error, (in Physics:-Define) expected left-hand-side of tensor definition as a tensor with non-numerical indices, received: Theta

The same error occurs when I try:
> Define(Theta[] = varepsilon[mu, ~mu](X));
Error, (in Physics:-Define) expected left-hand-side of tensor definition as a tensor with non-numerical indices, received: Theta[]

So my question is: how can I define a tensor of rank zero? 
Hope someone can help me out. 

Regards, Wouter

How to convert diff(f(t),t) + diff(g(t),t)

to diff(t(f,g), f)+ diff(t(f,g), g)

?

How to cmaple or mw file maple dualaxisplot output to jpeg file after press and run?

How to cmaple print int(f(x),x) after append to text command instead of /

                                             |

I want to draw circle passing thought three points S, A, B on the sphere by using tikz-3dplot-circleofsphere, its document at here https://github.com/matthias-wolff/tikz-3dplot-circleofsphere/blob/master/tikz-3dplot-circleofsphere.pdf The command to draw is 
\tdplotCsDrawCircle[style]{r}{alpha}{beta}{epsilon}

With Maple, I can find the coordinates of center and radius of circle. I tried
 

restart; 
with(geom3d):
 a := 3:
 b := 4:
 h := 5:
 point(A, 0, 0, 0):
 point(B, a, 0, 0):
 point(C, a, b, 0):
 point(DD, 0, b, 0):
 point(S, 0, 0, h):
 sphere(s, [A, B, C, S], 'centername' = m); detail(s); plane(p, [S, A, B], [x, y, z]); coordinates(projection(H, m, p)); 
R := distance(H, S)

But, I can't to find the angles alpha, beta, epsilon to draw this circle. How can I find  the angles alpha, beta, epsilon?


 

  restart:

  interface(rtablesize=10):

#
# Define gamma as local (don't like doing this!)
#
  local gamma:local pi:

#
# Replaced 'indexed' parameters with 'inert subscript'
# parameters - otherwise one gets a problem defining
# both the unindexed 'phi' and the indexed phi[c]
#

if false then
  A__h := .18: beta__1 := 0.8354e-1: psi := 0.7258e-1: mu__r := 0.51e-1: sigma := .165: alpha := .65: xi := 0.5e-1: gamma := .131: A__b := .7241: beta__o := 0.65e-1: mu__b = 0.17e-1:
end if:

#
# D() is Maple's differential operator replated D(T)
# with DD(T) in the following to avoid confusion
#
  ODE1 := diff(S(T), T) = A__h-psi*beta__1*S(T)*G(T)-mu__r*S(T):
  ODE2 := diff(G(T), T) = psi*beta__1*S(T)*G(T)-sigma*psi*beta__1*R(T)*B(T)-(alpha+xi+mu__r)*G(T):
  ODE3 := diff(A(T), T) = alpha*G(T)-(gamma+mu__r)*A(T):
  ODE4 := diff(R(T), T) = gamma*A(T)+sigma*psi*beta__1*R(T)*B(T)- mu__r*R(T):
  ODE5 := diff(C(T), T) = A__b - psi*beta__o*C(T)*I(T)- mu__b*C(T):
  ODE6 := diff(B(T), T) = psi*beta__o*C(T)*I(T)- mu__b*B(T):
 

 
if false then
  S0 := 100: G0 := 190: A0 := 45: R0 := 20: C0 := 35: B0 := 25:
end if:

# system + ic


sys := { ODE1, ODE2, ODE3, ODE4, ODE5, ODE6,
                   S(0) = S0, G(0) = G0, A(0) = A0, R(0) = R0, C(0) = C0, B(0) = B0

                 }:

params := convert(indets(sys, name) minus {T}, list);

[A0, A__b, A__h, B0, C0, G0, R0, S0, alpha, beta__1, beta__o, gamma, mu__b, mu__r, psi, sigma, xi]

(1)

#
# Solve system
#
  ans := dsolve( { ODE1, ODE2, ODE3, ODE4, ODE5, ODE6,
                   S(0) = S0, G(0) = G0, A(0) = A0, R(0) = R0, C(0) = C0, B(0) = B0
               
                 },
                 parameters = params,
                 numeric
               );

Error, (in dsolve/numeric) 'parameters' must be specified as a list of unique unassigned names

 

# define parameter values

DefaultValues := [ A__h = .18, beta__1 = 0.8354e-1, psi = 0.7258e-1, mu__r = 0.51e-1, sigma = .165, alpha = .65, xi = 0.5e-1, gamma = .131, A__b = .7241, beta__o = 0.65e-1, mu__b = 0.17e-1,
     S0 = 100, G0 = 190, A0 = 45, R0 = 20, C0 = 35, B0 = 25   
]:

# Form the list of numerical values ordered as params

ValuatedParams := subs(DefaultValues, params)
   

Warning, inserted missing semicolon at end of statement

 

[45, .7241, .18, 25, 35, 190, 20, 100, .65, 0.8354e-1, 0.65e-1, .131, 0.17e-1, 0.51e-1, 0.7258e-1, .165, 0.5e-1]

(2)

# Instanciate the solution for this set of values

ans(parameters=ValuatedParams)

Warning, inserted missing semicolon at end of statement

 

ans(parameters = [45, .7241, .18, 25, 35, 190, 20, 100, .65, 0.8354e-1, 0.65e-1, .131, 0.17e-1, 0.51e-1, 0.7258e-1, .165, 0.5e-1])

(3)

#
# Plot solutions for a few of the dependent variablss
# just to show everything is working (more-or-less!)
#

  plots:-odeplot( ans, [T, S(T)] , T=0..10);
  plots:-odeplot( ans, [T, G(T)] , T=0..10);
  plots:-odeplot( ans, [T, A(T)] , T=0..10);
   plots:-odeplot( ans, [T,R(T)] , T=0..10);
  plots:-odeplot( ans, [T, C(T)] , T=0..10);
  plots:-odeplot( ans, [T, B(T)] , T=0..10);


if false then
  plots:-odeplot( ans, [T, S(T)] , T=0..10);
  plots:-odeplot( ans, [T, G(T)] , T=0..10);
  plots:-odeplot( ans, [T, A(T)], T=0..10);
  plots:-odeplot( ans, [T, R(T)] , T=0..10);
  plots:-odeplot( ans, [T, C(T)] , T=0..10);
  plots:-odeplot( ans, [T, B(T)] , T=0..10);
 


end if:

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

# How two use the parametric solution?
#
# Here an example with only one variable parameter, but this could be generalized to many
# (the main problem is then more a problem of "readability" than a technical one).
#

f := proc(VariableName::symbol, ParamName::symbol, ParamValues::list, params, ParamDefault, sol)
  local V, k, p, MyChoice, ValuatedParams:
  V := unapply(VariableName(T), T):
  k := 0:
  for p in ParamValues do
    k := k+1:
    MyChoice       := map(u -> if lhs(u)=ParamName then lhs(u)=p else u end if, ParamDefault):
    ValuatedParams := subs(MyChoice, params):
    sol(parameters=ValuatedParams):
    plot||k := plots:-odeplot(
                               sol,
                               [T, V(T)] ,
                               T=0..5,
                               legend=p,
                               color=ColorTools:-Color([rand()/10^12, rand()/10^12, rand()/10^12])
                             );
  end do:
  plots:-display(seq(plot||k, k=1..numelems(ParamValues)));
end proc:

f(B, epsilon, [0.0001, 0.334, 5.078], params, DefaultValues, ans);

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

 

f(B, beta, [0.1, 0.28, 0.35], params, DefaultValues, ans);

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

 

f(B, alpha , [0.23,0.28, 0.32], params, DefaultValues, ans);

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

 

f(J, tau , [0.04, 0.05, 0.06], params, DefaultValues, ans);

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

f(C, theta__h , [0.6, 0.7902, 0.8], params, DefaultValues, ans);

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

``


 

Download Mapdocx.mw

Hello

I need to build a system of linear equations from a list of polynomials.  The list of indeterminates is as follows:

incog:=[theta[1, 1], theta[1, 2], theta[2, 1], theta[2, 2], theta[2, 6], theta[3, 0], theta[3, 3], theta[3, 4], theta[3, 5]];

The list of polynomials is:

eq:=[1, theta[1, 1]+theta[2, 2]+theta[3, 3], -theta[1, 1]-theta[2, 2], theta[2, 6]*theta[3, 5], -theta[1, 1]*theta[3, 3]-theta[2, 2]*theta[3, 3], -theta[1, 1]*theta[2, 6]*theta[3, 5]+theta[1, 2]*theta[2, 6]*theta[3, 4], theta[1, 1]*theta[2, 2]*theta[3, 3]-theta[1, 2]*theta[2, 1]*theta[3, 3]+theta[1, 2]*theta[2, 6]*theta[3, 0]];

eq[1], eq[2] and eq[5] will be used as examples, although all of them should be used.  

In eq[1], there are no indeterminates, therefore the first line of the matrix related to the system of equations is:

[0, 0, 0, 0, 0, 0, 0, 0, 0]

In eq[2], there is a summation of  three indeterminates and the outcome is a set of three lines (summation of indeterminates)

[1, 0, 0, 0, 0, 0, 0, 0, 0]

[0, 0, 0, 1, 0, 0, 0, 0, 0]

[0, 0, 0, 0, 0, 0, 1, 0, 0]

In eq[5], there is a summation of a product of indeterminates and outcome is a set of two lines as follows:

[1, 0, 0, 0, 0, 0, 1, 0, 0]

[0, 0, 0, 1, 0, 0, 1, 0, 0]

 

Carrying on like this will result in a matrix of 14 lines with zeros and ones in positions related to the indeterminates.  Building the matrix is what matters to me.

I have a thousand of such problems with different indeterminates and set of polynomials.  

Any ideas on how to build a function to automatically create the matrices would be most appreciated.

Thank you.

Cheers

Ed

 

Hi

I am woking on a pharmo model for a freind, and it includes a variable called depot that needs to jump up by 150 every 24 hours.
currently I have written it as:

diff(Depot(t), t) = piecewise(t = 0, -Ka*Depot(t)+150, t = 24, -Ka*Depot(t)+150, -Ka*Depot(t))

clearly thats wrong though, as the +150 s don't make it jump up by 150 because of the small step size.


(at t=0, it adds 150*a small step size, at 24 it looks like it adds 150* a vastly smaller step size, what I want would be much closer to a series of pulses each decaying to almost 0 and then getting boosted to just over 150)

My intuition is that i need to use the dirac delta function but in such a way that its integral adds 150 instantaneoulsy every 24 hours. I have no idea how to do that!

Lindas_signal_transduction_model_2.mw

[Edit:
I've just realised that this ode has an obvious solution, so you can trivially make a function that adds 150 every 24 hours and exponentially decays in between.  However there are other models that hopefully i'll being doing similar work on, that don't have nice solutions]

 

First 642 643 644 645 646 647 648 Last Page 644 of 2429