MaplePrimes Questions

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]

 

Hello

When i export an animation as a gif the dimensions are (by default it seems) 400x400 pixels (w x h).

But my slide show requires a dimension of 1920 x 1080 pixels.

How to I tell maple to export a gif of predefined dimensions?

I can manually adjust the dimensions of the animation by grabbing a corner and pulling it right and down and then export it, but its hit and miss.

Here is an example animation written by Kitonum

restart;
with(DEtools):
rho := 0.1:
w0 := 2:
sys := a->[diff(x(t),t) = y(t),diff(y(t),t) = -2*rho*y(t) - w0^2*(x(t)+a)];
P:=a->DEplot(sys(a), [x(t),y(t)], t = 0 .. 20-2*a, x=-2..2, y=-1.9..1.7, [[x(0) = cos(a)-a, y(0) = sin(a)]], scene = [x(t),y(t)], linecolor=blue, numpoints=1000):
plots:-animate(plots:-display,['P'(a), size=[600,300]], a=-0.7..1.4, frames=90);

 

 

When I first open my worksheet, my PolynomalInterpolation code looks and works fine,

However, when I press enter, it only displays the command text,

Why is this happening? How can I fix it?

Fyi, this solution to 1D wave pde is wrong. The solution does not even satisfy the PDE itself. Compared it to a numerical solution and they are not the same solution. Do not have time now to write the hand solution. But it is clear the solution is not valid.

I do not know now how to roll back to earlier version of the Physcis packages to see if this used to work OK before. Since when typing Physics:-Version(420) It gives error

Error, (in Physics:-Version) unable to determine the Physics Updates version, could you please report the problem to support@maplesoft.com

And Physics:-Version(425) seems to hang. I am not sure if these commands are supposed to automatically download the physics package from the cloud and install it on my PC or what.

Any way, could someone please verify the solution they get is the same as shown below? May be someone with earlier physics package could try to see if they get different solution?

restart

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 429 and is the same as the version installed in this computer, created 2019, September 23, 0:14 hours, found in the directory C:\Users\me\maple\toolbox\2019\Physics Updates\lib\`

pde:=diff(u(x,t),t$2)=4*diff(u(x,t),x$2);
ic:=u(x,0)=0,D[2](u)(x,0)=sin(x)^2;
bc:=u(-Pi,t)=0,u(Pi,t)=0;
sol:=pdsolve([pde,ic,bc],u(x,t))

diff(diff(u(x, t), t), t) = 4*(diff(diff(u(x, t), x), x))

u(x, 0) = 0, (D[2](u))(x, 0) = sin(x)^2

u(-Pi, t) = 0, u(Pi, t) = 0

u(x, t) = t*sin(x)^2

pdetest(sol,pde)

-8*t*(2*cos(x)^2-1)

simplify(diff(rhs(sol),t$2)-4*diff(rhs(sol),x$2))

-16*t*cos(x)^2+8*t

 


 

Download sept_23_2019.mw

  Hello,every one :

There is a recursive formula where parameters a,b,c and d are real numbers with a>=b, c>=d;

rsolve({f(n+1)-((a-1)*(b-1)+(c+d))*f(n)-c*d*f(n-1)=0, f(0)=a,f(1)=a*(b - 1)+c},f):	
simplify(%) 

Final expression is too complex, If possible,I'd like to get a more concise expression. 
The screenshots of my running results are as follows:

Thanks in advance.

How can I make Maple preserve old outcomes?

Hi!

Can someone help me with the kind of document I have to submit to prove my student status? 

Thank you!

First 638 639 640 641 642 643 644 Last Page 640 of 2425