acer

32333 Reputation

29 Badges

19 years, 323 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@mmcdara Sorry, try with brackets around the anonymous operator defns, or utilize the syntax proc()...end proc.

Eg,

':-Mean'=(()->1/Pi)

etc.

@mmcdara I'm away from a working copy of Maple for one more week, so I'm afraid I cannot provide any implementation.

But I forgot to mention: For Median and Mean should you not be passing procedures, even in the case of constant values? Eg,

':-Mean'=()->1/Pi, ':-Median'=()->exp(-1)

 

Your problematic code does not follow any valid or documented calling sequence of the Statistics:-Distribution command, as far as I know.

Why not use a documented calling sequence? You could programatically generate the arguments passed to Distribution based on the attributes you've extracted (and your choice of parameter values, say). A table or piecewise or if-then could serve, keyed say upon the ParentName.

Perhaps you are simply experimenting and got curious. Otherwise you'd simply use Statistics:-Specialize on an original general instance, no?

edit: What I'm trying to get at is that it seem like a simple lookup scheme could convert the extracted ParameterName and Parameters attributes' values to the more conventional documented construction calling sequence.

@Mac Dude To be clear, I did not originally mean that a custom file would be created anew for each call (although that is an alternate approach which I was considering).

I meant that the single custom file would accept the full set of arguments that you are now passing to ssystem. This file would be written just once. Its first line would be, say,

#!/bin/tcsh

on Unix/Linux (and I don't know what on OSX). It could set its PATH and PYTHONPATH or other environment variables. It would pass along its arguments to a call to python.

 

 

Do you have a valid Maple license?

Stop posting duplicates of this question.

If you have additional details, add yhe here as a Reply/Comment on the original Question.

@adel-00 Sorry, I will be travelling for 3 weeks and have no Maple access.

Perhaps next time you could provide the correct expressions up front.

@mmcdara It's great that you found it, Statistics:-Specialize.

You last comment also has a struck-out fragment containing (mu, sigma) -> RandomVariable(Normal(mu, sigma)) . Please note that that is a procedure which generates new RVs from scratch, and not a tool for specializing/instantiating a given, extant RV (which was actually your Question). It might accomplish your goal, but it doesn't do precisely what you asked.

Please add your followup queries on this here, instead of as separate Questions.

@denitsastaicova Now you've changed your request. At first you asked how to use your given z1 to shade via colorscheme with zgradient. And now it seems as if you'd prefer a slightly different scaling and transition for the gradient of values than are in the z1 which you originally supplied.

You've subsequently added the information that what you really want is a way to visually discern the highest z1 values easily. Well, your problem there is in your choice of a zgradient from Black to RoyalBlue. But I didn't suggest that scheme... you did!

But there is another approach which can use any computed z1 in its own "zgradient" colorscheme to generate coloring data. That coloring data can then be extracted and re-used as a coloring replacement in a x1,y1 point-plot. See below for an example.

You can also adjust the scaling in the z1 to get a different pace of color gradient. (I've provided an additional example below.)

Or you can choose different colors for the gradient. Or you can use 1-~z1 to reverse your original color gradient. It's up to you which color gradient pleases you most. What I'm showing is that, yes, a 3rd list like z1 can indeed be used to denote the colorscheme zgradient in a point plot of x1 vs y1. I leave it to you to devise which z1 values and which colors for the gradient you want.

restart;

x1:=[seq(x,x=1..2,0.02)]:
y1:=[seq(y^3,y=1..2,0.02)]:
z1:=[seq(x1[i]/y1[i],i=1..51)]:

P:=plots:-pointplot([x1,y1],
                    gridlines=false,
                    symbol=solidcircle, symbolsize=15,
                    colorscheme=["zgradient",["Red"]]):

C:=indets(plots:-pointplot([x1,z1],
                           colorscheme=["zgradient",["Black","Blue"]]),
          specfunc({COLOR,COLOUR}))[1]:

subsindets(P,specfunc({COLOR,COLOUR}),()->C);

z2:=ListTools:-Reverse(1-~z1):

C2:=indets(plots:-pointplot([x1,z2],
                           colorscheme=["zgradient",["Black","Blue"]]),
          specfunc({COLOR,COLOUR}))[1]:

subsindets(P,specfunc({COLOR,COLOUR}),()->C2);

 

Download color_pointplot2.mw

@Kitonum On the line that assigns to single try using the prefix form for the call to &not, as a function call using brackets.

Error_ac.mw

It works in Maple 2018.2 using

  &not( ... )

and, fwiw,

  NULL &not ...

 

@mmcdara Unfortunately the approach you've given does not do as well in later versions. You used Maple 2015, it seems.

But with two little tweaks it can still serve. (See my Answer as to why, if you'd like.)

restart;

fe := Int(x->sqrt(1+(-5.557990765*sin(5.557990765*x)-7.3*cos(5.557990765*x)
             -5.6*sinh(5.557990765*x)+7.3*cosh(5.557990765*x))^2), 0 .. al):

g := proc(a)
  evalf(subs(al=a, fe))-0.5
end proc:

fsolve(g, 0..1);

.1550088024

evalf(subs(al=%, fe))

.5000000002

 

Download int_mmcd_ac.mw

@Carl Love The crash is due to the evalf of these Int instances at higher precision (see my Answer, eg, at Digits=25 or so).

Yes, it's true that it would be better if fsolve didn't try and demand that kind of precision increase. But the bug is in evalf(Int(...)) .

 

@pauldaas 

It's too bad that you've ignored all my previous suggestions. Your code still uses deprecated linalg and matrix, unnecessary stacking to iteratively build the Matrices, unnecessary globals, and substitution done via unnecessary assignment to the list of key names.

This code is severely flawed. It is unnecessarily fragile and will likely cause future grief.

It's also too bad that you could not properly explain the purpose of the code. Comments about load forces on a beam are irrelevant. What would be useful would be information about why you need to build R row by row, whether you really need C at the end (or just R), whether you know the number of rows in final R, etc.

I would not be surprised if a robust and sensible version of code to accomplish your true goals could be only a few lines long.

It's too bad that you ignored all my suggestions in a previous thread. Your code still uses deprecated linalg and matrix, unnecessary stacking to iteratively build the Matrices, unnecessary globals, and substitution done via unnecessary assignment to the list of key names.

This code is severely flawed. It is unnecessarily fragile and will likely cause future grief.

First 209 210 211 212 213 214 215 Last Page 211 of 591