MaplePrimes Questions

I want ot replace the free variable introduced by the BackwardsSubstitution procedure with a number. But though the variable looks like x1 I think it must be something else.

problem.maple


here my code . iam trying to generate a binomial sample but there is some error occure please help

with(Statistics):

 

with(Student[Statistics]):

``

P := .1:

``

r[1] := convert(BinomialRandomVariable(N-n, P), `+`)

`Non-fatal error while reading data from kernel.`

(1)

for i from 2 to N-n do A[i-1] := convert(r[i-1], `+`); r[i] := BinomialRandomVariable(N-n-(sum(A[i], j = 1 .. i-1)), P) end do;

`Non-fatal error while reading data from kernel.`

 

`Non-fatal error while reading data from kernel.`

 

`Non-fatal error while reading data from kernel.`

 

`Non-fatal error while reading data from kernel.`

 

`Non-fatal error while reading data from kernel.`

 

`Non-fatal error while reading data from kernel.`

 

`Non-fatal error while reading data from kernel.`

 

`Non-fatal error while reading data from kernel.`

(2)

for i to N-n do x[i] := Sample(r[i], 1) end do

x[1] := Vector[row](1, {(1) = 1})

 

Error, (in pr) unable to evaluate 5-A[2] to floating-point

 

sum(R[j], j = 0 .. 10)

2+R[0]+r[4]+r[5]+R[6]+R[7]+R[8]+R[9]+R[10]

(3)

``

NULL


 

 

This should be a simple problem, but I am having trouble resolving a contradiction in integral evaluation that is included in the results below.  Instead of butting my head further perhaps someone can point out my probable error.

You will see in both cases I have a triangle signal with a slope of (-1).  However in the 2nd case I have linked the period T to the slope parameter alpha.  If I assign alpha=1 then the results of the 2 integrals should = 1/4, but the 2nd one does not.

Appreciate any feedback.


 

plot(piecewise(-1 < x and x < 0, 0, 0 < x and x < 1, 1-x), x = -2 .. 2, linestyle = solid, thickness = 5, scaling = constrained, title = "Asymmetric Triangle Wave", titlefont = [COURIER, 18])

 

n := 0; 1; T := 2; 1; a[0] := (int(0*exp(-I*(2*Pi*n*t/T)), t = -(1/2)*T .. 0)+int((1-t)*exp(-I*(2*Pi*n*t/T)), t = 0 .. (1/2)*T))/T

1/4

(1)

restart

alpha := 1; T := 2/alpha; plot(piecewise(x < 0, 0, 0 < x and x < (1/2)*T, -alpha*x+1), x = -T .. T, linestyle = solid, thickness = 5, scaling = constrained, title = "Asymmetric Triangle Wave", titlefont = [COURIER, 18])

 

  n=0 term:n := 0; 1; alpha := 1; 1; T := 2; 1; a[0] := (int(0*exp(-I*(2*Pi*n*t/T)), t = -(1/2)*T .. 0)+int((1-alpha*T)*exp(-I*(2*Pi*n*t/T)), t = 0 .. (1/2)*T))/T

-1/2

(2)

``


 

Download integral_contradiction.mw

Hi,

This is my first question here! 

I want to show weird things that can happen in numerical analysis. The example I use is the sum from i=1 to infinity of (1/i) (the harmonic series). In theory this series diverge but in practice it could converge. 

I would want all the calculations to use floating point arithmetic with small mantissa (for instance m=1,2,3)). But the problem is I don't know how to fix mantissa in maple... I have the following fonction: 

g := n -> evalf[m](sum(evalf[m](1/i),i=1..m))

but evalf just show significant digit without changing the mantissa.... 

I hope my question is clear! Thanks for your help! 

 

 

Hi, I a have a question, if you can help me I would be pleased
 

Here is a problem:

for i from 1 to 4 do
 if A[i,i]=0 then break
 else
  for l from i to 4 do
   A[i,l]=A[i,l]/A[i,i]:
   b[i,1]=b[i,1]/A[i,i]
  od:
  for j from i+1 to 4
   for k from i to 4 do
    A[j,k]=A[j,k]-A[j,i]*A[i,k]
   od:
   b[j,1]=b[j,1]-A[j,i]*b[i,1]
  od:
 fi:
od:


I definited matrix A and b, but this for loop doesn't work.

 

