nm

10436 Reputation

19 Badges

12 years, 194 days

MaplePrimes Activity


These are questions asked by nm

This is better explained with simple example. Suppose I have these 2 equations

a:='a';b:='b';x:='x';
eqs:=[3*a+4*b = 3*x, 5*a+7*b = 7*x];

What I want is to solve for (a/x) and (b/x) from the above, and not for "a" and "b".

Currently, I do this manually as follows. First divide both equations by 'x' to obtain the ratio. I had to do this manually as writing eqs/x gave expression which was hard to work with for what I want to do. I could not simplify it for what I wanted. So I typed this

eqs2:=[3*(a/x)+4*(b/x)=3,5*(a/x)+7*(b/x)=7];   %manually typed !

Now used algsubs to replace (a/x) by new variable z1, and replace (b/x) by new variable z2, then solve for z1,z2 (btw, I had to do algsubs one at a time. (need to look at this later, but not impotant)

algsubs(a/x=z1,eqs2);
algsubs(b/x=z2,%);
solve(%,{z1,z2});

       {z1=-7,z2=6}

Is there a way or function(s) to automate this. The hard part is telling Maple to use the ratio as new variable starting from set of equations.

One annoying feature in using document mode that I found is this. As I hit the return key to execute one command and automatically jump to the command below it (a feature that I like), but after few returns, I find myself at the bottom edge of the window, with the cursor pointing at the last command in the window.

Now when hitting return, the current command is execuated, and the next command below it appears, and it is also at the bottom edge of the window.  The cursor is from now on, always sitting at the bottom edge of the window, and I am not able to fully see the rest of the command and what is below it any more.

What would be better, is to try to keep the window centered, so that as I hit a return, the actual cursor remains in the middle of the window, and the window itself scrolls up. This way the command I am about to evaluate, and anything below it, remain in full view.

What I end up doing now, is when I get to the bottom of the window, is to manually scroll the window down using the mouse, so that now the cursor is up higher, and I can see more the commands which I am about to evaluate, then I repeate this process.

Is there  a way to configure Maple to try to keep the window centered? it is really very annoying to have to keep adjusting the window every few returns, and when one has 100 commands to evaluate, one by one (since I want to see the result before I go to the next command), this process gets tiring.

(does Maple do any usability studies and evaluation on its user interface by any independent outside group?)

restart;
g:=0.88641:
e:=2.53128:
eq:=tan(g)= e*sin(f)/(1+e*cos(f)):
fsolve(eq,f);

gives  1.19749

What command/option do I need to get both solutions like with Mathematica:

g = 0.886461;
e = 2.53128;
eq = Tan[g] == (e Sin[f])/(1 + e Cos[f]);
NSolve[eq, f]

  (*   {{f -> -2.56623}, {f -> 1.19756}} *)

thanks

I find this a little frustrating as I learn Maple, so I think there is a better way to handle this.

I find myself having to keep wrapping expressions with evalf() in order to compare them, since when I use a constant such as Pi in these expressions and then compare them,  Maple complains.

In a large program, one does not know if an expression contains Pi or not beforehand, so is one really supposed to convert every expression to float just in case they might need to compare 2 expressions? 

Let me explain with simple example:

x:=1.2;  #it does not matter if this was 12/10 or 1.2, same error will result.
y:=Pi/3;
if x<y then
   print("x<y");
else
   print("x>=y");
fi;

The above gives the error "Error, cannot determine if this expression is true or false: 1.2<(1/3)*Pi"

So I changed the y assignment above to y:=evalf(Pi/3); or evalf(Pi)/3; and now Maple is happy.

But this for me looks awkward. In Mathematica, I can simply write the same, using symbolic Pi, and it works as is:

x = 1.2;  #even if this is symbolic 12/10 it will also work
y = Pi/3;
If[x < y, Print["x<y"], Print["x>=y"]]

I did not have to write  y=N[Pi/3]  where N[] is the equivalent function to Maple's evalf() which converts its argument to real.

So, now in Maple, I find myself writing evalf() around so many things, since I have to anticipate I might need to compare them in some logic later on and I can't keep track which one has some symbolic constant such as Pi in them or not. While in Mathematica I never had to worry about this.

Is there a way to reduce the need to having to use evalf() so much?
It seems to me, Maple should be able to decide if  1<Pi without me having to write 1<evalf(Pi) ?

 

I need a small help again. I have a basic question. Not able to figure how to do this.
(I am a newbie in Maple)

Maple handles things little different inside a proc() vs. global. http://www.maplesoft.com/support/help/Maple/view.aspx?path=procedure

And I could not understand what this below means in plain English:

Within a procedure, during the execution of its statementSequence, local
variables have
single level evaluation. This means that using a variable
in an expression will yield the current value of that variable, rather than
first evaluating that value. This is in contrast to how variables are evaluated
outside of a procedure, but is similar to how variables work in other programming languages.

 

But here is my question. In global name space, A variable inside an expression will automaticaly
update to the current value of the the variable. So one can do this:

x:='x';z:='z';
expr:=3*z;
z:=solve(x-1=0,x);
expr;

and now expr will have value "3" and not "3 z" since "z" was assigned a new numerical value in between
as one can see. The same code inside a proc()  behave differently

f:=proc()
  local z,x,expr;
  expr:=3*z;
  z:=solve(x-1=0,x);
  expr;
  end proc:

f();

return "3 z" and not "3" as the case with global scope. I tried subs() insid the proc,
but still it did not work. What is the recommded way to handle this? I want "expr" to
use the most recent value of any variables inside it. I can't do sub(z=z,expr) ofcourse
since this makes no sense. I need the value of z inside expr to be updated.i.e. I need
to refresh "expr" somehow.

 thank you,

First 181 182 183 184 185 186 187 Page 183 of 190