zenterix

310 Reputation

4 Badges

3 years, 96 days

MaplePrimes Activity


These are questions asked by zenterix


Consider the worksheet below.

restart

with(Physics[Vectors])

`dτ_` := -I*z*dz*B__0*x^2*_j/d^2-I*y*dz*B__0*x^2*_k/d^2

-I*z*dz*B__0*x^2*_j/d^2-I*y*dz*B__0*x^2*_k/d^2

(1)

I want to integrate the above expression. The differential is already present in the expression. Currently, I have to manually remove the differential to use the int procedure as below.

`τ_` := int(-I*z*B__0*x^2*`#mover(mi("j"),mo("∧"))`/d^2-I*y*B__0*x^2*`#mover(mi("k"),mo("∧"))`/d^2, z = l .. -l)

(2*I)*y*B__0*x^2*_k*l/d^2

(2)

Since I want to put this operation inside a procedure, this removal of dz needs to happen programatically.


For even more context, dtau is a differential torque. 

I am integrating these infinitesimal torques.

dtau is calculated based on a magnetic field B.

I would like to have a procedure that accepts a field B and computes the torque integral.

Download RemoveDifferential.mw

I tried inserting contents of my worksheet here but for some reason procedure test2 does not appear. Therefore, here is a screenshot.

What I would like is for the call r() above to print out 3,2 and then 5.

Basically, I'd like to know how I can call a function that has default parameter values with a value that makes the function use the default parameter value.

In the code above, the variable r is assigned to the return value of test2, which is the function called "inner". The function inner accepts an argument "b" and calls the function "test" passing in this "b" as the second argument. If I don't pass any argument to "inner" then it defaults to Null, which then gets passed to "test".

I want this Null to force "test" to use its default value for parameter "b".

PS As an extra, why does it give a "not able to parse" error when we declare a local inside of a proc as above? Note that I have it commented out. 

Download Curry.mw

I'd like to be able to define functions with units and then use them.

In the example below, things don't work with Maple input. I've shown one example, with the function f2.

It seems to work better with 2D input, but it seems that it is not possible to make plots.

In the example below, I define f4 as a function of two variables that returns a function of one variable.

I'd like to call the outer function, obtain a function as a result (r1 below) and then plot the latter.

restart

with(Units:-Simple)

NULL

f1 := proc (x) options operator, arrow; x*Unit('m') end proc

proc (x) options operator, arrow; Units:-Simple:-`*`(x, Unit('m')) end proc

(1)

f1(2)

2*Units:-Unit(m)

(2)

f2:=x->xUnit(m)

Units:-Unit(m)

(3)

f2(2)

f2(2)

(4)

f3 := proc (x, y) options operator, arrow; x*Unit('m')*y*Unit('m') end proc

proc (x, y) options operator, arrow; Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(x, Unit('m')), y), Unit('m')) end proc

(5)

f3(2, 3)

6*Units:-Unit(m^2)

(6)

f4 := proc (x, y) options operator, arrow; proc (z) options operator, arrow; x*Unit('m')*y*Unit('m')*z*Unit('m') end proc end proc

proc (x, y) options operator, arrow; proc (z) options operator, arrow; Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(x, Unit('m')), y), Unit('m')), z), Unit('m')) end proc end proc

(7)

r1 := f4(2, 3)

proc (z) options operator, arrow; Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(2, Unit('m')), 3), Unit('m')), z), Unit('m')) end proc

(8)

r1(4)

24*Units:-Unit(m^3)

(9)

plot(r1)

 

NULL

The contents above aren't showing the error that Maple gives when I try to plot.

Here is a screenshot

Download FunctionUnits.mw

I have a variable with the unit Volt.

I'd like to print something like "The voltage is %f" where the floating point is the value of the variable with the unit.

I've tried the options below so far.

How would one accomplish this?

with(Units:-Simple)

NULL

x := 5*Unit('V')

5*Units:-Unit(V)

(1)

printf(x)

Error, (in fprintf) format string expected

 

printf("%f", x)

Error, (in fprintf) number expected for floating point format

 

printf("%d", x)

Error, (in fprintf) integer expected for integer format

 

printf("%a", x)

5*Units:-Unit(V)

 

printf("%A", x)

5*Units:-Unit(V)

 

printf("%q", x)

5*Units:-Unit(V)

 

printf("%v", x)

5*Units:-Unit(V)

 

printf("%P", x)

                               5 Units:-Unit(V)

 

print(x)

5*Units:-Unit(V)

(2)

print(The*voltage*is, x)

The*voltage*is, 5*Units:-Unit(V)

(3)

print(The*voltage*is*x)

5*The*voltage*is*Units:-Unit(V)

(4)

NULL

Download PrintUnits.mw

int(1/(x*exp(x)), x)

-Ei(1, x)

(1)

int(1/(x^2*exp(x)), x)

-1/(x*exp(x))+Ei(1, x)

(2)

NULLNULL

What is Ei1 in Maple?

Download Ei1.mw

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