Thank you for your help.

I worked on a document about 2 hours ago. And now when I try to open it, it is empty. I saved it in MapleCloud, and I have had it saved before. So today I opnened the saved file from MapleCloud, but now it is gone. How can I get it back!!? It happend to two of my most important files..

Hi all,

I found some strange behavior while usings tensors from Physics; I wanted to make sure I wasn't missing something here.

It seems that changing the metric (for instance, to +++-) causes raising and lowering problems. As an example:

with(Physics):
Setup(metric=`+++-`):

# Define our system of equations
Coordinates(X):

# Define tensors
{U[~mu] = [u(X),0,0,1],
A[~mu]=[0,0,0,n(X)]}:
Define(op(%)):

F[mu,nu]=d_[mu](A[nu]) - d_[nu](A[mu]):
Define(%):

# Multiply tensors
TensorArray(F[~0,~mu].U[mu]);

This produces

-diff(n(X),x1)*u(X)-2*diff(n(X),x4)

However, only the first term should be present. It seems that changing the mulitplication to F[0,~mu].U[mu] produces the correct output, as does removing the Setup call. Also, manually defining F produces the expected output; only defining it via A seems to generate the discrepancy.

Any idea if this is a bug or a feature?

Thanks!

I have a worksheet that illustrates a problem I have, How do I make this worksheet available on Mapleprimes?

PDE := diff(u(x, y), x, x)+diff(u(x, y), y, y)-6*x*y*(1-y)-2*x^3 = 0; BCsx := u(xL, y) = 0, u(xU, y) = y*(1-y); BCsy := u(x, yL) = 0, u(x, yU) = 0; solPDE := pdsolve({BCsx, BCsy, PDE}, u(x, y)); exactSol := unapply(rhs(%), x, y)

how i can write these boundary conditions for dsolve?

(diff(u(r), r))^(n-1)*(diff(r*(diff(u(r), r)), r))/r    be [finite] at r =0

and  u(0) = finite?

Thanks..

 

Hello!

I can't seem to figure out how to use the Physics package within a procedure. In particular, I can't get tensors to be recognized within the body of the proc.

As an example, here's a short program that works correctly when not in a procedure:

with(Physics):
Coordinates(X,quiet):
d_[mu](X[~mu]);
# Returns 4; Correct

However, placing this code inside a proc causes the tensor X to not be recognized as a tensor:

Test := proc()
  uses Physics:

  Coordinates(X,quiet):
  d_[mu](X[~mu]);
end proc:
Test();
# Returns 0; Wrong

Apparently, Physics:-Coordinates still defines the tensor X (as can be checked by calling Physics:-Define()). However, the derivative d_[mu] (X[~mu]) seems to be treating X as a standard symbol. Any idea how I would go about correcting this?

Thanks!


I have a procedure which works. &oplus;(a,b) gives annwer.   a &oplus; b also gives answer. That was a surprise, discovered from a typing mistake. If b is negative is needs to be enclosed in delay evulation quotes.

2  questions 

Can anyoone expllain this useful property? Any way around having to use delay evaluation quotes for negative numbers?

restart

NULL

``

NULL

`&oplus;` := proc (a, b) (a+b)/(1-a*b) end proc

proc (a, b) (a+b)/(1-a*b) end proc

(1)

`&oplus;`(1, 2)

-3

(2)

`&oplus;`(1, 2)

-3

(3)

`&oplus;`(`&oplus;`(`&oplus;`(1, 2), '-5'), 4)

-32/9

(4)

``

`&oplus;`(1, 1/2)

3

(5)

`&oplus;`(1/2, '-1')

-1/3

(6)

"(=)"

-1/3

(7)

`&oplus;`(0, h)

h

(8)

`&oplus;`(h, 0)

h

(9)

`&oplus;`(1/h, '-h')

(1/2)/h-(1/2)*h

(10)

`&oplus;`(1/h, -h)

(1/2)/h-(1/2)*h

(11)

-`&oplus;`(h, 1/h^2)

-(h+1/h^2)/(1-1/h)

(12)

"(=)"

(-h^3-1)/(h*(h-1))

(13)

NULL


 

Download Circle_Sum.mw

Hello,

please, help me understand why the procedure does not see a variable.

If you do this, then everything works:

 

