Items tagged with function function Tagged Items Feed

Hi

 

I have some data:

Matrix(10, 2, {(1, 1) = 0, (1, 2) = 0, (2, 1) = .5, (2, 2) = 3.25, (3, 1) = 1.0, (3, 2) = 5.82, (4, 1) = 1.5, (4, 2) = 7.50, (5, 1) = 2.0, (5, 2) = 8.79, (6, 1) = 2.5, (6, 2) = 9.83, (7, 1) = 3.0, (7, 2) = 10.66, (8, 1) = 3.5, (8, 2) = 11.35, (9, 1) = 4.0, (9, 2) = 11.94, (10, 1) = 4.5, (10, 2) = 12.46})

 

I want Maple to make a trendline fitting a Logarithmic function. I can make it output some function with this:

LeastSquares(`<,>`(.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5), `<,>`(3.25, 5.82, 7.50, 8.79, 9.83, 10.66, 11.35, 11.94, 12.46), x, curve = a+b*ln(x))

It outputs:

5.96497783539274+4.25309474196387*ln(x)

 

But please notice, the dataset in the function does not have the first 0 and 0. If i do that:

LeastSquares(`<,>`(0, .5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5), `<,>`(0, 3.25, 5.82, 7.50, 8.79, 9.83, 10.66, 11.35, 11.94, 12.46), x, curve = a+b*ln(x))

It outputs: 

Error, (in Matrix) numeric exception: division by zero

 

Besides that, i need the R-squard value for determinating how well it fits.

 

If i do the same thing i Excel the data set will give a formular: 5.5464ln(x)-0.2175 with a R-sward value of 0.9985.

 

How can i do this i maple?

 

Thanks in Advance!

 

----

Emil Kristensen

 

 

so we have to Write a maple function with -> that takes an integer N and a boolean function

F: {(i,j) l 0<= i,j<= N} -> {true,false} 


and returns a list containing all [i,j] such that F(i,j). A procedure that does this
would be


proc(N,F) local i, j, RV;
RV:=NULL;
for i from 1 to N do for j from 1 to N do
if F(i,j) then RV:=RV,[i,j] ; end if ;
end do ; end do ;
return RV ;
end proc ;


The problem is to do this inline, i.e. you have to write
(i,j)-> ...

 

please help...

Hi,

I have a 4-D function that I have found an analytic expression for in Maple, but I want to generate a numerical 4-D array, which I can export for use in Matlab. However, I don't think I'm using a very good solution, because it is extremely slow (several minutes for even 10x10x10x10 elements). My code is

NumRange:=10:
NumElements:=10:
dx:=2*NumRange/(NumElements-1):
A:=Array(1..NumElements,1..NumElements,1..NumElements,1..NumElements,[seq([seq([seq([seq(evalf(rho(ws1,ws2,ws1p,ws2p)),ws2p=-NumRange..NumRange,dx)],ws1p=-NumRange..NumRange,dx)],ws2=-NumRange..NumRange,dx)] , ws1=-NumRange..NumRange,dx)],datatype=float);

Rho is an exponential with 10 terms in the exponents.

I also tried using four for-loops but that was even slower!

Thanks for any input

Hello Maplers, i have encountered a little annoyance with Maple, that i would like to ask, whether it can be solved. 

 

It's when i try to define a function, like f(x)=2x and try to define it with a command f(x):=2x, a pop-up box comes up, asking me whether i'd like to use a 'function definition', or 'remember table assignment', and i would like to make Maple remember my choice that i want a function. 

 

I know i can write it like f:=x->2x, but i hate to look at that, to be frankly..

 

So, is there any way to solve this?

 

so we have to Write a function that diagonalises a complex (2x2) matrix if possible,  

we need the argument to be a (2x2) matrix say A.   and we need the return value to be a list [a1 ;a2 ;b1;b2] of two complex numbers followed by two 2-vectors such that {b1,b2} is a basis for C^2 and so that  

