Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I have not touched Maple in about 10 years and I'm back but apparently my Maple skills got quite a bit it rusty. I'm trying to plot a function but keep getting this warning and a blank graph:

"Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct"


Here is what I'm trying to do (put and call formulas for Black 76 model):

> with(Statistics);
> X := RandomVariable(Normal(0, 1));
> K := 150;
> r := 0.25e-1;
> s := .75;
> t := .5;
> d1 := f-> (log(f/K)+.5*s^2*t)/(s*sqrt(t)):

> d2 := f-> d1(f)-s*sqrt(t):
> c := f-> exp(-r*t)*(f*([CDF])(X, d1(f))-K*([CDF])(X, d2(f))) :
p := ->exp(-r*t)*(K*([CDF])(X, -d2(f))-f*([CDF])(X, -d1(f))):

All of the above work as intented:
> evalf(c(100)), evalf(p(100));

return the correct values. But I can't plot c( ) or p( ):

plot(c(f), f = 50 .. 100)

"Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct"

What am I doing wrong here? I will appreciate any help.

Thank you.

Fsolve produces the correct solution.  solve followed by evalf produces a completely different solution.

What am I doing wrong?

## Ioannes Colla problem: "Divide 10 into three parts such that they
## shall be in continued proportion and that the product of the first
## two shall be 6"
eqs := [a+b+c=10, a/b=b/c, a*b=6];
fsolve(eqs); ## correct solution
evalf(solve(eqs)); ## different

Tom Dean

If A is an m × n matrix and B is a p × q matrix, then the Kronecker product C = A ⊗ B is the mp × nq block matrix. Assume I have matrix C and want to find matrix A and B. This problem has known solution called "Nearest Kronecker Product". So I just need a function like this: A,B:=NearestKroneckerProduct(C)  which minimizes ||C - A ⊗ B||F  where denotes frobenius norm. 

Here is an Image that shows a mathematica code:

I took it from the link below:

https://mathematica.stackexchange.com/questions/91651/nearest-kronecker-product

Also there is a matlab code:

https://gist.github.com/tholden/58dd9a8991daa750ae36a633fe7060a4/revisions

can you convert mathematica code to maple?

If I do:

df:=DataFrame(Matrix(3,4,[seq(1..12)]), rows=[a,b,c],columns=[A,B,C,D]);Tabulate(df, width=100)

 

The font that Maple uses for the Tablulate is much larger than the font used to display the Dataframe. How does one choose the font size that Tabluate() uses? 

Peter

Hello,

I have been given the assigment to plot at sphere in maple, with a spherical triangel. I know how to plot the sphere:

restart; with(geom3d); with(plots); with(Plot); with(plottools);
display(sphere([0, 0, 0], 1), axes = Framed)

But i do not know how to mape the spherical triangels on the sphere.

The koordinates are:

A(1,0,0)

B(0,1,0)

C(0,0,1)

Hope somone can help

Hi, i want to plot an ode plot with respect to a parameter (E) in range [0,4] instead of time.
I start with unassign variable E and tried to change 't' for 'E' directly, but its give me error 
did I use the incorrect syntax/ step?
 

restart; with(linalg); with(VectorCalculus); with(DEtools); with(plots)

r := .9; K := 10; beta := .5; g := 0.3e-1; alpha[1] := .4; alpha[2] := 2.2; alpha[3] := 4; d[1] := .1; d[2] := .1; q := 1; E := 2.5; s := .46; delta := 1.5; b := 1.2; p := 1; c := 0.1e-1; mu := 0.25e-1; P0 := 4; M0 := 5; N0 := 3; L0 := 2; T := 20

> dP := VectorCalculus[`+`](VectorCalculus[`+`](VectorCalculus[`*`](VectorCalculus[`*`](r, P(t)), VectorCalculus[`+`](1, VectorCalculus[`-`](VectorCalculus[`*`](P(t), 1/K)))), VectorCalculus[`*`](g, P(t))), VectorCalculus[`-`](VectorCalculus[`*`](beta, P(t)))); dM := VectorCalculus[`+`](VectorCalculus[`+`](VectorCalculus[`*`](beta, P(t)), VectorCalculus[`-`](VectorCalculus[`*`](VectorCalculus[`*`](q, E), M(t)))), VectorCalculus[`-`](VectorCalculus[`*`](d[1], M(t)))); dN := VectorCalculus[`+`](VectorCalculus[`-`](VectorCalculus[`*`](s, N(t))), VectorCalculus[`*`](VectorCalculus[`*`](VectorCalculus[`*`](delta, N(t)), M(t)), 1/VectorCalculus[`+`](M(t), VectorCalculus[`*`](b, N(t))))); dL := VectorCalculus[`+`](VectorCalculus[`*`](VectorCalculus[`+`](alpha[1], VectorCalculus[`-`](VectorCalculus[`*`](VectorCalculus[`*`](alpha[2], L(t)), 1/VectorCalculus[`+`](alpha[3], M(t))))), L(t)), VectorCalculus[`-`](VectorCalculus[`*`](d[2], L(t))));