restart;
F := 8*y^2*(3*R^2+2*y^2)/r^4; 
G := 24*R^2*y^4/r^6;
sigma := simplify(subs(r = sqrt(x^2+y^2), (1-k[1]+k[2])*R^2*(3-(3*R^2+18*y^2)/r^2+F-G)/(2*r^2)+k[2]*R^2*(1-2*y^2/r^2)/r^2)):
k[1] := E[2]*((3-nu[2])*E[1]+(5+nu[1])*E[2])/((E[1]+2*E[2])^2-(nu[2]*E[1]+(1-nu[1])*E[2])^2);
k[2] := E[2]*((3*nu[2]-1)*E[1]+(1-3*nu[1])*E[2])/((E[1]+2*E[2])^2-(nu[2]*E[1]+(1-nu[1])*E[2])^2);
nu[1] := 1/3; nu[2] := 1/3;
s := simplify(sigma);
si := proc (x, y) if R <= x^2+y^2 then -(3/2)*R^2*(-(1/3)*y^6+(R^2+(11/3)*x^2)*y^4+(-6*R^2*x^2+3*x^4)*y^2+R^2*x^4-x^6)*(E[1]-E[2])/((x^2+y^2)^4*(E[1]+2*E[2])) else E[2]*((3*nu[2]-1)*E[1]+(1-3*nu[1])*E[2])/((E[1]+2*E[2])^2-(nu[2]*E[1]+(1-nu[1])*E[2])^2) end if end proc:
R := 1; M := 5;
E[2] := (1/10)*E[1];
plot3d(si, -M .. M, -M .. M, axes = frame);

 

and we get a beautiful plot:

 

If inside the procedure after 'then' I try to enter the variable s, then the procedure does not see it .... global, local, return (s), value(s), inside the procedure or outside, Ive tried everything .... help plzl!

 

restart;
F := 8*y^2*(3*R^2+2*y^2)/r^4; 
G := 24*R^2*y^4/r^6;
sigma := simplify(subs(r = sqrt(x^2+y^2), (1-k[1]+k[2])*R^2*(3-(3*R^2+18*y^2)/r^2+F-G)/(2*r^2)+k[2]*R^2*(1-2*y^2/r^2)/r^2)):
k[1] := E[2]*((3-nu[2])*E[1]+(5+nu[1])*E[2])/((E[1]+2*E[2])^2-(nu[2]*E[1]+(1-nu[1])*E[2])^2);
k[2] := E[2]*((3*nu[2]-1)*E[1]+(1-3*nu[1])*E[2])/((E[1]+2*E[2])^2-(nu[2]*E[1]+(1-nu[1])*E[2])^2);
nu[1] := 1/3; nu[2] := 1/3;
s := simplify(sigma);
si := proc (x, y) if R <= x^2+y^2 then s else E[2]*((3*nu[2]-1)*E[1]+(1-3*nu[1])*E[2])/((E[1]+2*E[2])^2-(nu[2]*E[1]+(1-nu[1])*E[2])^2) end if end proc:
R := 1; M := 5
E[2] := (1/10)*E[1];
plot3d(si, -M .. M, -M .. M, axes = frame);

As the title states, i would like to have collection of the "last stored output and input" datatable that is globally stored ie happens whenever an exception occurs in a maple worksheet i am working on.

 

For example, suppose the following execution causes a fatal exception and the interface tells me to save and exit the worksheet then reopen it:
 

ExchangeRATE(MaplePrimes-Reputation-Points, Stack-Exchange-Reputation-Points)


 

Download MAPLE_HELPY.mw

 

I would like the data [ExchangeRate, [MaplePrimes-Reputation-Points, Stack-Exchange-Reputation-Points]] to be automatically stored in a csv or excel spreadsheet or even a .txt file will be fine

Basically i need incorparate a bit of code that tells maple to "give up" once the amount of computation time has reached a certain amount, because when i started using maple i got into this habit of just waiting for the output no matter what, and it has taken me a bit of time to realize that sane people are not happy to leave a dozen worksheets evaluating executions overnight while they sleep, and also this of course is related to the habits formed that result in my code often being sluggish.

I am guessing that i would just enclose the code intended to be executed in a "while" loop of some sort and will probably work out how to do it on my own, but i think because of the importance of this particular "behavioral habit" in the development of people younger than me using maple, i should post a question about it.

First 826 827 828 829 830 831 832 Last Page 828 of 2428