Ab1 =a1b1 , Ab2=a2b2  if these exist. if not then the function should return an empty list []

also, the thing is that we're not allowed to load any maple packages, we have to do it by hand :'(

thanks <3

 

Dear Maple users,

 

i have a set of 2 Lines: L1 (determined by the intersection of plane x + y -1=0 and plane x - z - 1=0), 

L2 ( intersection of plane x + y-7=0 and plane x-y+1 = 0 ).

which functions or commands of maple should I use "visualize" those 2 lines L1 and L2?

 

thanks for your help,

 

JJ

I am trying to create a procedure that can solve integrals using the Composite Simpson's 3/8 rule. However when I test my procedure against maple's ApproximateInt I am getting the wrong results.

Here is my attempt:

restart;


f:= x -> exp(x)*sin(4*x); # function I am using

simp := proc(a, b, n)
  local h, sum, i, single:
  h := (b-a)/n:
  sum := 0:
  single := (3*h/8) * (f(a) + f(b)): # this is the end points
    for i from a+h by h to b-h do
       sum := sum + (3*h/8) * (3*f(i)):
    end do:
print(evalf(sum + single));
end proc:


simp(0,1,12);
                                                                                0.6224486445
evalf(Student:-Calculus1:-ApproximateInt(f(x), 0..1, method = simpson[3/8], partition=12));

                                                                                0.5323516717

 

As you can see my answer is not very close to the answer given by Maple. I am not sure why my procedure simp is wrong.

Hi there,

I'm quite new to Maple so please forgive me! I have a system of partial differential equations I'm trying to solve in Maple as such below 

 

df/dt = f(1-f) - f * h

dg/dt = g(1-g) * Gradient(1-f * gradient(g))

dh/dt = (g - h) + Laplacian(h),

where f,g,h are functions of space and time (i.e. f(x,y,z,t)). I guess my first question is - is this possible in Maple to evaluate? (I'm currently unsure on ICs as I'm figuring it out from the model - it's a model for cancer growth I'm trying to evaluate but have a rough idea of what I'd use).

If it is possible, can you please share how I'd write this? Everytime I've tried I seem to be failing to define anything properly, so your expertise would be greatly appreciated!

and  x have range=(0 to 2),the y have range = (2,3),follow when the x=(3 to 4),so the y=(3 to -3) how to implement the title's function 

still the x and y have variability value and variability number

 

is it Morphism?...

February 13 2014 rit 200

i assign 

seta := [x+1, x^2]

setb := [x^3, 2*x+5]

 

does morphism mean that

i use card_prod

to get

(x+1, x^3)

(x+1, 2*x+5)

(x^2, x^3)

(x^2, 2*x+5)

such that i composite each of 4 sets still satisfy F(f o g) = f o g

example

subs(x=x^3, x+1)

How to find inverse function of a multivariable function

for example

f := x^2 + y + z^3

f := x^2 + y^3

How to test  associativity?

How to determine which of below has associativity?

 

The definition x*(y*z) = (x*y)*z.

asso := -(1/2)*(x+y+sqrt(x^2+2*x*y-3*y^2))/y;
asso := -(1/4)*(2*x+y+sqrt(4*x^2+4*x*y-7*y^2))/y;
asso := -(2*x+y)/(y+z);
asso := (1/2)*(-y-z+sqrt(y^2-2*z*y+z^2-8*z*x))/z;
asso := (1/2)*(-z+sqrt(z^2-4*z*x-4*z*y))/z;

what is the difference between endomorphism and identity map?

http://mathfaculty.fullerton.edu/mathews//n2003/hornermod.html

i find a program above, 

if no general method, how about specific to convert it

if have general method, how is it?

assume f:= x^2*y^3/z^7

 

would like to get [x^2, y^3, z^(-7)]

1 2 3 4 5 6 7 Last Page 2 of 19