> satu := diff(P(t), t) = dP; dua := diff(M(t), t) = dM; tiga := diff(N(t), t) = dN; empat := diff(L(t), t) = dL;

> pdb := satu, dua, tiga, empat; fcns := {L(t), M(t), N(t), P(t)};
> Q := dsolve({pdb, L(0) = L0, M(0) = M0, N(0) = N0, P(0) = P0}, fcns, type = numeric, method = rkf45, maxfun = 500000);
> odeplot(Q, [[t, P(t), color = blue], [t, M(t), color = green], [t, N(t), color = red], [t, L(t), color = gold]], t = 0 .. T, numpoints = 100000, thickness = 2); 

its work fine if i plot with respect to time (t), but when i tried to change it for a parameter like E its doesnt work

unassign('E'); 
odeplot(Q, [[E, P(t), color = blue]], E = 0 .. 4, numpoints = 100000, thickness = 2)

Error, (in plots/odeplot) curve is not fully specified in terms of the ODE solution, found additional unknowns {E}
following the output that I expected

attached: captive_breeding.mw

Hi,

I can use plot3d() command. But when I want to use contourplot() or densityplot() commands, Maple diaplays no plots.

Can you please guide me?

 

 

We put A = {1,2,3,4} and B is the set of lower cubes
to 100 of positive integers.Determine A ∪ B  A ∩ B , A ∩ {6,8} and A \ B 

Write the list of numbers of prime numbers that are less than 10000

As always, thank you all in advanced.

I found this challenge by chance.

solve 615+x^2=2^y over integers.

I rushed to Maple and tried to solve it  with “solve” and "assuming" but I did not get results.

solve(615+x^2=2^y) assuming x::integer,y::integer   did not work.

How could this equation be suitably formulated for Maple to solve it?
 

 

Hi,

i am trying to solve a differential equation numercially but since it is second degree,I can not achieve the proper answer.What should I do?

thank you
diff1.mw
 

restart

h := 1-.8*x+.5*(x^2-x)

1-1.3*x+.5*x^2

(1)

z := 3^(3/2)*(((2+k*De^2*(diff(p(x), x))^2*h^2)^3*h^2+108*k*De^2)/k)^(1/2)

3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2)

(2)

c := (1/6)*((-54*De+z)*k^2*h^2)^(1/3)/(k*De*h)-(1/2)*h*(2+k*De^2*(diff(p(x), x))^2*h^2)/(De*((-54*De+z)*k^2*h^2)^(1/3))-(1/2)*h*(diff(p(x), x))

(1/6)*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3)/(k*De*(1-1.3*x+.5*x^2))-(1/2)*(1-1.3*x+.5*x^2)*(2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)/(De*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3))-(1/2)*(1-1.3*x+.5*x^2)*(diff(p(x), x))

(3)

ode1 := ((1/2)*c*(diff(p(x), x))^2*h^4+(diff(p(x), x))*c^2*h^3+(1/10)*(diff(p(x), x))*h^5+c^3*h^2)*k*De^2+(1/2)*c*h^2+(1/6)*(diff(p(x), x))*h^3+h = 0

((1/2)*((1/6)*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3)/(k*De*(1-1.3*x+.5*x^2))-(1/2)*(1-1.3*x+.5*x^2)*(2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)/(De*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3))-(1/2)*(1-1.3*x+.5*x^2)*(diff(p(x), x)))*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^4+(diff(p(x), x))*((1/6)*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3)/(k*De*(1-1.3*x+.5*x^2))-(1/2)*(1-1.3*x+.5*x^2)*(2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)/(De*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3))-(1/2)*(1-1.3*x+.5*x^2)*(diff(p(x), x)))^2*(1-1.3*x+.5*x^2)^3+(1/10)*(diff(p(x), x))*(1-1.3*x+.5*x^2)^5+((1/6)*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3)/(k*De*(1-1.3*x+.5*x^2))-(1/2)*(1-1.3*x+.5*x^2)*(2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)/(De*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3))-(1/2)*(1-1.3*x+.5*x^2)*(diff(p(x), x)))^3*(1-1.3*x+.5*x^2)^2)*k*De^2+(1/2)*((1/6)*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3)/(k*De*(1-1.3*x+.5*x^2))-(1/2)*(1-1.3*x+.5*x^2)*(2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)/(De*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3))-(1/2)*(1-1.3*x+.5*x^2)*(diff(p(x), x)))*(1-1.3*x+.5*x^2)^2+(1/6)*(diff(p(x), x))*(1-1.3*x+.5*x^2)^3+1-1.3*x+.5*x^2 = 0

