MaplePrimes Questions

Swanson_and_Turkel_To_Fortran.mwHello,

From the attached code, you can see that I have a Matrix, A, that I am trying to output into Fortran code so that I can simply copy and paste this long matrix into fortran. The output does not look correct. Doesa anyone have an idea on how to put this matrix A into a form that can be easily copy and pasted into Fortran? You can see that I tried to do each line individually in the attatched code but I am really looking for a way to do the entire Matrix. Thanks for any help or suggestions.

I need to build this model:
We consider a population of female salmon, they live 4 years. Survival for first three years respectively: 0.5%,7%,15%. Each salmon has female kids only in 4 year and produces 5000 female offspring

 

I am trying to solve 4x4 determinants, but there is many determinants in my problem, I want to solve it in maple. Maple gives the answer but its expression is large. how to confine large expression in a nice simple form in maple? Here is an example:

with(LinearAlgebra):

A:=Matrix([[phi,conjugate(psi),chi,conjugate(rho)],[psi,-conjugate(phi),rho,-conjugate(chi)],[lambda1*phi,conjugate(lambda1)*conjugate(psi),lambda2*chi,conjugate(lambda2)*conjugate(rho)],[lambda1*psi,-conjugate(lambda1)*conjugate(phi),lambda2*rho,-conjugate(lambda2)*conjugate(chi)]]);


 

rk2.mw

 

Hello everyone,

I have an ODE for which I want to show that any initial condition leads to a convergence towards a point. So far I made a sequence of dsolve procedure, each with a distinct random initial condition, and I can plot everything on the same plot without a problem with display.

The parameter of the ode is the time t, so that the system of ode is some d/dt x(t) = f(x(t),y(t),z(t)), etc. To show time passing, I have two solutions in a sense, either by color, or by an animation. But the latter is not very convenient as I am already planning of to animate the rotation of the camera since the plot is 3D. What I would like, is the color of the curve to be say blue at time 0 then go to green as t goes to 5, for example.

I know something should be possible as there is somehow an example given in plot3d documentation,
plot3d(x*exp(−x^2−y^2),x=−2..2,y=−2..2,color=x)
but I can't seem to make it work, no matter where I put my "color = t" option. Would one have an idea on how to achieve that?

Thank you for your time,
Cryme

I am attempting to have maple recognize the difference in singularities between:

f(x)=x+1  and

g(x)=(x+1)*(x-2)/(x-2)

In other words how can I stop maple from simplifying g(x) and observe the singularity.

 

Thanks in advance.

Mark

 

I'm trying to solve an ODE system from an IVP problem, but the error occurs: "Error, (in ...) cannot evaluate the solution further left of ..., maxfun limit exceeded (see ?dsolve,maxfun for details)"

I've already tried modifying the maxfun value but this did not work. I would like some suggestion.

Thank you

ODE_System.mw

Hi,

If any one can tell me how to solve the nonlinear system sys:={x^2+y^2+z^2=4,x^2+y^2-z^2=4,x+y+z=0} by using fsolve command? I tried fsolve(sys,{x,y,z});, but there is no value returned. May I give fsolve an initial approxiamtaion of the solution ? If that is the case, what should I do?

 

Thanks in advance!

Hi all,

can anyone  indicate me how display  1O^-5 and not 1/100000 on the vertical axis?

Thanks in advance

Hello, 

 I created my own costum package and I want to edit this package: insert procedures or modules. Is there a way?

Thank you.

restart;

with(VectorCalculus);

with(LinearAlgebra);

r1 := Vector([0, 0, 1]);

r2 := Vector([sin(theta1), 0, cos(theta1)]);

r3 := Vector([VectorCalculus:-`*`(sin(theta2), cos(phi2)), VectorCalculus:-`*`(sin(theta2), sin(phi2)), cos(theta2)]);

M := Matrix([r1, r2, r3]); ex := `assuming`([simplify(VectorCalculus:-`*`(Determinant(M), 1/VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(1, DotProduct(r1, r2)), DotProduct(r1, r3)), DotProduct(r2, r3))))], [theta1 > 0, theta2 > 0, phi2 > 0]);

dex := eval(simplify(diff(arctan(ex), phi2)), phi2 = t);

VectorCalculus:-`*`(2, Int(VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(2, Int(dex, t = 0 .. phi2)), 1/VectorCalculus:-`*`(4, Pi)), VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(2, Pi), sin(theta1)), sin(theta2)), 1/VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(4, Pi), 4), Pi))), [phi2 = 0 .. Pi, theta2 = 0 .. Pi, theta1 = 0 .. Pi], method = _CubaCuhre, epsilon = 0.5e-2));

evalf(%)

 

 

Ok I deleted my other question, since there was a mistake. I actually want to integrate the following expression. The arctan is not every positive in my integral there, so I needed to go this way to make it continuous. The problem here is the nested integral inside Int(...,t=0..phi2) which leads to maple not being able to evaluate.

