Skip to main content
4-Participant
July 15, 2025
Solved

defined integral-time

  • July 15, 2025
  • 2 replies
  • 1197 views

I do not become a result for the following simple calculation:
Knowns: a function with calculated elements; a plot with t is possible.
(:= (@FUNCTION (@LABEL VARIABLE jerk_MH_N) (@ARGS (@LABEL VARIABLE t))) (@MATRIX 40 1 0.82 0.82 (@NEG 1.64) 6.613 (@NEG 25.687) (@NEG 4.449) 43.482 (@NEG 19.04) (@NEG 16.3) 33.51 (@NEG 18.033) (@NEG 11.234) 13.115 8.629 2.223 (@NEG 17.522) 18.01 (@NEG 4.664) 0.645 2.084 (@NEG 8.107) (@NEG 20.383) (@NEG 10.943) 15.175 (@NEG 0.777) 38.662 (@NEG 3.435) (@NEG 25.798) 6.918 (@NEG 1.875) 0.583 (@NEG 0.458) 1.25 (@NEG 4.542) 16.917 (@NEG 13.272) (@NEG 13.684) 18.154 (@NEG 9.077) (@NEG 9.077)))

weeks t:
(:= (@LABEL VARIABLE t) (@MATRIX 40 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39))

To solve is this defined integral:
(@EQ (@APPLY (@LABEL VARIABLE PA_jerk_MH_N) (@ARGS (@LABEL VARIABLE t))) (@INTEGRAL 0 t (@APPLY (@LABEL VARIABLE jerk_MH_N) (@ARGS t)) t))

t -is unknown!
I tried with t:=0..39
t up at the integral remain red, unknown.
I have standing this problem with the t at any other calculations for ex. at the numeric trapez rules too.

What make I wrong in MP10?

Can me somebody help?


Best answer by Werner_E

OK, by now you should have learned two things:

1) Don't copy math expressions from a Prime sheet to your community post here - it gets unreadable

2) Its nice to post pictures, but the worksheet itself would be of much more value most of the time. So use the option to attach files here:

Werner_E_0-1752584864577.png

You stated which version of Prime you are using and that's good an necessary. Next time you may want to do this even more eye-catching at the front of your post.

 

According your Prime problem: You defined a function for jerk and the value you assign is a vector with 40 elements.

That means that the result value for any argument t of your function would be that whole vector. Obviously that's nothing Prime would be able to integrate - hence the error message you receive.

 

You have two options:

1) Use the trapezoid rule but work with the vectors of time and jerk values, not any functions:

Werner_E_1-1752585072846.png

 

2) Turn your data vectors into a function. The most obvious way is to use linear interpolation and Prime offers this out of the box with the function "linterp".

Werner_E_2-1752585198723.png

 

You may also use cubic spline interpolation which also offered by Prime, but I guess that this would not be appropriate in your case. Spline interpolations tends to a more "wavy" (sometimes overshooting), but smoother signal. It may have its use if you intend to use the derivative as it avoids the jumps in the derivative you otherwise get because of the sudden changes in slope.

Werner_E_3-1752585392804.png

Here you see the difference concerning the derivative. But while smother you have to be aware that cubic spline interpolation adds data information which actually is not there in the original data ...

Werner_E_4-1752585743337.png

 

Prime 10 worksheet attached

 

2 replies

23-Emerald IV
July 15, 2025

You should better attach the worksheet file, the .mcdx file.

 

Other than that. Your jerk_MH_N(t) is not a function, but a vector, and you cannot integrate a vector, but you can sum it:

LucMeekes_0-1752581072076.png

And you can construct a curve through your datapoints, using linear interpolation or splines make that into a function and then integrate over that function.

 

Success!
Luc

4-Participant
July 15, 2025

many thanks for your prompt answer.
I tried with linterp bc. this do not modify the amplitude of function but cspl or pspl do this.
I have problems with t as one-ceil-matrix everywhere. How can I transform it in vector, or array with scalar values or as matrix with one ceil, or to function? With jerk_linterp_MH_N(t):=linterp(dates, jerk_MH_N(t), t), and I tried to integrate
integral | t 0 (jerk_linterp_MH_N(t)) and t on the integral is red. The function, or vector jerk_linterp_MH_N(t) is a saw-teeth function in the plot.
I tried with t:=0..39 
The same problem: t on the integral remain red.
At the trapez rules I have with t the same proble: is red in every formulas.

Werner_E25-Diamond IAnswer
25-Diamond I
July 15, 2025

OK, by now you should have learned two things:

1) Don't copy math expressions from a Prime sheet to your community post here - it gets unreadable

2) Its nice to post pictures, but the worksheet itself would be of much more value most of the time. So use the option to attach files here:

Werner_E_0-1752584864577.png

You stated which version of Prime you are using and that's good an necessary. Next time you may want to do this even more eye-catching at the front of your post.

 

According your Prime problem: You defined a function for jerk and the value you assign is a vector with 40 elements.

That means that the result value for any argument t of your function would be that whole vector. Obviously that's nothing Prime would be able to integrate - hence the error message you receive.

 

You have two options:

1) Use the trapezoid rule but work with the vectors of time and jerk values, not any functions:

Werner_E_1-1752585072846.png

 

2) Turn your data vectors into a function. The most obvious way is to use linear interpolation and Prime offers this out of the box with the function "linterp".

Werner_E_2-1752585198723.png

 

You may also use cubic spline interpolation which also offered by Prime, but I guess that this would not be appropriate in your case. Spline interpolations tends to a more "wavy" (sometimes overshooting), but smoother signal. It may have its use if you intend to use the derivative as it avoids the jumps in the derivative you otherwise get because of the sudden changes in slope.

Werner_E_3-1752585392804.png

Here you see the difference concerning the derivative. But while smother you have to be aware that cubic spline interpolation adds data information which actually is not there in the original data ...

Werner_E_4-1752585743337.png

 

Prime 10 worksheet attached

 

4-Participant
July 17, 2025

Many thanks Werner for the answer.
I attached now a small mcdx file, with short comments in them.
I have had the same problems at the derivations d/dt and I changed to numerical formulas. I think now through 3.th derivation of PM to become jerk I have multiplied the small errors. As difference between for ex. PV_MH_N(t) and PV_jerk_MH_N(t) is not more interpretable.
Maybe you have again time for me!
Thanks in advance!


25-Diamond I
July 17, 2025

Your sheet isn't showing any derivatives but a lot of errors we already fixed in my previous answer!

 

jerk_MH_N is a vector, so don't define it as if it were a function.

Werner_E_0-1752765216364.png

 

Not sure what you tried when you evaluated jerk_fun_MH_N(t). t is a vector of just 40 values, so you get a result vector with the 40 corresponding values which should be exact the vector jerk_MH_N.

Werner_E_1-1752765617025.png

So to see the smoothing effect of the spline interpolation you would rather define a range (just for plotting!) with a much smaller step size:

Werner_E_2-1752765706739.png

Next problem:

Werner_E_3-1752765806788.png

1) "time" is a vector with 40 integer values (its the same as vector t). The limit of an integral can't be a vector, it has to be a scalar

2) interpolation is a numeric only process. You can't symbolically evaluate an expression which uses a function derived by numeric evaluation

 

Maybe you meant

Werner_E_4-1752766199596.png

This defines a function which can be (numerically) evaluated at any position

Werner_E_5-1752766260625.png

or plotted, if you like

Werner_E_6-1752766299979.png