AmirHosein Sadeghimanesh

110 Reputation

6 Badges

5 years, 252 days

Social Networks and Content at Maplesoft.com

Finished Ph.D. in Applied Algebraic Geometry in Biology and did postdoc in Mathematics of Chemical Reaction Networks, University of Copenhagen. Another postdoc in Nonlinear Dynamics in the Mathematical Models of Cell Biology at University of Szeged. Currently a research fellow at Coventry University. Main interests; Applied and Computational Algebraic Geometry, Mathematical Biology, Coding. I'm also a language lover! I'm also a language lover!

MaplePrimes Activity


These are replies submitted by AmirHosein Sadeghimanesh

@Zeineb Your attached worksheet file is working pretty fine. You put the following code.

N := 3; 
x:=sin(N);

And the output is "3" and "sin(3)". Which means everything works well. Now N contains the value 3 and x contains sin(3). If you think sin(3) is something wrong, then you should remember that Maple is good with symbolic expressions and does not need to always save things in numerical values which some other software do. If you expected to see a numerical value of sin(3), then you can ask evalf(x); then Maple shows you the numerical value of x which is 0.1411200081. Or if you wanted to save the numerical value inside x from the beginning and you don't want Maple to remember that x is sin of 3 radian, then instead of x:=sin(N);, type x:=evalf(sin(3));.

Is this what made you confused?

@oggsait Carl Love is asking about the value of the function being constant with respect to x. He didn't mean x is a constant number. So it means if you pick up a fixed value of t, let's say t=0.2, then the value of your function is the same for all x values 0<x<1. So if your function is called u(x,t), then is it true that u(0,0.2)=u(0.5,0.2)=u(1,0.2)? The figure you put at your question suggest such a thing.

@acer Thanks. In fact I had tried the the same line, but instead of = I had typed := ^_^

@vv Thanks. It works fine. Just one small complain is that when it is used for type declaration of the allowable arguments of a procedure, then in case of giving a wrong type input table to the procedure, the generated error message is not very informative for the user, specifically if the user is not familiar with programming and is just going to use your defined proc. Let's look at the following simple example.

testProc:=proc(inputTable::satisfies(e -> e::'table', e -> [indices(e,nolist)]::list(integer),  e -> [entries(e,nolist)]::list(list(integer))))
return(inputTable):
end proc;

Now trying  testProc(table([1=[12,14],2=[x]]))[2]; gives an error saying the input argument is not of a correct type, but its message is not in a very informative way.

Error, invalid input: testProc expects its 1st argument, inputTable, to be of type satisfies(proc (e) options operator, arrow; e::'table' end proc, proc (e) options operator, arrow; [indices(e, nolist)]::(list(integer)) end proc, proc (e) options operator, arrow; [entries(e, nolist)]::(list(list(integer))) end proc), but received table( [( 1 ) = [12, 14], ( 2 ) = [x] ] )

For example if it would say a simple message that the entries of the input table have to be of the type integer, it would be easier for the user to notice the problem of his inputs, specially if he is not familiar with programming.

But thanks for introducing satisfies. I may put some lines to produce better error message for the user whenever it is necessary.

 

@yangtheary I guess you have some mistyping in your question. An equilateral triangle has all its angles 60 degrees, then how can BAC be 20? (Equilateral triangle - Wikipedia)

@Carl Love Then the question becomes how to remove more than one element from a table efficiently. For removing an entry of a table, there is a command unassign as explained at page 143 of the Maple programming guide 2020. Is there a command to unassign more than one entry at once or I should use a loop?

@dharr Thanks. But I'm already aware of `maplemint` command at Maple and also `code edit region`. But none of them are what I'm looking for because of the following reasons.

1- One can also write a maple code file (let's say an mpl file) at VSCode as well. Now the Maple's `code edit region` is not something inside VSCode (instead, one can use maple extension for vscode).

2- `code edit region` (and also the maple extension for vscode) has some feautures such as some colorings, but it does not edit what you type. One example that I also mentioned at my question is spaces around ":=". So I want to just type my code and not waste time pressing space key many times. I write "a:=5;", and I expect something automatically change it to "a := 5;". For python, there are such tools that can be used at editors such as VSCode or Atom etc. `code edit region` and also `maplemint` do not do any changes on my written code about spaces etc.

3- `maplemint` can be called on a procedure, and it doesn't work on something like `x:=5;`.

@Carl Love Thanks. Recently a colleague showed me that it is better to use __i instead of [i] for indexed variable names. I still like x[i], but try to avoid it at my current project.

Anyway, about using my simple answer with the __ indexing.

Replacing j[i] with j__i will not work, because eventhough we mean the varying index i, Maple count i as a symbol i at j__i. Now to make sure that Maple put the value of i and not the symbol i itself, we can use cat(j,'__',i) instead of j__i ^_^

L:=[0,1,3,4,6,10,11,15]:
ans:=0:
for i in L do
 ans:=ans+i*degree(f,cat(j,'__',i)):
end do:
ans;

Now we get 41 for f:=j__0^4*j__11*j__15^2 as expected.

You're right, even using `implicitplot` and `arctan` makes extra tails.

plots:-implicitplot(arctan(y/x)=0,x=-1..1,y=-1..1,view=[-1..1,-1..1],color=blue);

This should give the x-axis, while it gives the y-axis as well!

@mmcdara Thanks for your detailed explanation and the code ^_^

@nm Thanks. Using tabular inside figure environment in TeX is a good idea.

@mmcdara Thanks for your suggestion. Yes, or for example one can export the whole "mw" file (the worksheet) as a pdf and then crop the region of interest from the pdf. However, using this method sometimes some parts of the tabulate-plot goes out of the initial whole-file-pdf pages or the ratios and scales change etc.

The screenshot is good as it doesn't change the ratios, scale etc. But then the quaility will not be the same as other plots, let's say you want to use your plot as a figure in a paper.

@acer Thanks. Your first suggestion worked.

I also have the same struggle that Maple simplify a math expression that is supposed to stand only for a label of a plot and not to be simplified. For example using 

typeset(log[10](sigma^2))

gives you ln(sigma^2)/ln(10) which is of course not what I want to put on my plot :'( Is there anyway to emphasize to Maple that please don't simplify or do any changes on my input expression for typeset etc?

Szia Csaba. To convert an expression written in 2-D math, just right clicking on it and then from "2-D math" --> convert to --> "1-D math input" works. Or you can select the expression and then menu bar --> format --> convert to --> 1-D math input. If you have any specific example where instead of the expression itself, its result is getting represented in 1-D math input format, then can you provide one.

1 2 3 Page 1 of 3