ψ =-0.09,-0.07,-0.04,-0.01,0,0.01,0.04,0.07,0.09

these are the ψ values.

then X=

here we can take eta =0..2 and X=-15..15
using this relation how to plot streamlines for eta against X.

Code:
restart; with(plots); fcns := {T(eta), f(eta)}; ep := .1; M := 1; kp := .5; n := 1; ec := .1; pr := 1; s := .1; N := 5; sys := diff(f(eta), eta, eta, eta)+f(eta)*(diff(f(eta), eta, eta))-(diff(f(eta), eta))*(diff(f(eta), eta))+ep*ep+(M+1/kp)*(ep-(diff(f(eta), eta))) = 0, diff(T(eta), eta, eta)+pr*(f(eta)*(diff(T(eta), eta))-n*(diff(f(eta), eta))*T(eta))+pr*(ec*(diff(f(eta), eta, eta))*(diff(f(eta), eta, eta))+ec*(M+1/kp)*(diff(f(eta), eta))^2+s*T(eta)) = 0; bc := f(0) = 0, (D(f))(0) = 1, (D(f))(N) = ep, T(0) = 1, T(N) = 0; R := dsolve(eval({bc, sys}), numeric, method = bvp[midrich], abserr = 0.1e-9, output = operator); psi = [-0.9e-1, -0.7e-1, -0.4e-1, -0.1e-1, 0, 0.1e-1, 0.4e-1, 0.7e-1, 0.9e-1]; for i to 9 do X[i] = psi[i]/f(eta); print(plots:-contourplot(X[i](X, eta), eta = 0 .. N, X = 0 .. 6)) end do

 


 

Hi, 

I am interested to find the primes in in field Zp which Have prime inverses.  In particular, for any prime p up to an arbitrary number N, the number of pairs (a,b) where a and b are mutually inverse primes <p in Zp. Obviously in this context (a,b) is the same as (b,a) so no need for double counting. What I have so far is the following simple code for finding the inverse of prime q<p, given a chosen value of p. I can then see which results are prime and which are composite.

N:=p:

for n from 1 to N do

X:=q*n-1;

if mod(X,p)=0 then print(n);

end if:

end do:

This “hand cranking” method works but is of course boring but I don’t know how to scale it up to a more efficient code as described above. I would be grateful to anyone  able to assist me with this.

Thanks in advance

David

I am currently implementing the math behind the McEliece Cryptosystem in Maple, and as such I need to do work in the Galois Field GF(2^m). In my working example I am working with p=2, k=4, and a=1+x (i.e. the rank of my polynomial is 1). Parameters are per documentation found at https://www.maplesoft.com/support/help/maple/view.aspx?path=GF.

 

When attempting to initialize this field, however, I am receiving an error that the rank is not 4=k as expected. It is, however, not a requirement for a field that the polynomial has to be of rank k. How do I go about this?

G16 := GF(2, 4, 1+x);
Error, (in GF) polynomial 1+x does not determine an extension of degree 4

Hello! 

I tried to find Killing vectors of a certain metric, but Maple gives an error, which is reproduced with the following piece of code (the metric which I need is more difficult, so I would like to refrain from using "Physics" package). Could anybody tell me what the problem is and how I should solve it, please?

 

exampleError.mw
 

restart

with(DifferentialGeometry); with(Tensor); with(LieAlgebras)

DGsetup([xi, chi, u1, u2, v1, v2], P)

`frame name: P`

(1)
P > 

g := evalDG(1/2*(`&t`(dxi, dxi)+`&tensor`(du1*v1+du2*v2+dchi, du1*v1+du2*v2+dchi)*exp(-2*xi)+`&t`(dv1, dv1)+`&t`(dv2, dv2)))

_DG([["tensor", P, [["cov_bas", "cov_bas"], []]], [[[1, 1], 1/2], [[2, 2], (1/2)*exp(-2*xi)], [[2, 3], (1/2)*exp(-2*xi)*v1], [[2, 4], (1/2)*exp(-2*xi)*v2], [[3, 2], (1/2)*exp(-2*xi)*v1], [[3, 3], (1/2)*exp(-2*xi)*v1^2], [[3, 4], (1/2)*exp(-2*xi)*v1*v2], [[4, 2], (1/2)*exp(-2*xi)*v2], [[4, 3], (1/2)*exp(-2*xi)*v1*v2], [[4, 4], (1/2)*exp(-2*xi)*v2^2], [[5, 5], 1/2], [[6, 6], 1/2]]])

(2)
P > 

KV := KillingVectors(g)

Error, (in DifferentialGeometry:-Tensor:-Christoffel) expected 1st argument to be a metric tensor. Received: _DG([["tensor", P, [["cov_bas", "cov_bas"], []]], [`...`]])

 
P > 

``


 

Download exampleError.mw

 

First 765 766 767 768 769 770 771 Last Page 767 of 2427