Items tagged with assume assume Tagged Items Feed

intersection in the geometry package does not seem to recognize assume.

restart: with(geometry):

assume(p[1]<>0, p[2]<>0, p[3]<>0);
assume(q[1]<>0, q[2]<>0, q[3]<>0);
point(T,[p[1],q[1]]);
point(U,[p[2],q[2]]);
point(V,[p[3],q[3]]);
point(Op,[0,0]);

line(OT,[Op,T]);
line(OU,[Op,U]);
line(OV,[Op,V]);

point(B,2*q[2],solve(subs(x=2*q[2],Equation(OU)),y));
coordinates(B);
IsOnLine(B,OU);

PerpendicularLine(AD,B,OT);
ArePerpendicular(AD,OT);
sol:=solve({Equation(AD),Equation(OT)},{x,y});
eval(x,sol);
point(A,eval(x,sol),eval(y,sol));  ## the intersection exists
intersection(xA,AD,OT); ## fails
about(p[1]),about(q[1]);

Hi guys,

I'm doing some heavy analytical calculations, as the calculations take hours to finish, I want to save the results, which is easily done, however when I load the saved results, it behaves differently, somehow I can no longer substitute the variables. I extracted the main problem into the following minimal working example.

Thanks for any useful insight,

Cheers, Sören

restart():

assume(`in`(n, real))

x := n+1

n+1

(1)

subs(n = 1, x)

2

(2)

save x, "./myfunction.m";

read "./myfunction.m";

x

n+1

(3)

Now we can't substitute n in x:

subs(n = 1, x)

n+1

(4)

subs(n = 1, n+1)

2

(5)

y := x:

Download assume_and_save.mw

The question in the title has been raised before over the years, but has maybe not received enough attention.
Reraising the question was motivated by a comment by Kitonum to a recent post on improved integration results in Maple 2016:
http://mapleprimes.com/maplesoftblog/202910-New-And-Improved-Integration-Results

Consider the following session.
restart;
assume(n=0);
n^2; #Returns n^2
eval(%);#Returns n^2
sin(n*Pi); # Returns 0
sin(n); # Returns sin(n)
eval(%); # Returns sin(n)
ln(n); #Returns ln(n)
ln(n*exp(1)); # Returns ln(n*exp(1))
expand(%); # Error, (in ln) numeric exception: division by zero
ln((n+1)*exp(1)); Returns ln((n+1)*exp(1))
expand(%); # Returns ln(n+1)+1
sqrt(n^2); # Returns 0
sqrt(n); # Returns n^(1/2)
eval(%,n=n^2); # Returns (n^2)^(1/2)
simplify(%); #Returns 0: simplify doesn't help in the examples above.
##################
We see that assume n=0 certainly doesn't imply that expressions always will be evaluated at n=0, but sometimes it appears that it does.
So what is the intended behavior when assuming equality?
##
Several years ago (Maple 14 or earlier) I overloaded assuming so that equality assumptions were handled by eval.
There was a discussion at the time in MaplePrimes about this. Shall try to find the link.

Hey,

I think I found a bug concerning the useage of assume and alias:

restart:

alias(a=a(t),b=b(t));

a, b

(1)

assume(a(t),real);

getassumptions(a(t));

{((a(t))(t))::real}

(2)

assume(b(t),real);

getassumptions(a(t));

{((b(t))(t))::real}

(3)

getassumptions(b(t));

{((b(t))(t))::real}

(4)

 

 

 

Commenting out the alias command produces correct results. I am on linux with build 922027.

alias_bug.mw

I am having trouble removing assumptions that are stored within expresssions.

Example code:

assume(l1>0): # this assumptions later helps to find a solution for a geometric problem with two four-bar-linkages
a := sqrt(l1);
save a, "test.m";
restart;
read "test.m"
a; # the assumptions are stored within the saved data
l1:='l1'; # try to remove the assumption
a; # assumption in a still existing
subs({l1=2}, a); # nothing happens: I can not access l1 any more
subs({l1~=2}, a); # This does not work either, nothing changes in a

So my question is: How do I remove the assumption within a stored expression?

My main problem lies in the handling of the expression with assumptions. At some point, I want to generate Matlab code, and the codegen-command gives me:

Warning, the following variable name replacements were made: l1~ -> cg

 

Hi All,

 

I have o problem with simplify. A variable cp1r has been assumed to be positive. Why simplify still has csgn(cp1r) for it? Here is my code:

tmp := subs(cp1t(t)=cp1r, cp2t(t)=cp2r, Ca[2]);
1 / 2 2
----------- |-cp2r sin(x[1]) sin(x[7]) cp1r
2 2 |
cp1r cp2r |
\

2
+ 2 cp2r sin(x[1]) cos(x[1]) cos(x[7]) sin(x[7]) cp1r +

1 / 2 2 /
-------------- \cp2r cos(x[1]) cos(x[7]) sin(x[7]) \
(1/2)
/ 2\
2 \cp1r /
2 \\\
-2 cos(x[1]) cos(x[7]) sin(x[1]) + 2 sin(x[1]) cos(x[1])//|
|
|
/
assume(cp1r > 0, cp2r > 0);
simplify(tmp);
1 / / 3 3
---------- \sin(x[1]) sin(x[7]) \-cos(x[1]) cos(x[7])
2
cp1r cp1r

+ 2 cos(x[1]) cos(x[7]) cp1r csgn(cp1r) cp1r

2 3 \ \

- cp1r csgn(cp1r) cp1r + cos(x[1]) cos(x[7])/ csgn(cp1r)/

 

should csgn(cp1r) be simplified to 1 already? What is wrong with my script?

 

Thanks 

Everett

assume x,y is a real number and {x>4,y>4}, how can i get the supplementary set ({x<=4,y<=4}) of x,y in the real domain by maple?

Hi all,

I have some "boolean variable" constraint equation like this:

a1*x1+a2*x2+...+an*xn>=b1*y1+b2*y2+...+bn*yn

where a1,a2,...,an and b1, b2, ..., bn are 1 or -1

These equations will be used in LPSolve or the other command to find a group of parameters which can fit them.

Now I used for-loop to deal with this kind of question, for example:

But there are more than 10 boolean variables in my case and It's very inefficient. On the other hand, using for-loop to determine the equation we solve in the command will lead to great confusion.

I think there should be some ways able to solve this kind of "boolean variables" question in Maple, such as, through assume command to define the type of "boolean variable".

But I have no idea how to do it.

I am new to maple, having recently made the switch from mathCAD, and I am having problems getting the basics to do what I think they ought to be doing.

I am trying to get maple to go step by step through a derivation of a formula. In one line I define a variable

U4 := expression

In the next line I will call the same variable and take the derivative of it. Sometimes it works and sometimes it evaluates to zero when it should not. I can't seem to pin down a pattern of when it does and does not work. I will change something that is not working, and then change it back, and it will work. Am i assigning my variables inconsistently? 

I took a screencapture of the worksheet in question. Thanks in advance for the help.

Screen shot

Page 1 of 1