(4)

ivp := {ode1, p(0) = 0}

{((1/2)*((1/6)*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3)/(k*De*(1-1.3*x+.5*x^2))-(1/2)*(1-1.3*x+.5*x^2)*(2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)/(De*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3))-(1/2)*(1-1.3*x+.5*x^2)*(diff(p(x), x)))*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^4+(diff(p(x), x))*((1/6)*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3)/(k*De*(1-1.3*x+.5*x^2))-(1/2)*(1-1.3*x+.5*x^2)*(2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)/(De*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3))-(1/2)*(1-1.3*x+.5*x^2)*(diff(p(x), x)))^2*(1-1.3*x+.5*x^2)^3+(1/10)*(diff(p(x), x))*(1-1.3*x+.5*x^2)^5+((1/6)*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3)/(k*De*(1-1.3*x+.5*x^2))-(1/2)*(1-1.3*x+.5*x^2)*(2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)/(De*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3))-(1/2)*(1-1.3*x+.5*x^2)*(diff(p(x), x)))^3*(1-1.3*x+.5*x^2)^2)*k*De^2+(1/2)*((1/6)*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3)/(k*De*(1-1.3*x+.5*x^2))-(1/2)*(1-1.3*x+.5*x^2)*(2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)/(De*((-54*De+3*3^(1/2)*(((2+k*De^2*(diff(p(x), x))^2*(1-1.3*x+.5*x^2)^2)^3*(1-1.3*x+.5*x^2)^2+108*k*De^2)/k)^(1/2))*k^2*(1-1.3*x+.5*x^2)^2)^(1/3))-(1/2)*(1-1.3*x+.5*x^2)*(diff(p(x), x)))*(1-1.3*x+.5*x^2)^2+(1/6)*(diff(p(x), x))*(1-1.3*x+.5*x^2)^3+1-1.3*x+.5*x^2 = 0, p(0) = 0}

(5)

dsolve(ivp, p(x), numeric, parameters = [k, De])

Error, (in dsolve/numeric/make_proc) Could not convert to an explicit first order system due to 'RootOf'

 

``


 

Download diff1.mw

 

 


 

Download diff1.mw

Simple, but racking my brains, what is the formula for the sequence 2,3,4,6,8,9,10,12,14,15,16,18,...?

I have problem: Let  A(2,0,0), B(0,3,0), C(0,0,6) and D(1,1,1) be four points and Delta is the line passing through the point D so that sum of distances from the points A, B, C to Delta maximum. Find a direction vector of Delta.

I tried. Let v(a,b,c) where a^2 + b^2 + c^2 = 1 and my code
 

with(Student:-MultivariateCalculus):
with(Optimization):
A := [2, 0, 0]: 
B := [0, 3, 0]: 
C := [0, 0, 6]: 
DD := [1, 1, 1]: 
v := <a, b, c>: 
d := Line(DD, v): 
d1 := Distance(A, d): 
d2 := Distance(B, d): 
d3 := Distance(C, d): 
S := d1+d2+d3: 
Maximize(S, {a^2+b^2+c^2 = 1});

I didn't get the result. How to get the numbers a, b, c?

Hello,

Is it possible to expand vector calculus identities directly in Maple without taking them to basis form (i.e. their component partial derivatives).

For example: 

restart

with(Physics[Vectors]):

%Curl(u*%Gradient(v)) = u*%Curl(%Gradient(v)+`&x`(%Gradient(u), %Gradient(v)))

 

Given the Left Hand Side, can Maple come up with the RHS on its own?

Many Thanks.

Let (u (n)) be the sequence defined by u (n + 1) = 3.5u(n) (1 - u (n)) and u (0) = 0.4.
1. Create the sequence s whose elements are [k, u (k]) for k varying from 0 to 100.
2. Graph the list of points with the plot function and the style = point option.

First 675 676 677 678 679 680 681 Last Page 677 of 2218